Interface Tuple

  • All Known Subinterfaces:
    TupleSequence
    All Known Implementing Classes:
    EmptyTupleSequence, WrapperTupleSequence

    public interface Tuple
    Defines a tuple of typed values for plotting. Such tuples are implicitly part of a sequence, that is they represent a row in a table. Elements of the tuple may be referred to as fields or columns, and are accessed by field/column index.

    Different typed access methods are provided for retrieving the result of each column. It is up to the caller to keep track of which is the right one to use. It's done this way so that we can return primitive values.

    Note that in most cases a Tuple instance is also a TupleSequence. That means that once the TupleSequence has been advanced to the next row, calling the Tuple methods will give different values. It follows that calls to a Tuple instance should be made and the results consumed synchronously before the next iteration, such instances are generally not suitable for hanging on to outside of an iteration step.

    The point of separating the two interfaces is to make it clear when a client is only permitted to read the values and not to advance the iterator.

    Since:
    25 Apr 2017
    Author:
    Mark Taylor
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean getBooleanValue​(int icol)
      Returns the value of a given column as a boolean.
      double getDoubleValue​(int icol)
      Returns the value of a given column as a double.
      int getIntValue​(int icol)
      Returns the value of a given column as an integer.
      long getLongValue​(int icol)
      Returns the value of a given column as a long.
      java.lang.Object getObjectValue​(int icol)
      Returns the value of a given column as an object.
      long getRowIndex()
      Returns the row index for the underlying data set.
    • Method Detail

      • getRowIndex

        long getRowIndex()
        Returns the row index for the underlying data set. Note this value may not undergo a simple increment between steps (if rows are excluded from the underlying data set it may increase by more than one in some cases).
        Returns:
        row index of underlying table row
      • getObjectValue

        java.lang.Object getObjectValue​(int icol)
        Returns the value of a given column as an object. If that element of the tuple is not of object type, the result may not be useful.

        If the result is a mutable object, its value may be overwritten by subsequent calls to this method (especially following calls to TupleSequence.next() if this object also implements TupleSequence).

        Parameters:
        icol - column index
        Returns:
        value of element icol, presumed of object type
      • getDoubleValue

        double getDoubleValue​(int icol)
        Returns the value of a given column as a double. If that element of the tuple is not of numeric type, the result may not be useful.
        Parameters:
        icol - column index
        Returns:
        value of element icol, presumed of numeric type
      • getIntValue

        int getIntValue​(int icol)
        Returns the value of a given column as an integer. If that element of the tuple is not of numeric type, the result may not be useful.
        Parameters:
        icol - column index
        Returns:
        value of element icol, presumed of numeric type
      • getLongValue

        long getLongValue​(int icol)
        Returns the value of a given column as a long. If that element of the tuple is not of numeric type, the result may not be useful.
        Parameters:
        icol - column index
        Returns:
        value of element icol, presumed of numeric type
      • getBooleanValue

        boolean getBooleanValue​(int icol)
        Returns the value of a given column as a boolean. If that element of the table is not of boolean type, the result may not be useful.
        Parameters:
        icol - column index
        Returns:
        value of element icol, presumed of boolean type