Package uk.ac.starlink.table
Class RowSubsetStarTable
java.lang.Object
uk.ac.starlink.table.WrapperStarTable
uk.ac.starlink.table.RowSubsetStarTable
- All Implemented Interfaces:
Closeable
,AutoCloseable
,StarTable
Wraps a StarTable to present only a subset of its rows.
A
BitSet
is used to keep track of which rows in the
base table should be visible from this one; a set (true) bit in the
mask indicates a row in the base table which will be visible in this one.
It is the responsibility of the user to ensure that no bits in the
mask are set beyond the end of the underlying table - behaviour is
undefined in the case that this condition is violated (but probably
procured RowSequence objects will misbehave).- Author:
- Mark Taylor (Starlink)
-
Field Summary
Fields inherited from class uk.ac.starlink.table.WrapperStarTable
baseTable
-
Constructor Summary
ConstructorsConstructorDescriptionRowSubsetStarTable
(StarTable baseTable) Constructs a new RowSubsetStarTable with no rows showing, in which a set bit in the mask indicates a visible row.RowSubsetStarTable
(StarTable baseTable, BitSet mask) Constructs a new RowSubsetStarTable with a given mask. -
Method Summary
Modifier and TypeMethodDescriptiongetMask()
Returns the bit mask which defines which rows are seen.long
Returns the number of rows in this table, if known.Returns an object which can iterate over all the rows in the table sequentially.Returns an object which can iterate over all the rows in the table, but which may also be requested to split recursively for potentially parallel processing.boolean
isRandom()
Returns false.void
Sets the mask which determines which rows are seen.Methods inherited from class uk.ac.starlink.table.WrapperStarTable
checkedLongToInt, close, getBaseTable, getCell, getColumnAuxDataInfos, getColumnCount, getColumnInfo, getName, getParameterByName, getParameters, getRow, getRowAccess, getURL, setName, setParameter, setURL, toString
-
Constructor Details
-
RowSubsetStarTable
Constructs a new RowSubsetStarTable with no rows showing, in which a set bit in the mask indicates a visible row.- Parameters:
baseTable
- base table which provides the underlying data
-
RowSubsetStarTable
Constructs a new RowSubsetStarTable with a given mask.- Parameters:
baseTable
- base table which provides the underlying datamask
- bitmask determining which rows in baseTable are seen
-
-
Method Details
-
getMask
Returns the bit mask which defines which rows are seen.- Returns:
- row mask
-
setMask
Sets the mask which determines which rows are seen.- Parameters:
mask
- row mask
-
isRandom
public boolean isRandom()Returns false.- Specified by:
isRandom
in interfaceStarTable
- Overrides:
isRandom
in classWrapperStarTable
- Returns:
- true if table random access methods are available
-
getRowCount
public long getRowCount()Description copied from interface:StarTable
Returns 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:
getRowCount
in interfaceStarTable
- Overrides:
getRowCount
in classWrapperStarTable
- Returns:
- the number of rows, or -1
-
getRowSequence
Description copied from interface:StarTable
Returns 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:
getRowSequence
in interfaceStarTable
- Overrides:
getRowSequence
in classWrapperStarTable
- Returns:
- new RowSequence
- Throws:
IOException
- if there is an error providing access
-
getRowSplittable
Description copied from interface:StarTable
Returns an object which can iterate over all the rows in the table, but which may also be requested to split recursively for potentially parallel processing.The return value must be non-null, and may provide splitting arrangements specially appropriate for the implementation. If this table 'wraps' an upstream table, it is usually best to base the implementation on calls to the the upstream
getRowSplittable
method, so that upstream policy about how to divide up the table is respected. However, implementations without special requirements may returnTables.getDefaultRowSplittable
(this)
.- Specified by:
getRowSplittable
in interfaceStarTable
- Overrides:
getRowSplittable
in classWrapperStarTable
- Returns:
- new RowSplittable
- Throws:
IOException
- See Also:
-