|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectfiftyone.mobile.detection.entities.memory.BaseList<T>
fiftyone.mobile.detection.entities.memory.MemoryVariableList<T>
public class MemoryVariableList<T extends BaseEntity>
A readonly list of variable length entity types held in memory.
Entities in the underlying data structure are either fixed length where the data that represents them always contains the same number of bytes, or variable length where the number of bytes to represent the entity varies.
This class uses the offset of the first byte of the entities data in the underlying data structure in the accessor. As such the list isn't being used as a traditional list because items are not retrieved by their index in the list, but by there offset in the underlying data structure.
The constructor will read the header information about the underlying data structure and the entities are added to the list when the Read method is called.
The class supports source stream that do not support seeking.
Should not be referenced directly.
| Field Summary |
|---|
| Fields inherited from class fiftyone.mobile.detection.entities.memory.BaseList |
|---|
array, dataSet, entityFactory, header |
| Constructor Summary | |
|---|---|
MemoryVariableList(Dataset dataSet,
BinaryReader reader,
BaseEntityFactory<T> entityFactory)
Constructs a new instance of VariableList |
|
| Method Summary | |
|---|---|
private int |
binarySearch(int offset)
Uses a divide and conquer method to search the ordered list of entities that are held in memory. |
T |
get(int offset)
Accessor for the variable list. |
void |
read(BinaryReader reader)
Reads the list into memory. |
| Methods inherited from class fiftyone.mobile.detection.entities.memory.BaseList |
|---|
dispose, iterator, size |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MemoryVariableList(Dataset dataSet,
BinaryReader reader,
BaseEntityFactory<T> entityFactory)
dataSet - The DetectorDataSet being createdreader - Reader connected to the source data structure and
positioned to start readingentityFactory - Interface implementation used to create and size new
entities of type T| Method Detail |
|---|
public void read(BinaryReader reader)
throws IOException
reader - Reader connected to the source data structure and
positioned to start reading
IOExceptionpublic T get(int offset)
As all the entities are held in memory and in ascending order of offset a BinarySearch can be used to determine the one that relates to the given offset rapidly.
offset - The offset position in the data structure to the entity to
be returned from the list
private int binarySearch(int offset)
offset - The offset position in the data structure to the entity to
be returned from the list
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||