DATATYPE
- the data type which can be returnedpublic class IndexedViewDataSource<DATATYPE> extends AbstractDataSource<DATATYPE>
DataSource
provides an indexed view of a subset of another
DataSource
.Constructor and Description |
---|
IndexedViewDataSource(DataSource<DATATYPE> dataSource,
int[] indexes)
Construct a new
IndexedViewDataSource with the given inner data
and indexes into the inner data. |
Modifier and Type | Method and Description |
---|---|
DATATYPE[] |
createTemporaryArray(int size)
Create a temporary array suitable for use with the
DataSource.getRandomRows(Object[]) and DataSource.getData(int, int, Object[])
methods. |
DATATYPE |
getData(int row)
Get the data for a given row
|
void |
getData(int startRow,
int stopRow,
DATATYPE[] data)
Get data between given rows.
|
int |
numDimensions() |
int |
size() |
getRandomRows, iterator
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public IndexedViewDataSource(DataSource<DATATYPE> dataSource, int[] indexes)
IndexedViewDataSource
with the given inner data
and indexes into the inner data.dataSource
- the inner DataSource
.indexes
- the indexed into the inner datasource.public void getData(int startRow, int stopRow, DATATYPE[] data)
DataSource
DataSource.size()
.
data is guaranteed to have (stopRow - startRow) valid entriesstartRow
- where to start (inclusive)stopRow
- where to stop (exclusive)data
- the array to fillpublic DATATYPE getData(int row)
DataSource
row
- the row numberpublic int numDimensions()
public int size()
public DATATYPE[] createTemporaryArray(int size)
DataSource
DataSource.getRandomRows(Object[])
and DataSource.getData(int, int, Object[])
methods.size
- the size of the array