uk.ac.starlink.table
Class ColumnRandomWrapperStarTable

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

public class ColumnRandomWrapperStarTable
extends RandomWrapperStarTable

RandomWrapperStarTable which works by storing the data in a set of fixed length arrays. This will be more efficient on memory used than storing it in rows if some of the columns have a primitive type, but it may make reading slower.

See Also:
RowRandomWrapperStarTable

Field Summary
 
Fields inherited from class uk.ac.starlink.table.WrapperStarTable
baseTable
 
Constructor Summary
ColumnRandomWrapperStarTable(StarTable baseTable, int nrow)
          Constructs a new table to store a given number of rows.
 
Method Summary
 long getRowCount()
          Returns the number of rows in this table, if known.
protected  java.lang.Object[] retrieveStoredRow(long lrow)
          Retrieves the row stored by the lrow'th invocation of RandomWrapperStarTable.storeNextRow(java.lang.Object[]).
protected  void storeNextRow(java.lang.Object[] row)
          Stores the next row encountered in the base table's row sequence.
 
Methods inherited from class uk.ac.starlink.table.RandomWrapperStarTable
getCell, getColumnCount, getColumnInfo, getRow, getRowSequence, getURL, isRandom
 
Methods inherited from class uk.ac.starlink.table.WrapperStarTable
checkedLongToInt, getBaseTable, getColumnAuxDataInfos, getName, getParameterByName, getParameters, setName, setParameter, setURL, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ColumnRandomWrapperStarTable

public ColumnRandomWrapperStarTable(StarTable baseTable,
                                    int nrow)
                             throws java.io.IOException
Constructs a new table to store a given number of rows. The nrow argument supplied is the number that this table will have, which may or may not match that of the base table.

Parameters:
baseTable - base table
nrow - number of rows in this table
Throws:
java.io.IOException
Method Detail

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 RandomWrapperStarTable
Returns:
the number of rows, or -1

storeNextRow

protected void storeNextRow(java.lang.Object[] row)
Description copied from class: RandomWrapperStarTable
Stores the next row encountered in the base table's row sequence. This will be called up to getRowCount times with the contents of each row of the base table in sequence. Implementations should store it in some way that it can be retrieved by RandomWrapperStarTable.retrieveStoredRow(long).

Specified by:
storeNextRow in class RandomWrapperStarTable
Parameters:
row - the row to store

retrieveStoredRow

protected java.lang.Object[] retrieveStoredRow(long lrow)
Description copied from class: RandomWrapperStarTable
Retrieves the row stored by the lrow'th invocation of RandomWrapperStarTable.storeNextRow(java.lang.Object[]). This method will not be called with a value of lrow greater than or equal to the number of times storeNextRow has been called already.

Specified by:
retrieveStoredRow in class RandomWrapperStarTable
Parameters:
lrow - the index of the row to retrieve
Returns:
the lrow'th row to be stored by RandomWrapperStarTable.storeNextRow(java.lang.Object[])