Interface StarTable
-
- All Known Implementing Classes:
AbstractStarTable
,AsciiStarTable
,BeanStarTable
,CalcStarTable
,ColumnPermutedStarTable
,ColumnRandomWrapperStarTable
,ColumnStarTable
,ConcatStarTable
,ConstantStarTable
,CsvStarTable
,EmptyStarTable
,ExplodedStarTable
,JDBCStarTable
,JoinStarTable
,MetaCopyStarTable
,MetadataStarTable
,ProgressBarStarTable
,ProgressLineStarTable
,RandomResultSetStarTable
,RandomStarTable
,RandomWrapperStarTable
,RowListStarTable
,RowPermutedStarTable
,RowRandomWrapperStarTable
,RowSubsetStarTable
,SelectorStarTable
,SequentialResultSetStarTable
,StreamStarTable
,WrapperStarTable
public interface StarTable
Defines basic table functionality. A table has a fixed number of columns, and a sequence of rows, each of which has one entry for each column. The entry in each column is of the same type (or at least a subtype of a given type) for each row; this type can be determined using theColumnInfo
objects returned bygetColumnInfo(int)
. The first row and the first column are numbered 0.All StarTables allow sequential access, provided by calling
getRowSequence()
. This may in general be called multiple times so that more than one iteration can be made through the rows of the table from start to finish. Additionally, if theisRandom()
method returns true then the random access methodsgetRow(long)
andgetCell(long, int)
may be used to access table contents directly.For random tables, the getRow and getCell methods should be thread-safe. Separate RowSequence objects obtained from the same table should be safely usable from different threads, but a given RowSequence in general will not.
- Author:
- Mark Taylor (Starlink)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.Object
getCell(long irow, int icol)
Returns the contents of a given table cell.java.util.List
getColumnAuxDataInfos()
Returns an ordered list ofValueInfo
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
getParameters()
Returns a list of table parameters, that is items which pertain to the entire table.java.lang.Object[]
getRow(long irow)
Returns the contents of a given table row.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.java.net.URL
getURL()
Returns the URL of this table, if it has one.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.
-
-
-
Method Detail
-
getColumnCount
int getColumnCount()
Returns the number of columns in this table.- Returns:
- the number of columns
-
getRowCount
long getRowCount()
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.- Returns:
- the number of rows, or -1
-
getURL
java.net.URL getURL()
Returns the URL of this table, if it has one. A non-null return from this method indicates that this table is in some sense persistent.- Returns:
- the URL of this table, or null if none is known
-
setURL
void setURL(java.net.URL url)
Sets the URL of this table. It ought to be possible in principle to reconstruct this table by reading the resource at url. If called, the supplied url should provide the return value for subsequent calls ofgetURL()
.- Parameters:
url
- table URL
-
getName
java.lang.String getName()
Returns the name of this table, if it has one. The meaning of the name is not defined, but it will typically be a short string of text indicating the identity of this table.- Returns:
- a name for this table, or null if no suitable one exists
-
setName
void setName(java.lang.String name)
Sets the name of this table. If called, the supplied name should provide the return value for subsequent calls ofgetName()
.- Parameters:
name
- table name
-
getParameters
java.util.List getParameters()
Returns a list of table parameters, that is items which pertain to the entire table. Each element of this list must be aDescribedValue
object.- Returns:
- a List of DescribedValue objects constituting table-wide metadata not covered elsewhere in this interface
-
getParameterByName
DescribedValue getParameterByName(java.lang.String parname)
Returns a parameter (table-wide metadata item) of this table located by its name. If more than one parameter with the given name exists, an arbitrary one will be returned. If no parameter with the given name exists, null will be returned.- Parameters:
parname
- the name of the table parameter required
-
setParameter
void setParameter(DescribedValue dval)
Adds the given DescribedValue to the list of parameter metadata objects associated with this table. If an item in the parameter list with the same name as the supplied value already exists, it is removed from the list.- Parameters:
dval
- the new parameter datum to add
-
getColumnInfo
ColumnInfo getColumnInfo(int icol)
Returns the object describing the data in a given column.- Parameters:
icol
- the column for which header information is required- Returns:
- a ValueInfo object for column icol
-
getColumnAuxDataInfos
java.util.List getColumnAuxDataInfos()
Returns an ordered list ofValueInfo
objects representing the auxiliary metadata returned by 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.
- Returns:
- an unmodifiable ordered set of known metadata keys
- See Also:
ColumnInfo.getAuxData()
-
getRowSequence
RowSequence getRowSequence() throws java.io.IOException
Returns an object which can iterate over all the rows in the table sequentially.- Returns:
- an object providing sequential access to the table data
- Throws:
java.io.IOException
- if there is an error providing access
-
isRandom
boolean isRandom()
Indicates whether random access is provided by this table. Only if the result is true may thegetRow(long)
andgetCell(long, int)
methods be used.- Returns:
- true if table random access methods are available
-
getCell
java.lang.Object getCell(long irow, int icol) throws java.io.IOException
Returns the contents of a given table cell. The class of the returned object should be the same as, or a subclass of, the class returned by getColumnInfo(icol).getContentClass().- Parameters:
irow
- the index of the cell's rowicol
- the index of the cell's column- Returns:
- the contents of this cell
- Throws:
java.io.IOException
- if there is an error reading the datajava.lang.UnsupportedOperationException
- if isRandom returns false
-
getRow
java.lang.Object[] getRow(long irow) throws java.io.IOException
Returns the contents of a given table row. The returned value is equivalent to an array formed of all the objects returned by getCell(irow,icol) for all the columns icol in sequence.- Parameters:
irow
- the index of the row to retrieve- Returns:
- an array of the objects in each cell in row irow
- Throws:
java.io.IOException
- if there is an error reading the datajava.lang.UnsupportedOperationException
- if isRandom returns false
-
-