Class PrimitiveArrayColumn


  • public abstract class PrimitiveArrayColumn
    extends ArrayColumn
    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 Detail

      • storeValue

        protected void storeValue​(int irow,
                                  java.lang.Object val)
      • readValue

        protected java.lang.Object readValue​(int irow)
      • setAllNulls

        public void setAllNulls()
        Sets all the elements in this column to null. Each will remain null until it is explicitly set (to a non-null value) using storeValue(int, java.lang.Object) or until setNoNulls() 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 using storeValue(int, java.lang.Object) with a null argument, or setAllNulls() is called.
      • makePrimitiveColumn

        public static PrimitiveArrayColumn makePrimitiveColumn​(ColumnInfo base,
                                                               java.lang.Object data)
        Constructs a new PrimitiveArrayColumn based on a given data array. The contentClass of the given base column info must be compatible with the supplied data array; it should be that of the corresponding wrapper class. Alternatively, the base column info may have a null 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 info
        data - an array of primitives which will form the storage for this column
        Returns:
        a new PrimitiveArrayColumn based on base backed by data
        Throws:
        java.lang.IllegalArgumentException - if data isn't an array or base.getContentClass() is incompatible with data
      • makePrimitiveColumn

        public static PrimitiveArrayColumn makePrimitiveColumn​(ColumnInfo base,
                                                               long rowCount)
        Obtains an ArrayColumn 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 template ColumnInfo - note this is not the actual ColumnInfo object which will be returned by the getColumnInfo method of the returned ArrayColumn
        rowCount - the number of rows it is to hold
        Returns:
        a new PrimitiveArrayColumn based on base with storage for rowCount elements