fiftyone.mobile.detection.entities.memory
Class MemoryFixedList<T extends BaseEntity>

java.lang.Object
  extended by fiftyone.mobile.detection.entities.memory.BaseList<T>
      extended by fiftyone.mobile.detection.entities.memory.MemoryFixedList<T>
All Implemented Interfaces:
Disposable, ReadonlyList<T>, Iterable<T>

public class MemoryFixedList<T extends BaseEntity>
extends BaseList<T>

A readonly list of fixed 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 index of the entity in the accessor. The list is typically used by entities that need to be found quickly using a divide and conquer algorithm.

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 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
MemoryFixedList(Dataset dataSet, BinaryReader reader, BaseEntityFactory<T> entityFactory)
          Constructs a new instance of FixedList
 
Method Summary
 T get(int i)
          Accessor for the fixed 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

MemoryFixedList

public MemoryFixedList(Dataset dataSet,
                       BinaryReader reader,
                       BaseEntityFactory<T> entityFactory)
Constructs a new instance of FixedList

Parameters:
dataSet - The DetectorDataSet being created
reader - Reader connected to the source data structure and positioned to start reading
entityFactory - Interface implementation used to create new entities of type T
Method Detail

read

public void read(BinaryReader reader)
          throws IOException
Reads the list into memory

Parameters:
reader - Reader connected to the source data structure and positioned to start reading
Throws:
IOException

get

public T get(int i)
Accessor for the fixed list

Parameters:
i - The index of the entity to be returned from the list
Returns:
Entity at the index requested