T - Type of objectpublic abstract class ArrayBackedDataSource<T> extends Object implements DataSource<T>
DataSource backed by an array.| Modifier and Type | Field and Description | 
|---|---|
| protected T[] | data | 
| protected Random | rng | 
| Constructor and Description | 
|---|
| ArrayBackedDataSource(T[] data)Construct with data | 
| ArrayBackedDataSource(T[] data,
                     Random rng)Construct with data and a random generator for random sampling | 
| Modifier and Type | Method and Description | 
|---|---|
| T[] | createTemporaryArray(int size)Create a temporary array suitable for use with the
  DataSource.getRandomRows(Object[])andDataSource.getData(int, int, Object[])methods. | 
| T | getData(int row)Get the data for a given row | 
| void | getData(int startRow,
       int stopRow,
       T[] output)Get data between given rows. | 
| void | getRandomRows(T[] output) | 
| Iterator<T> | iterator() | 
| int | size() | 
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitnumDimensionsforEach, spliteratorpublic ArrayBackedDataSource(T[] data)
data - the datapublic ArrayBackedDataSource(T[] data, Random rng)
data - the datarng - the random generatorpublic final void getData(int startRow, int stopRow, T[] output)
DataSourceDataSource.size().
 data is guaranteed to have (stopRow - startRow) valid entriesgetData in interface DataSource<T>startRow - where to start (inclusive)stopRow - where to stop (exclusive)output - the array to fillpublic final void getRandomRows(T[] output)
getRandomRows in interface DataSource<T>output - a random set of data. This array is guaranteed to be filled.public int size()
size in interface DataSource<T>public T getData(int row)
DataSourcegetData in interface DataSource<T>row - the row numberpublic T[] createTemporaryArray(int size)
DataSourceDataSource.getRandomRows(Object[]) and DataSource.getData(int, int, Object[])
 methods.createTemporaryArray in interface DataSource<T>size - the size of the array