public class WrapperStarTable extends 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.
|
Object |
getCell(long irow,
int icol)
Returns the contents of a given table cell.
|
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.
|
String |
getName()
Returns the name of this table, if it has one.
|
DescribedValue |
getParameterByName(String parname)
Returns a parameter (table-wide metadata item) of this table located
by its name.
|
List<DescribedValue> |
getParameters()
Returns a list of table parameters, that is metadata items
which pertain to the entire table.
|
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.
|
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(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(URL url)
Sets the URL of this table.
|
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()
StarTable
getColumnCount
in interface StarTable
public long getRowCount()
StarTable
getRowCount
in interface StarTable
public URL getURL()
null
to indicate that this table
itself is not persistent.public void setURL(URL url)
StarTable
url
.
If called, the supplied url
should provide the return
value for subsequent calls of StarTable.getURL()
.public String getName()
StarTable
public void setName(String name)
StarTable
name
should provide the return value for subsequent calls of
StarTable.getName()
.public List<DescribedValue> getParameters()
StarTable
getParameters
in interface StarTable
List
of DescribedValue
objects
constituting table-wide metadata not covered elsewhere
in this interfacepublic DescribedValue getParameterByName(String parname)
StarTable
null
will be returned.getParameterByName
in interface StarTable
parname
- the name of the table parameter requiredpublic void setParameter(DescribedValue dval)
StarTable
setParameter
in interface StarTable
dval
- the new parameter datum to addpublic ColumnInfo getColumnInfo(int icol)
StarTable
getColumnInfo
in interface StarTable
icol
- the column for which header information is requiredicol
public List<ValueInfo> getColumnAuxDataInfos()
StarTable
getColumnInfo(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 StarTable
DefaultValueInfo.getAuxData()
public RowSequence getRowSequence() throws IOException
StarTable
getRowSequence
in interface StarTable
IOException
- if there is an error providing accesspublic RowAccess getRowAccess() throws IOException
StarTable
getRowAccess
in interface StarTable
IOException
- if there is an error setting up accesspublic RowSplittable getRowSplittable() throws IOException
StarTable
The 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 StarTable
IOException
RowRunner
public boolean isRandom()
StarTable
true
may the StarTable.getRowAccess()
,
StarTable.getRow(long)
and StarTable.getCell(long, int)
methods be used.public Object getCell(long irow, int icol) throws IOException
StarTable
getColumnInfo(icol).getContentClass()
.
This method is safe for concurrent use from multiple threads,
but in general it is recommended to use a
RowAccess
instead.
getCell
in interface StarTable
irow
- the index of the cell's rowicol
- the index of the cell's columnIOException
- if there is an error reading the datapublic Object[] getRow(long irow) throws IOException
StarTable
getCell(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.
getRow
in interface StarTable
irow
- the index of the row to retrieveirow
IOException
- if there is an error reading the datapublic void close() throws IOException
StarTable
Following a call to this method, any attempt to use this table or objects such as RowSequences obtained from it will result in undefined behaviour.
close
in interface Closeable
close
in interface AutoCloseable
close
in interface StarTable
IOException
public static int checkedLongToInt(long lval)
Copyright © 2025 Central Laboratory of the Research Councils. All Rights Reserved.