INSTANCE - the type of instances in the datasetSOURCE - the type of object that provides the data to create the instancepublic abstract class ReadableListDataset<INSTANCE,SOURCE> extends AbstractList<INSTANCE> implements ListDataset<INSTANCE>
ListDatasets in which each instance is read with an
InputStreamObjectReader.| Modifier and Type | Field and Description |
|---|---|
protected ObjectReader<INSTANCE,SOURCE> |
reader |
modCount| Constructor and Description |
|---|
ReadableListDataset(ObjectReader<INSTANCE,SOURCE> reader)
Construct with the given
ObjectReader. |
| Modifier and Type | Method and Description |
|---|---|
INSTANCE |
get(int index) |
String |
getID(int index)
Get an identifier for the instance at the given index.
|
INSTANCE |
getRandomInstance() |
int |
indexOfID(String id)
Get the index of the instance with the given ID, or -1 if it can't be
found.
|
int |
size() |
ListDataset<IdentifiableObject<INSTANCE>> |
toIdentifiable()
Create a view of this dataset in which the instances are wrapped up in
IdentifiableObjects. |
add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subListaddAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetInstancenumInstancesadd, add, addAll, addAll, clear, contains, containsAll, equals, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, set, sort, spliterator, subList, toArray, toArrayparallelStream, removeIf, streamprotected ObjectReader<INSTANCE,SOURCE> reader
public ReadableListDataset(ObjectReader<INSTANCE,SOURCE> reader)
ObjectReader.reader - the InputStreamObjectReader.public INSTANCE getRandomInstance()
getRandomInstance in interface Dataset<INSTANCE>public String getID(int index)
String, but sub-classes
should override to to something more sensible if possible.index - the indexpublic int indexOfID(String id)
id - the ID stringpublic final int size()
size in interface Collection<INSTANCE>size in interface List<INSTANCE>size in class AbstractCollection<INSTANCE>public ListDataset<IdentifiableObject<INSTANCE>> toIdentifiable()
IdentifiableObjects. The getID(int) method is used to
determine the identifier.Identifiable-wrapped
instances