IData
, java.io.Serializable
public class DataTable extends DataGroup implements IData, java.io.Serializable
The number of columns is set at construction and cannot be changed.
All columns are of equal length (i.e., the length of the double[] arrays is the same for all columns). The common length of the columns is set at construction and cannot be changed.
The label in the DataInfo for this object should be descriptive of the table as a whole; the dimension in the DataInfo will be Dimension.MIXED if the dimensions of the data in the columns are not all the same, otherwise it will be the common dimension of the data in the columns.
Modifier and Type | Class | Description |
---|---|---|
static class |
DataTable.DataInfoTable |
|
static class |
DataTable.DataInfoTableFactory |
DataGroup.DataInfoGroup, DataGroup.DataInfoGroupFactory
Constructor | Description |
---|---|
DataTable(int nColumns,
int nRows) |
Creates a new table with a specified number of columns all of a given
length.
|
DataTable(DataDoubleArray[] columns) |
Modifier and Type | Method | Description |
---|---|---|
void |
assignTo(double[] array) |
Returns a new array formed from the values held by the data instance.
|
int |
getLength() |
Returns the number of values held by the data instance.
|
int |
getNRows() |
Returns the number of rows in each and every column of the table.
|
double |
getValue(int i) |
Returns the i-th data value, where the values are numbered by counting down the first column,
then the next, and so on.
|
protected static DataDoubleArray[] |
makeData(int nColumns,
int nRows) |
public DataTable(int nColumns, int nRows)
nColumns
- the number of columns to makenRows
- the length of each and every columnpublic DataTable(DataDoubleArray[] columns)
protected static DataDoubleArray[] makeData(int nColumns, int nRows)
public int getNRows()
java.lang.ArrayIndexOutOfBoundsException
- if the DataTable has zero columnspublic int getLength()
public double getValue(int i)
Specifically, returns column[i/nRows].data[i % nRows].