uk.ac.starlink.table
Class RowSubsetStarTable

java.lang.Object
  extended by uk.ac.starlink.table.WrapperStarTable
      extended by uk.ac.starlink.table.RowSubsetStarTable
All Implemented Interfaces:
StarTable

public class RowSubsetStarTable
extends WrapperStarTable

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).


Field Summary
 
Fields inherited from class uk.ac.starlink.table.WrapperStarTable
baseTable
 
Constructor Summary
RowSubsetStarTable(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, java.util.BitSet mask)
          Constructs a new RowSubsetStarTable with a given mask.
 
Method Summary
 java.util.BitSet getMask()
          Returns the bit mask which defines which rows are seen.
 long getRowCount()
          Returns the number of rows in this table, if known.
 RowSequence getRowSequence()
          Returns an object which can iterate over all the rows in the table sequentially.
 boolean isRandom()
          Returns false.
 void setMask(java.util.BitSet mask)
          Sets the mask which determines which rows are seen.
 
Methods inherited from class uk.ac.starlink.table.WrapperStarTable
checkedLongToInt, getBaseTable, getCell, getColumnAuxDataInfos, getColumnCount, getColumnInfo, getName, getParameterByName, getParameters, getRow, getURL, setName, setParameter, setURL, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RowSubsetStarTable

public RowSubsetStarTable(StarTable baseTable)
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

public RowSubsetStarTable(StarTable baseTable,
                          java.util.BitSet mask)
Constructs a new RowSubsetStarTable with a given mask.

Parameters:
baseTable - base table which provides the underlying data
mask - bitmask determining which rows in baseTable are seen
Method Detail

getMask

public java.util.BitSet getMask()
Returns the bit mask which defines which rows are seen.

Returns:
row mask

setMask

public void setMask(java.util.BitSet mask)
Sets the mask which determines which rows are seen.

Parameters:
mask - row mask

isRandom

public boolean isRandom()
Returns false.

Specified by:
isRandom in interface StarTable
Overrides:
isRandom in class WrapperStarTable
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 interface StarTable
Overrides:
getRowCount in class WrapperStarTable
Returns:
the number of rows, or -1

getRowSequence

public RowSequence getRowSequence()
                           throws java.io.IOException
Description copied from interface: StarTable
Returns an object which can iterate over all the rows in the table sequentially.

Specified by:
getRowSequence in interface StarTable
Overrides:
getRowSequence in class WrapperStarTable
Returns:
an object providing sequential access to the table data
Throws:
java.io.IOException - if there is an error providing access