KEY - Type of dataset class keyDATASET - Type of sub-datasets.INSTANCE - Type of instances in the datasetSOURCE - the type of object that provides the data to create the instancepublic abstract class ReadableGroupDataset<KEY,DATASET extends Dataset<INSTANCE>,INSTANCE,SOURCE> extends AbstractMap<KEY,DATASET> implements GroupedDataset<KEY,DATASET,INSTANCE>
GroupedDatasets in which each instance is read with an
InputStreamObjectReader.AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| Modifier and Type | Field and Description |
|---|---|
protected ObjectReader<INSTANCE,SOURCE> |
reader |
| Constructor and Description |
|---|
ReadableGroupDataset(ObjectReader<INSTANCE,SOURCE> reader)
Construct with the given
InputStreamObjectReader. |
| Modifier and Type | Method and Description |
|---|---|
Set<KEY> |
getGroups()
Get the set of all defined group keys.
|
DATASET |
getInstances(KEY key)
Get sub-dataset corresponding to the given group key
|
INSTANCE |
getRandomInstance() |
INSTANCE |
getRandomInstance(KEY key)
Get a random instance from the sub-dataset corresponding to a specific
group.
|
Iterator<INSTANCE> |
iterator() |
int |
numInstances()
Returns the number of instances in this dataset.
|
clear, clone, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, toString, valuesfinalize, getClass, notify, notifyAll, wait, wait, waitforEach, spliteratorclear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, valuesprotected ObjectReader<INSTANCE,SOURCE> reader
public ReadableGroupDataset(ObjectReader<INSTANCE,SOURCE> reader)
InputStreamObjectReader.reader - the InputStreamObjectReader.public INSTANCE getRandomInstance()
getRandomInstance in interface Dataset<INSTANCE>public int numInstances()
DatasetnumInstances in interface Dataset<INSTANCE>public DATASET getInstances(KEY key)
GroupedDatasetgetInstances in interface GroupedDataset<KEY,DATASET extends Dataset<INSTANCE>,INSTANCE>key - the key.public Set<KEY> getGroups()
GroupedDatasetpublic INSTANCE getRandomInstance(KEY key)
GroupedDatasetgetRandomInstance in interface GroupedDataset<KEY,DATASET extends Dataset<INSTANCE>,INSTANCE>key - the group key