Class TableCachedData


  • public class TableCachedData
    extends java.lang.Object
    Supplies selected mask and coordinate data relating to a single table.
    Since:
    10 Dec 2020
    Author:
    Mark Taylor
    • Constructor Detail

      • TableCachedData

        public TableCachedData​(long nrow,
                               java.util.List<java.util.function.Supplier<CachedReader>> maskCols,
                               java.util.List<java.util.function.Supplier<CachedReader>> coordCols)
        Constructor. Note all the mask and coord specs are assumed to refer to the same table.
        Parameters:
        nrow - number of rows available from readers
        maskCols - list of mask column reader suppliers
        coordCols - list of coordinate column reader suppliers
    • Method Detail

      • getRowCount

        public long getRowCount()
        Returns the row count for this object's table.
        Returns:
        row count
      • getMaskColumns

        public java.util.List<java.util.function.Supplier<CachedReader>> getMaskColumns()
        Returns a list of objects supplying mask data.
        Returns:
        list of mask column reader suppliers
      • getCoordColumns

        public java.util.List<java.util.function.Supplier<CachedReader>> getCoordColumns()
        Returns a list of objects supplying coordinate data.
        Returns:
        list of coord column reader suppliers
      • readDataSeq

        @Slow
        public static TableCachedData readDataSeq​(uk.ac.starlink.table.StarTable table,
                                                  MaskSpec[] maskSpecs,
                                                  CoordSpec[] coordSpecs,
                                                  CachedColumnFactory colFact)
                                           throws java.io.IOException,
                                                  java.lang.InterruptedException
        Populates and returns a TableCachedData instance by reading from a given table in a sequential fashion.
        Parameters:
        table - input table
        maskSpecs - mask specifications relating to table
        coordSpecs - coord specifications relating to table
        colFact - creates storage
        Returns:
        populated TableCachedData
        Throws:
        java.io.IOException
        java.lang.InterruptedException
      • readDataPar

        @Slow
        public static TableCachedData readDataPar​(uk.ac.starlink.table.StarTable table,
                                                  MaskSpec[] maskSpecs,
                                                  CoordSpec[] coordSpecs,
                                                  CachedColumnFactory colFact,
                                                  uk.ac.starlink.table.RowRunner rowRunner)
                                           throws java.io.IOException
        Populates and returns a TableCachedData instance by reading from a given table in a parallel fashion.

        Use with care: The ordering of the elements in the result is not guaranteed to be the same as the input iteration ordering. Also, the returned object is less efficient for iteration than that returned by the sequential implementation.

        Parameters:
        table - input table
        maskSpecs - mask specifications relating to table
        coordSpecs - coord specifications relating to table
        colFact - creates storage
        rowRunner - row runner
        Returns:
        populated TableCachedData
        Throws:
        java.io.IOException