Class ColumnData

java.lang.Object
uk.ac.starlink.table.ColumnData
Direct Known Subclasses:
ArrayColumn, BlankColumn, ConstantColumn, WrapperColumn

public abstract class ColumnData extends Object
A column which can supply and possibly store cells in array-like storage as well as supply column metadata. Note there is nothing in this class which describes the number of elements it contains (length of the column). Columns are intended to be managed by tables, and it is the table which should keep track of this information.
Author:
Mark Taylor (Starlink)
  • Constructor Details

    • ColumnData

      public ColumnData()
      Constructs a new ColumnData with no metadata.
    • ColumnData

      public ColumnData(ColumnInfo colinfo)
      Constructs a new ColumnData with metadata supplied by a given ColumnInfo object.
      Parameters:
      colinfo - the column metadata
    • ColumnData

      public ColumnData(ValueInfo base)
      Performs ColumnData initialisation based on template ValueInfo object.
      Parameters:
      base - template
  • Method Details

    • getColumnInfo

      public ColumnInfo getColumnInfo()
      Returns the ColumnInfo which provides the metadata for this column.
      Returns:
      the column metadata
    • setColumnInfo

      public void setColumnInfo(ColumnInfo colinfo)
      Sets the ColumnInfo which provides the metadata for this column.
      Parameters:
      colinfo - the column metadata
    • readValue

      public abstract Object readValue(long irow) throws IOException
      Returns the value stored at a given row in this column.
      Parameters:
      irow - the row from which to retrieve the value
      Returns:
      the value stored at irow
      Throws:
      IOException - if there is some problem reading
    • storeValue

      public void storeValue(long irow, Object val) throws IOException
      Stores a given value in a given row for this column. Will only work if the isWritable method returns true. The implementation in the ColumnData class throws an UnsupportedOperationException.
      Parameters:
      val - the object to store
      irow - the row to store it in
      Throws:
      UnsupportedOperationException - if !isWritable()
      NullPointerException - if val==null and this column is not nullable
      ArrayStoreException - if val is not compatible with the content class of this column
      IOException - if there is some problem writing
    • isWritable

      public boolean isWritable()
      Indicates whether this object can store values. The implementation in the ColumnData class returns false
      Returns:
      true iff storeValue(long, java.lang.Object) can be used