public class WrapperStarTable extends java.lang.Object implements StarTable
getURL() method which returns
null as an indication that the actual table is not a persistent
one (though it may be based on, and even identical to, a persistent one).
This class is provided so that it can be extended by subclasses which modify the view of the base table in useful ways.
Subclasses should take care to ensure that all the data access methods
are overridden in a consistent way: getCell(long, int), getRow(long),
getRowSequence(), getRowAccess() and getRowSplittable().
WrapperRowSequence| Constructor and Description |
|---|
WrapperStarTable(StarTable baseTable)
Constructs a new
WrapperStarTable from a given base table. |
| Modifier and Type | Method and Description |
|---|---|
static int |
checkedLongToInt(long lval)
Convenience method to get an
int
value from a long. |
void |
close()
Relinquishes any resources associated with this table.
|
StarTable |
getBaseTable()
Returns the base table underlying this wrapper table.
|
java.lang.Object |
getCell(long irow,
int icol)
Returns the contents of a given table cell.
|
java.util.List<ValueInfo> |
getColumnAuxDataInfos()
Returns an ordered list of ValueInfo objects representing
the auxiliary metadata returned by
getColumnInfo(int).getAuxData() calls. |
int |
getColumnCount()
Returns the number of columns in this table.
|
ColumnInfo |
getColumnInfo(int icol)
Returns the object describing the data in a given column.
|
java.lang.String |
getName()
Returns the name of this table, if it has one.
|
DescribedValue |
getParameterByName(java.lang.String parname)
Returns a parameter (table-wide metadata item) of this table located
by its name.
|
java.util.List<DescribedValue> |
getParameters()
Returns a list of table parameters, that is metadata items
which pertain to the entire table.
|
java.lang.Object[] |
getRow(long irow)
Returns the contents of a given table row.
|
RowAccess |
getRowAccess()
Returns an object which can provide random access to this
table's data, if random access is implemented.
|
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.
|
RowSplittable |
getRowSplittable()
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.
|
java.net.URL |
getURL()
Initially returns
null to indicate that this table
itself is not persistent. |
boolean |
isRandom()
Indicates whether random access is provided by this table.
|
void |
setName(java.lang.String name)
Sets the name of this table.
|
void |
setParameter(DescribedValue dval)
Adds the given DescribedValue to the list of parameter metadata objects
associated with this table.
|
void |
setURL(java.net.URL url)
Sets the URL of this table.
|
java.lang.String |
toString()
Returns an indication of the wrapper structure of this table.
|
protected StarTable baseTable
public WrapperStarTable(StarTable baseTable)
WrapperStarTable from a given base table.baseTable - the table to which methods invoked upon the
new wrapper table will be forwardedpublic StarTable getBaseTable()
public int getColumnCount()
StarTablegetColumnCount in interface StarTablepublic long getRowCount()
StarTablegetRowCount in interface StarTablepublic java.net.URL getURL()
null to indicate that this table
itself is not persistent.public void setURL(java.net.URL url)
StarTableurl.
If called, the supplied url should provide the return
value for subsequent calls of StarTable.getURL().public java.lang.String getName()
StarTablepublic void setName(java.lang.String name)
StarTablename
should provide the return value for subsequent calls of
StarTable.getName().public java.util.List<DescribedValue> getParameters()
StarTablegetParameters in interface StarTableList of DescribedValue objects
constituting table-wide metadata not covered elsewhere
in this interfacepublic DescribedValue getParameterByName(java.lang.String parname)
StarTablenull will be returned.getParameterByName in interface StarTableparname - the name of the table parameter requiredpublic void setParameter(DescribedValue dval)
StarTablesetParameter in interface StarTabledval - the new parameter datum to addpublic ColumnInfo getColumnInfo(int icol)
StarTablegetColumnInfo in interface StarTableicol - the column for which header information is requiredicolpublic java.util.List<ValueInfo> getColumnAuxDataInfos()
StarTablegetColumnInfo(int).getAuxData() calls.
The idea is that the resulting list can be used to find out
the kind of per-column metadata which can be expected to be found
in some or all columns of this table. Each item in the returned
list should have a unique name, and other characteristics which are
applicable to auxData items which may be returned from any of
the columns in this table.
The order of the list may indicate some sort of natural ordering of these keys. The returned list is not guaranteed to be complete; it is legal to return an empty list if nothing is known about auxiliary metadata. The list ought not to contain duplicate elements.
getColumnAuxDataInfos in interface StarTableDefaultValueInfo.getAuxData()public RowSequence getRowSequence() throws java.io.IOException
StarTablegetRowSequence in interface StarTablejava.io.IOException - if there is an error providing accesspublic RowAccess getRowAccess() throws java.io.IOException
StarTablegetRowAccess in interface StarTablejava.io.IOException - if there is an error setting up accesspublic RowSplittable getRowSplittable() throws java.io.IOException
StarTableThe 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 return
Tables.getDefaultRowSplittable(this).
getRowSplittable in interface StarTablejava.io.IOExceptionRowRunnerpublic boolean isRandom()
StarTabletrue may the StarTable.getRowAccess(),
StarTable.getRow(long) and StarTable.getCell(long, int) methods be used.public java.lang.Object getCell(long irow,
int icol)
throws java.io.IOException
StarTablegetColumnInfo(icol).getContentClass().
This method is safe for concurrent use from multiple threads,
but in general it is recommended to use a
RowAccess instead.
public java.lang.Object[] getRow(long irow)
throws java.io.IOException
StarTablegetCell(irow,icol) for all the columns icol
in sequence.
This method is safe for concurrent use from multiple threads,
but in general it is recommended to use a
RowAccess instead.
public void close()
throws java.io.IOException
StarTableFollowing a call to this method, any attempt to use this table or objects such as RowSequences obtained from it will result in undefined behaviour.
public static int checkedLongToInt(long lval)
public java.lang.String toString()
toString in class java.lang.Object