Class CalcStarTable<C>
java.lang.Object
uk.ac.starlink.table.AbstractStarTable
uk.ac.starlink.table.CalcStarTable<C>
- Type Parameters:
C- type of object that is calculated from each row of the input table, and supplies values to the corresponding row of this table
- All Implemented Interfaces:
Closeable, AutoCloseable, StarTable
StarTable implementation whose column values are derived from
some single calculation on the column values of another table.
The idea is that the cell values in a given row of an instance
of this table are cheaply-obtained members of an object which
is obtained by a potentially expensive calculation on the cell
values of the corresponding row in the other table.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceDefines a column for use with this table implementation. -
Constructor Summary
ConstructorsConstructorDescriptionCalcStarTable(StarTable base, CalcStarTable.Col<C, ?>[] columns) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionabstract CcreateCalculation(long irow) Creates the calculation object for the given row of the input table.abstract CcreateCalculation(RowData baseRow) Creates the calculation object for the current row of the input table.Returns the input table on which this table is based.getCell(long irow, int icol) TheAbstractStarTableimplementation of this method throws anUnsupportedOperationException, since unless otherwise provided there is no random access.intReturns the number of columns in this table.getColumnInfo(int icol) Returns the object describing the data in a given column.Object[]getRow(long irow) TheAbstractStarTableimplementation of this method constructs a row by repeated invocation ofAbstractStarTable.getCell(long, int).Returns an object which can provide random access to this table's data, if random access is implemented.longReturns the number of rows in this table, if known.Returns an object which can iterate over all the rows in the table sequentially.Returns a default splittable which relies on table random access if available, or otherwise provides only sequential access (no splits).booleanisRandom()TheAbstractStarTableimplementation of this method returnsfalse.Methods inherited from class AbstractStarTable
checkedLongToInt, close, getColumnAuxDataInfos, getName, getParameters, getURL, setName, setParameters, setURLMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface StarTable
getParameterByName, setParameter
-
Constructor Details
-
CalcStarTable
Constructor.- Parameters:
base- input tablecolumns- array defining the columns of this table
-
-
Method Details
-
createCalculation
Creates the calculation object for the current row of the input table.- Parameters:
baseRow- row from base table- Returns:
- calculation object corresponding to
baseRow - Throws:
IOException
-
createCalculation
Creates the calculation object for the given row of the input table. Only works for random-access tables.- Parameters:
irow- row index for which calculation is required- Returns:
- calculation object for input table row
irow - Throws:
IOException
-
getBaseTable
Returns the input table on which this table is based.- Returns:
- base table
-
getColumnInfo
Description copied from interface:StarTableReturns the object describing the data in a given column.- Specified by:
getColumnInfoin interfaceStarTable- Specified by:
getColumnInfoin classAbstractStarTable- Parameters:
icol- the column for which header information is required- Returns:
- a ValueInfo object for column
icol
-
getColumnCount
public int getColumnCount()Description copied from interface:StarTableReturns the number of columns in this table.- Specified by:
getColumnCountin interfaceStarTable- Specified by:
getColumnCountin classAbstractStarTable- Returns:
- the number of columns
-
getRowCount
public long getRowCount()Description copied from interface:StarTableReturns the number of rows in this table, if known. If the number of rows cannot be (easily) determined, a value of -1 will be returned.- Specified by:
getRowCountin interfaceStarTable- Specified by:
getRowCountin classAbstractStarTable- Returns:
- the number of rows, or -1
-
isRandom
public boolean isRandom()Description copied from class:AbstractStarTableTheAbstractStarTableimplementation of this method returnsfalse.- Specified by:
isRandomin interfaceStarTable- Overrides:
isRandomin classAbstractStarTable- Returns:
trueif table random access methods are available
-
getRowSequence
Description copied from interface:StarTableReturns an object which can iterate over all the rows in the table sequentially. Each such returned object is safe for use within a single thread, but not in general from multiple threads concurrently.- Specified by:
getRowSequencein interfaceStarTable- Specified by:
getRowSequencein classAbstractStarTable- Returns:
- new RowSequence
- Throws:
IOException- if there is an error providing access
-
getRowSplittable
Description copied from class:AbstractStarTableReturns a default splittable which relies on table random access if available, or otherwise provides only sequential access (no splits).It is often possible to provide a better implementation than this.
- Specified by:
getRowSplittablein interfaceStarTable- Overrides:
getRowSplittablein classAbstractStarTable- Returns:
Tables.getDefaultRowSplittable(this)- Throws:
IOException- See Also:
-
getRowAccess
Description copied from interface:StarTableReturns an object which can provide random access to this table's data, if random access is implemented. Each such returned object is safe for use within a single thread, but not in general from multiple threads concurrently.- Specified by:
getRowAccessin interfaceStarTable- Overrides:
getRowAccessin classAbstractStarTable- Returns:
- new RowAccess
- Throws:
IOException- if there is an error setting up access
-
getRow
Description copied from class:AbstractStarTableTheAbstractStarTableimplementation of this method constructs a row by repeated invocation ofAbstractStarTable.getCell(long, int).- Specified by:
getRowin interfaceStarTable- Overrides:
getRowin classAbstractStarTable- Parameters:
irow- the index of the row to retrieve- Returns:
- an array of the objects in each cell in row
irow - Throws:
IOException- if there is an error reading the data
-
getCell
Description copied from class:AbstractStarTableTheAbstractStarTableimplementation of this method throws anUnsupportedOperationException, since unless otherwise provided there is no random access.- Specified by:
getCellin interfaceStarTable- Overrides:
getCellin classAbstractStarTable- Parameters:
irow- the index of the cell's rowicol- the index of the cell's column- Returns:
- the contents of this cell
- Throws:
IOException- if there is an error reading the data
-