|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.ac.starlink.table.WrapperStarTable
uk.ac.starlink.table.RandomWrapperStarTable
public abstract class RandomWrapperStarTable
Abstract wrapper table which can provide a random-access view of a non-random base table. The general strategy is to read through the table only once (one RowSequence is used), storing each row when it is read. A row is not read until it is requested by a client of this class, so if the latter rows of the resulting table are never requested, they never need to be read from the base table. The exception to this is if the base table does not know how many rows it contains (getRowCount()<0), in which a getRowCount on this table will force all the rows to be read straight away to count them (a random-access table must always know how many rows it has).
Changes in the number of columns of the base table will not be reflected in this table. Changes in the data elements may or may not be reflected.
Concrete subclasses have to provide implementations of the
storeNextRow(java.lang.Object[])
and retrieveStoredRow(long)
methods.
Field Summary |
---|
Fields inherited from class uk.ac.starlink.table.WrapperStarTable |
---|
baseTable |
Constructor Summary | |
---|---|
RandomWrapperStarTable(StarTable baseTable)
Constructs a new random access table from a base table. |
Method Summary | |
---|---|
Object |
getCell(long lrow,
int icol)
Returns the contents of a given table cell. |
int |
getColumnCount()
Returns the number of columns. |
ColumnInfo |
getColumnInfo(int icol)
Returns the object describing the data in a given column. |
Object[] |
getRow(long lrow)
Returns the contents of a given table row. |
long |
getRowCount()
Returns the number of rows in this table, if known. |
RowSequence |
getRowSequence()
Returns a RowSequence object based on the random data access methods of this table. |
URL |
getURL()
Returns the URL of the base table. |
boolean |
isRandom()
Returns true. |
protected abstract Object[] |
retrieveStoredRow(long lrow)
Retrieves the row stored by the lrow'th invocation of storeNextRow(java.lang.Object[]) . |
protected abstract void |
storeNextRow(Object[] row)
Stores the next row encountered in the base table's row sequence. |
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 |
---|
public RandomWrapperStarTable(StarTable baseTable) throws IOException
baseTable
- the base StarTable
IOException
Method Detail |
---|
protected abstract void storeNextRow(Object[] row)
retrieveStoredRow(long)
.
row
- the row to storeprotected abstract Object[] retrieveStoredRow(long lrow)
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.
lrow
- the index of the row to retrieve
storeNextRow(java.lang.Object[])
public boolean isRandom()
isRandom
in interface StarTable
isRandom
in class WrapperStarTable
public int getColumnCount()
getColumnCount
in interface StarTable
getColumnCount
in class WrapperStarTable
public long getRowCount()
StarTable
getRowCount
in interface StarTable
getRowCount
in class WrapperStarTable
public URL getURL()
getURL
in interface StarTable
getURL
in class WrapperStarTable
public ColumnInfo getColumnInfo(int icol)
StarTable
getColumnInfo
in interface StarTable
getColumnInfo
in class WrapperStarTable
icol
- the column for which header information is required
public Object[] getRow(long lrow) throws IOException
StarTable
getRow
in interface StarTable
getRow
in class WrapperStarTable
lrow
- the index of the row to retrieve
IOException
- if there is an error reading the datapublic Object getCell(long lrow, int icol) throws IOException
StarTable
getCell
in interface StarTable
getCell
in class WrapperStarTable
lrow
- the index of the cell's rowicol
- the index of the cell's column
IOException
- if there is an error reading the datapublic RowSequence getRowSequence() throws IOException
getRowSequence
in interface StarTable
getRowSequence
in class WrapperStarTable
IOException
- if there is an error providing access
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |