T - The type the list will contain.public abstract class BaseList<T extends BaseEntity> extends Object implements ReadonlyList<T>, Disposable
This class provides base functions for lists implemented in memory using arrays of type T.
Interfaces are used to create new instances of items to add to the list in order to avoid creating many inherited list classes for each type.
The data is held in the private variable array.
Should not be referenced directly.
| Modifier and Type | Field and Description |
|---|---|
protected List<T> |
array
Array of items contained in the list.
|
protected Dataset |
dataSet
The dataset which contains the list.
|
protected BaseEntityFactory<T> |
entityFactory
Interface used to create a new instance of an item in the list.
|
Header |
header
Information about the data structure the list is associated with.
|
| Constructor and Description |
|---|
BaseList(Dataset dataSet,
BinaryReader reader,
BaseEntityFactory<T> entityFactory)
Constructs a new instance of
|
| Modifier and Type | Method and Description |
|---|---|
void |
dispose()
Dispose of any items the list holds open.
|
Iterator<T> |
iterator() |
int |
size() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetforEach, spliteratorpublic final Header header
protected final Dataset dataSet
protected final BaseEntityFactory<T extends BaseEntity> entityFactory
protected final List<T extends BaseEntity> array
BaseList(Dataset dataSet, BinaryReader reader, BaseEntityFactory<T> entityFactory)
dataSet - Dataset being createdreader - Reader used to initialise the headerentityFactory - Interface used to create new entities of type T from
the read methodpublic void dispose()
dispose in interface Disposablepublic Iterator<T> iterator()
iterator in interface Iterable<T extends BaseEntity>public int size()
size in interface ReadonlyList<T extends BaseEntity>