Naanou.ResourceExchange
Class ResourceAvailRange

An available range

Field Summary
int CHUNK_MAX_GROWTH
         Maximum chunk growth power
int CHUNK_START_POWER
         Smallest number of bytes
long End
         Ending byte number
bool Filled
         Is range filled
bool Needed
         Is range needed
long origEnd
long origStart
System.Collections.ArrayList sources
long Start
         Start byte number

Constructor Summary
ResourceAvailRange(long start, long end)
         Constructor
ResourceAvailRange(long start, long end, bool needed, bool filled)
         Constructor

Property Summary
int Count
         Gets the number of sources for this range
bool IsEmpty
         Is the range empty?
bool IsMarker
         Is range a marker
bool IsValid
         Is the range's bounds valid
string Key
         Returns a string representation Start-End
long Length
         Gets the number of bytes represented by the range

Method Summary
void AddSource(Naanou.ResourceExchange.Source.Manifest source)
         Adds a new source
void AddSources(Naanou.ResourceExchange.ResourceAvailRange range)
         Adds all the sources from a particular range
Naanou.ResourceExchange.ResourceAvailRange GetChunk(int generation)
         Skims a chunk of a certain size off this range
Naanou.ResourceExchange.Source.Manifest[] GetSources()
         Gets an array of sources this range has (subject to change)
System.Collections.ArrayList GetSourcesArrayList()
         Gets the sources array list
bool Overlaps(Naanou.ResourceExchange.ByteRange range)
         Does this range overlap
Naanou.ResourceExchange.Source.Manifest RemoveSource()
         Removes a source and returns it

Methods inherited from class System.Object
Equals, Finalize, GetHashCode, GetType, MemberwiseClone, ToString


Field Detail

CHUNK_MAX_GROWTH

public int CHUNK_MAX_GROWTH

Maximum chunk growth power


CHUNK_START_POWER

public int CHUNK_START_POWER

Smallest number of bytes


End

public long End

Ending byte number


Filled

public bool Filled

Is range filled


Needed

public bool Needed

Is range needed


origEnd

private long origEnd


origStart

private long origStart


sources

private System.Collections.ArrayList sources


Start

public long Start

Start byte number

Constructor Detail

ResourceAvailRange

public ResourceAvailRange(long start,
                          long end)

Constructor

Parameters:
start -
end -

ResourceAvailRange

public ResourceAvailRange(long start,
                          long end,
                          bool needed,
                          bool filled)

Constructor

Parameters:
start -
end -
needed -
filled -
Property Detail

Count

public int Count

Gets the number of sources for this range


IsEmpty

public bool IsEmpty

Is the range empty?


IsMarker

public bool IsMarker

Is range a marker


IsValid

public bool IsValid

Is the range's bounds valid


Key

public string Key

Returns a string representation Start-End


Length

public long Length

Gets the number of bytes represented by the range

Method Detail

AddSource

public void AddSource(Naanou.ResourceExchange.Source.Manifest source)

Adds a new source

Parameters:
source -

AddSources

public void AddSources(Naanou.ResourceExchange.ResourceAvailRange range)

Adds all the sources from a particular range

Parameters:
range - Range

GetChunk

public Naanou.ResourceExchange.ResourceAvailRange GetChunk(int generation)

Skims a chunk of a certain size off this range

Parameters:
generation -
Returns:
Chunk
Throws:
System.InvalidOperationException - If range is a marker

GetSources

public Naanou.ResourceExchange.Source.Manifest[] GetSources()

Gets an array of sources this range has (subject to change)

Returns:

GetSourcesArrayList

public System.Collections.ArrayList GetSourcesArrayList()

Gets the sources array list

Returns:
ArrayList of ResourceSources

Overlaps

public bool Overlaps(Naanou.ResourceExchange.ByteRange range)

Does this range overlap

Parameters:
range -
Returns:

RemoveSource

public Naanou.ResourceExchange.Source.Manifest RemoveSource()

Removes a source and returns it

Returns: