public abstract class BaseList<T extends BaseEntity> extends Object implements ReadonlyList<T>, ICacheList, Disposable
This class provides core functions needed for lists which
load objects as required. It implements the Cache Interface
implementations are used to create new instances of items to add to the list
in order to avoid creating many inherited list classes for each BaseEntity
type. Should not be referenced directly.
| Modifier and Type | Field and Description |
|---|---|
Cache<T> |
cache
Used to store previously accessed items to improve performance and reduce
memory consumption associated with creating new instances of entities
already in use.
|
protected Dataset |
dataSet
The dataset which contains the list.
|
(package private) BaseEntityFactory<T> |
entityFactory |
(package private) Header |
header
Information about the data structure the list is associated with.
|
(package private) Pool |
pool
Pools of binary readers connected to the data source.
|
| Constructor and Description |
|---|
BaseList(Dataset dataSet,
BinaryReader reader,
Source source,
BaseEntityFactory<T> entityFactory)
Constructs a new instance of BaseList
|
| Modifier and Type | Method and Description |
|---|---|
protected abstract T |
createEntity(int offset,
BinaryReader reader) |
void |
dispose()
Disposes of the pool of readers.
|
T |
get(int offsetOrIndex)
Retrieves the record at the offset or index requested
|
int |
getCount() |
double |
getPercentageMisses() |
int |
size() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, iterator, spliteratorpublic final Cache<T extends BaseEntity> cache
final Pool pool
protected final Dataset dataSet
final Header header
final BaseEntityFactory<T extends BaseEntity> entityFactory
public BaseList(Dataset dataSet, BinaryReader reader, Source source, BaseEntityFactory<T> entityFactory)
dataSet - Dataset being createdreader - Reader used to initialise the header onlysource - Source data file containing the entire data structureprotected abstract T createEntity(int offset, BinaryReader reader) throws IOException
IOExceptionpublic double getPercentageMisses()
getPercentageMisses in interface ICacheListpublic int getCount()
public T get(int offsetOrIndex) throws IOException
get in interface ReadonlyList<T extends BaseEntity>offsetOrIndex - Index or offset of the record requiredIOExceptionpublic void dispose()
dispose in interface Disposablepublic int size()
size in interface ReadonlyList<T extends BaseEntity>