# Class TableCachedData

java.lang.Object
uk.ac.starlink.ttools.plot2.data.TableCachedData

public class TableCachedData extends 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, List<Supplier<CachedReader>> maskCols, List<Supplier<CachedReader>> coordCols)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`List<Supplier<CachedReader>>`
`getCoordColumns()`
Returns a list of objects supplying coordinate data.
`List<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.

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### TableCachedData

public TableCachedData(long nrow, List<Supplier<CachedReader>> maskCols, List<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 Details

### getRowCount

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

Returns:
  row count

### getMaskColumns

public List<Supplier<CachedReader>> getMaskColumns()
Returns a list of objects supplying mask data.

Returns:
  list of mask column reader suppliers

### getCoordColumns

public List<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 IOException, 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:
  `IOException`
  `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 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:
  `IOException`