Package uk.ac.starlink.ttools.plot2.data
Class TableCachedData
- java.lang.Object
-
- uk.ac.starlink.ttools.plot2.data.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 Summary
Constructors Constructor Description TableCachedData(long nrow, java.util.List<java.util.function.Supplier<CachedReader>> maskCols, java.util.List<java.util.function.Supplier<CachedReader>> coordCols)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<java.util.function.Supplier<CachedReader>>
getCoordColumns()
Returns a list of objects supplying coordinate data.java.util.List<java.util.function.Supplier<CachedReader>>
getMaskColumns()
Returns a list of objects supplying mask data.long
getRowCount()
Returns the row count for this object's table.static TableCachedData
readDataPar(uk.ac.starlink.table.StarTable table, MaskSpec[] maskSpecs, CoordSpec[] coordSpecs, CachedColumnFactory colFact, uk.ac.starlink.table.RowRunner rowRunner)
Populates and returns a TableCachedData instance by reading from a given table in a parallel fashion.static TableCachedData
readDataSeq(uk.ac.starlink.table.StarTable table, MaskSpec[] maskSpecs, CoordSpec[] coordSpecs, CachedColumnFactory colFact)
Populates and returns a TableCachedData instance by reading from a given table in a sequential fashion.
-
-
-
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 readersmaskCols
- list of mask column reader supplierscoordCols
- 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 tablemaskSpecs
- mask specifications relating to tablecoordSpecs
- coord specifications relating to tablecolFact
- 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 tablemaskSpecs
- mask specifications relating to tablecoordSpecs
- coord specifications relating to tablecolFact
- creates storagerowRunner
- row runner- Returns:
- populated TableCachedData
- Throws:
java.io.IOException
-
-