T - The type of BaseEntity the list will containpublic class MemoryFixedList<T extends BaseEntity> extends MemoryBaseList<T> implements IFixedList<T>
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 class supports source stream that do not support seeking.
Objects of this class should not be created directly as they are part of the internal logic.
array, dataSet, entityFactory, header| Constructor and Description |
|---|
MemoryFixedList(Dataset dataSet,
BinaryReader reader,
BaseEntityFactory<T> entityFactory)
Constructs a new instance of MemoryFixedList.
|
| Modifier and Type | Method and Description |
|---|---|
T |
get(int i)
Accessor for the fixed list.
|
IClosableIterator<T> |
getRange(int index,
int count)
Returns the MemoryFixedListIterator for specific range.
|
void |
read(BinaryReader reader)
Reads the list into memory.
|
close, iterator, sizeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsizeforEach, iterator, spliteratorpublic MemoryFixedList(Dataset dataSet, BinaryReader reader, BaseEntityFactory<T> entityFactory)
dataSet - The DataSet 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.public void read(BinaryReader reader) throws IOException
read in class MemoryBaseList<T extends BaseEntity>reader - Reader connected to the source data structure and
positioned to start reading.IOException - if there was a problem accessing data file.public T get(int i)
get in interface IReadonlyList<T extends BaseEntity>i - The index of the entity to be returned from the list.public IClosableIterator<T> getRange(int index, int count)
getRange in interface IFixedList<T extends BaseEntity>index - start at this element.count - finish at this element.Copyright © 2015 51Degrees. All rights reserved.