Class CachedTupleSequence

  • All Implemented Interfaces:
    Tuple, TupleSequence, uk.ac.starlink.util.Sequence, uk.ac.starlink.util.Splittable<TupleSequence>

    public class CachedTupleSequence
    extends java.lang.Object
    implements TupleSequence
    TupleSequence implementation based on CachedColumns.
    Since:
    3 Jan 2020
    Author:
    Mark Taylor
    • Constructor Summary

      Constructors 
      Constructor Description
      CachedTupleSequence​(java.util.function.Supplier<CachedReader> maskSupplier, java.util.function.Supplier<CachedReader[]> colsSupplier, long nrow)
      Public constructor.
    • Method Summary

      All Methods Instance Methods Concrete 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.
      boolean next()
      Advances to the next entry.
      TupleSequence split()  
      long splittableSize()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CachedTupleSequence

        public CachedTupleSequence​(java.util.function.Supplier<CachedReader> maskSupplier,
                                   java.util.function.Supplier<CachedReader[]> colsSupplier,
                                   long nrow)
        Public constructor.
        Parameters:
        maskSupplier - supplier for boolean-typed column reader, providing inclusion flags per row; null means include all rows
        colsSupplier - supplier for array of columns providing data cells per row
    • Method Detail

      • next

        public boolean next()
        Description copied from interface: TupleSequence
        Advances to the next entry. No exception is thrown.
        Specified by:
        next in interface uk.ac.starlink.util.Sequence
        Specified by:
        next in interface TupleSequence
      • splittableSize

        public long splittableSize()
        Specified by:
        splittableSize in interface uk.ac.starlink.util.Splittable<TupleSequence>
      • getRowIndex

        public long getRowIndex()
        Description copied from interface: Tuple
        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).
        Specified by:
        getRowIndex in interface Tuple
        Returns:
        row index of underlying table row
      • getObjectValue

        public java.lang.Object getObjectValue​(int icol)
        Description copied from interface: Tuple
        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).

        Specified by:
        getObjectValue in interface Tuple
        Parameters:
        icol - column index
        Returns:
        value of element icol, presumed of object type
      • getDoubleValue

        public double getDoubleValue​(int icol)
        Description copied from interface: Tuple
        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.
        Specified by:
        getDoubleValue in interface Tuple
        Parameters:
        icol - column index
        Returns:
        value of element icol, presumed of numeric type
      • getIntValue

        public int getIntValue​(int icol)
        Description copied from interface: Tuple
        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.
        Specified by:
        getIntValue in interface Tuple
        Parameters:
        icol - column index
        Returns:
        value of element icol, presumed of numeric type
      • getLongValue

        public long getLongValue​(int icol)
        Description copied from interface: Tuple
        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.
        Specified by:
        getLongValue in interface Tuple
        Parameters:
        icol - column index
        Returns:
        value of element icol, presumed of numeric type
      • getBooleanValue

        public boolean getBooleanValue​(int icol)
        Description copied from interface: Tuple
        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.
        Specified by:
        getBooleanValue in interface Tuple
        Parameters:
        icol - column index
        Returns:
        value of element icol, presumed of boolean type