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>
GroupedDataset
s 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, values
protected 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()
Dataset
numInstances
in interface Dataset<INSTANCE>
public DATASET getInstances(KEY key)
GroupedDataset
getInstances
in interface GroupedDataset<KEY,DATASET extends Dataset<INSTANCE>,INSTANCE>
key
- the key.public Set<KEY> getGroups()
GroupedDataset
public INSTANCE getRandomInstance(KEY key)
GroupedDataset
getRandomInstance
in interface GroupedDataset<KEY,DATASET extends Dataset<INSTANCE>,INSTANCE>
key
- the group key