|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| 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 | |
|---|---|
java.lang.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. |
java.lang.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. |
java.net.URL |
getURL()
Returns the URL of the base table. |
boolean |
isRandom()
Returns true. |
protected abstract java.lang.Object[] |
retrieveStoredRow(long lrow)
Retrieves the row stored by the lrow'th invocation of storeNextRow(java.lang.Object[]). |
protected abstract 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.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 java.io.IOException
baseTable - the base StarTable
java.io.IOException| Method Detail |
|---|
protected abstract void storeNextRow(java.lang.Object[] row)
retrieveStoredRow(long).
row - the row to storeprotected abstract java.lang.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 StarTableisRandom in class WrapperStarTablepublic int getColumnCount()
getColumnCount in interface StarTablegetColumnCount in class WrapperStarTablepublic long getRowCount()
StarTable
getRowCount in interface StarTablegetRowCount in class WrapperStarTablepublic java.net.URL getURL()
getURL in interface StarTablegetURL in class WrapperStarTablepublic ColumnInfo getColumnInfo(int icol)
StarTable
getColumnInfo in interface StarTablegetColumnInfo in class WrapperStarTableicol - the column for which header information is required
public java.lang.Object[] getRow(long lrow)
throws java.io.IOException
StarTable
getRow in interface StarTablegetRow in class WrapperStarTablelrow - the index of the row to retrieve
java.io.IOException - if there is an error reading the data
public java.lang.Object getCell(long lrow,
int icol)
throws java.io.IOException
StarTable
getCell in interface StarTablegetCell in class WrapperStarTablelrow - the index of the cell's rowicol - the index of the cell's column
java.io.IOException - if there is an error reading the data
public RowSequence getRowSequence()
throws java.io.IOException
getRowSequence in interface StarTablegetRowSequence in class WrapperStarTablejava.io.IOException - if there is an error providing access
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||