Package edu.cmu.tetrad.data
Interface DataBox
- All Superinterfaces:
Serializable
,TetradSerializable
- All Known Implementing Classes:
ByteDataBox
,DoubleDataBox
,FloatDataBox
,IntDataBox
,LongDataBox
,MixedDataBox
,ShortDataBox
,VerticalDoubleDataBox
,VerticalIntDataBox
Stores a 2D array of data. Different implementations may store data in different ways, allowing for space or time
efficiency.
- Version:
- $Id: $Id
- Author:
- josephramsey
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final long
ConstantserialVersionUID=23L
-
Method Summary
Modifier and TypeMethodDescriptioncopy()
copy.get
(int row, int col) get.like()
Returns a data box of the same dimensions as this one, without setting any values.int
numCols()
numCols.int
numRows()
numRows.void
Sets the value at the given row and column to the given Number.viewSelection
(int[] rows, int[] cols) viewSelection.
-
Field Details
-
serialVersionUID
static final long serialVersionUIDConstantserialVersionUID=23L
- See Also:
-
-
Method Details
-
numRows
int numRows()numRows.
- Returns:
- the (fixed) number of rows of the dataset.
-
numCols
int numCols()numCols.
- Returns:
- the (fixed) number of columns of the dataset.
-
set
Sets the value at the given row and column to the given Number. This number may be interpreted differently depending on how values are stored. A value of null is interpreted as a missing value.- Parameters:
row
- the row index.col
- the column index.value
- the value to store.- Throws:
IllegalArgumentException
- if the given value cannot be stored (because it's out of range or cannot be converted or whatever).
-
get
get.
- Parameters:
row
- the row index.col
- the column index.- Returns:
- the value at the given row and column as a Number. If the value is missing, null is uniformly returned.
-
copy
-
viewSelection
viewSelection.
- Parameters:
rows
- the row indices.cols
- the column indices.- Returns:
- this data box, restricted to the given rows and columns.
-
like
DataBox like()Returns a data box of the same dimensions as this one, without setting any values.- Returns:
- a new data box.
-