Package uk.ac.starlink.table
Class PrimitiveArrayColumn
java.lang.Object
uk.ac.starlink.table.ColumnData
uk.ac.starlink.table.ArrayColumn
uk.ac.starlink.table.PrimitiveArrayColumn
A column which provides data storage in a java array of primitives.
Thus a
float[]
array is used rather than a Float[]
array, which should be more efficient on memory.
Null values may be stored in the column; a BitSet
is used to keep track of which elements are null
.
By default (on column construction),
none of the values are null
.
Obtain an instance of this class using one of the
makePrimitiveColumn
methods.
- Author:
- Mark Taylor (Starlink)
-
Method Summary
Modifier and TypeMethodDescriptionstatic PrimitiveArrayColumn
makePrimitiveColumn
(ColumnInfo base, long rowCount) Obtains anArrayColumn
object based on a template object with a given number of rows.static PrimitiveArrayColumn
makePrimitiveColumn
(ColumnInfo base, Object data) Constructs a new PrimitiveArrayColumn based on a given data array.protected Object
readValue
(int irow) void
Sets all the elements in this column tonull
.void
Sets all the elements in this column to non-null
values.protected void
storeValue
(int irow, Object val) Methods inherited from class uk.ac.starlink.table.ArrayColumn
getArray, isWritable, makeColumn, makeColumn, makeColumn, readValue, storeValue
Methods inherited from class uk.ac.starlink.table.ColumnData
getColumnInfo, setColumnInfo
-
Method Details
-
storeValue
-
readValue
-
setAllNulls
public void setAllNulls()Sets all the elements in this column tonull
. Each will remainnull
until it is explicitly set (to a non-null value) usingstoreValue(int, java.lang.Object)
or untilsetNoNulls()
is called. -
setNoNulls
public void setNoNulls()Sets all the elements in this column to non-null
values. The value of each cell will be determined by the value of the underlying data array, until it is set usingstoreValue(int, java.lang.Object)
with anull
argument, orsetAllNulls()
is called. -
makePrimitiveColumn
Constructs a new PrimitiveArrayColumn based on a given data array. ThecontentClass
of the given base column info must be compatible with the supplied data array; it should be that of the corresponding wrapper class. Alternatively, thebase
column info may have anull
content class, in which case the column info for the new column will be set appropriately from the data array.- Parameters:
base
- the column info on which to base this column's infodata
- an array of primitives which will form the storage for this column- Returns:
- a new
PrimitiveArrayColumn
based onbase
backed bydata
- Throws:
IllegalArgumentException
- ifdata
isn't an array orbase.getContentClass()
is incompatible withdata
-
makePrimitiveColumn
Obtains anArrayColumn
object based on a template object with a given number of rows. A new ColumnInfo object will be constructed based on the given one.- Parameters:
base
- the templateColumnInfo
- note this is not the actual ColumnInfo object which will be returned by thegetColumnInfo
method of the returnedArrayColumn
rowCount
- the number of rows it is to hold- Returns:
- a new
PrimitiveArrayColumn
based onbase
with storage forrowCount
elements
-