Package uk.ac.starlink.votable
Class VOStarTable
java.lang.Object
uk.ac.starlink.table.AbstractStarTable
uk.ac.starlink.votable.VOStarTable
- All Implemented Interfaces:
Closeable
,AutoCloseable
,uk.ac.starlink.table.StarTable
public class VOStarTable
extends uk.ac.starlink.table.AbstractStarTable
A
StarTable
implementation based on a VOTable.
Some of the FIELD attributes defined by the VOTable format correspond to standard information in the corresponding ColumnInfo object, and some do not. Those that do are accessed using the relevant ColumnInfo getter/setter methods directly, for instance
String ucd = table.getColumnInfo(0).getUCD();The ones that don't are stored in the ColumnInfo's auxiliary metadata keyed using the various
*_INFO
public static variables defined
in this class. These are accessed using the
ColumnInfo.getAuxDatum(uk.ac.starlink.table.ValueInfo)
method, for instance:
String id = (String) table.getColumnInfo(0) .getAuxDatumValue(VOStarTable.ID_INFO);In the same way, if you set an auxiliary metadata item under one of these keys, like this:
DescribedValue idVal = new DescribedValue(VOStarTable.ID_INFO, "COL0"); table.getColumnInfo(0).setAuxDatum(idVal);then if the result is written to a VOTable the relevant attribute will be attached to the corresponding FIELD element.
- Author:
- Mark Taylor (Starlink)
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final uk.ac.starlink.table.ValueInfo
ValueInfo for COOSYSepoch
attribute.static final uk.ac.starlink.table.ValueInfo
ValueInfo for COOSYSequinox
attribute.static final uk.ac.starlink.table.ValueInfo
ValueInfo for COOSYSrefposition
attribute.static final uk.ac.starlink.table.ValueInfo
ValueInfo for COOSYSsystem
attribute.static final uk.ac.starlink.table.ValueInfo
ValueInfo for VOTabledatatype
attribute.static final uk.ac.starlink.table.ValueInfo
ValueInfo for VOTableID
attribute.static final uk.ac.starlink.table.ValueInfo
ValueInfo for VOTableprecision
attribute.static final uk.ac.starlink.table.ValueInfo
ValueInfo for VOTableref
attribute.static final uk.ac.starlink.table.ValueInfo
ValueInfo for TIMESYSrefposition
attribute.static final uk.ac.starlink.table.ValueInfo
ValueInfo for TIMESYStimeorigin
attribute.static final uk.ac.starlink.table.ValueInfo
ValueInfo for TIMESYStimescale
attribute.static final uk.ac.starlink.table.ValueInfo
ValueInfo for VOTabletype
attribute.static final uk.ac.starlink.table.ValueInfo
ValueInfo for VOTableucd
attribute.static final uk.ac.starlink.table.ValueInfo
ValueInfo for VOTableutype
attribute.static final uk.ac.starlink.table.ValueInfo
ValueInfo for VOTablewidth
attribute. -
Constructor Summary
ConstructorsConstructorDescriptionVOStarTable
(TableElement tableEl) Construct a VOStarTable from a TABLE element. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
static VOStarTable
createDecoratedTable
(uk.ac.starlink.table.StarTable dataTable, TableElement metadataEl) Returns a table in which the data comes from an input StarTable, but the metadata is supplied by a TableElement.getCell
(long lrow, int icol) List
<uk.ac.starlink.table.ValueInfo> int
uk.ac.starlink.table.ColumnInfo
getColumnInfo
(int icol) List
<uk.ac.starlink.table.DescribedValue> static int
getRefColumnIndex
(String colRef, uk.ac.starlink.table.StarTable table) Identifies the column that was labelled with a given ID attribute.Object[]
getRow
(long lrow) uk.ac.starlink.table.RowAccess
long
uk.ac.starlink.table.RowSequence
Returns the TABLE element on which this VOStarTable is built.static uk.ac.starlink.table.ValueInfo
getValueInfo
(FieldElement field) Returns a ValueInfo object suitable for holding the values in a VOTable Field (or Param) object.boolean
isRandom()
Methods inherited from class uk.ac.starlink.table.AbstractStarTable
checkedLongToInt, getName, getRowSplittable, getURL, setName, setParameters, setURL
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface uk.ac.starlink.table.StarTable
getParameterByName, setParameter
-
Field Details
-
ID_INFO
public static final uk.ac.starlink.table.ValueInfo ID_INFOValueInfo for VOTableID
attribute. -
UCD_INFO
public static final uk.ac.starlink.table.ValueInfo UCD_INFOValueInfo for VOTableucd
attribute. -
UTYPE_INFO
public static final uk.ac.starlink.table.ValueInfo UTYPE_INFOValueInfo for VOTableutype
attribute. -
WIDTH_INFO
public static final uk.ac.starlink.table.ValueInfo WIDTH_INFOValueInfo for VOTablewidth
attribute. -
PRECISION_INFO
public static final uk.ac.starlink.table.ValueInfo PRECISION_INFOValueInfo for VOTableprecision
attribute. -
REF_INFO
public static final uk.ac.starlink.table.ValueInfo REF_INFOValueInfo for VOTableref
attribute. -
TYPE_INFO
public static final uk.ac.starlink.table.ValueInfo TYPE_INFOValueInfo for VOTabletype
attribute. -
DATATYPE_INFO
public static final uk.ac.starlink.table.ValueInfo DATATYPE_INFOValueInfo for VOTabledatatype
attribute. -
COOSYS_SYSTEM_INFO
public static final uk.ac.starlink.table.ValueInfo COOSYS_SYSTEM_INFOValueInfo for COOSYSsystem
attribute. -
COOSYS_EPOCH_INFO
public static final uk.ac.starlink.table.ValueInfo COOSYS_EPOCH_INFOValueInfo for COOSYSepoch
attribute. -
COOSYS_REFPOSITION_INFO
public static final uk.ac.starlink.table.ValueInfo COOSYS_REFPOSITION_INFOValueInfo for COOSYSrefposition
attribute. -
COOSYS_EQUINOX_INFO
public static final uk.ac.starlink.table.ValueInfo COOSYS_EQUINOX_INFOValueInfo for COOSYSequinox
attribute. -
TIMESYS_TIMEORIGIN_INFO
public static final uk.ac.starlink.table.ValueInfo TIMESYS_TIMEORIGIN_INFOValueInfo for TIMESYStimeorigin
attribute. -
TIMESYS_TIMESCALE_INFO
public static final uk.ac.starlink.table.ValueInfo TIMESYS_TIMESCALE_INFOValueInfo for TIMESYStimescale
attribute. -
TIMESYS_REFPOSITION_INFO
public static final uk.ac.starlink.table.ValueInfo TIMESYS_REFPOSITION_INFOValueInfo for TIMESYSrefposition
attribute.
-
-
Constructor Details
-
VOStarTable
Construct a VOStarTable from a TABLE element. The data itself is inferred or constructed from the state and content of the element.- Parameters:
tableEl
- Table VOElement- Throws:
IOException
-
-
Method Details
-
getColumnCount
public int getColumnCount()- Specified by:
getColumnCount
in interfaceuk.ac.starlink.table.StarTable
- Specified by:
getColumnCount
in classuk.ac.starlink.table.AbstractStarTable
-
getRowCount
public long getRowCount()- Specified by:
getRowCount
in interfaceuk.ac.starlink.table.StarTable
- Specified by:
getRowCount
in classuk.ac.starlink.table.AbstractStarTable
-
isRandom
public boolean isRandom()- Specified by:
isRandom
in interfaceuk.ac.starlink.table.StarTable
- Overrides:
isRandom
in classuk.ac.starlink.table.AbstractStarTable
-
getColumnInfo
public uk.ac.starlink.table.ColumnInfo getColumnInfo(int icol) - Specified by:
getColumnInfo
in interfaceuk.ac.starlink.table.StarTable
- Specified by:
getColumnInfo
in classuk.ac.starlink.table.AbstractStarTable
-
getParameters
- Specified by:
getParameters
in interfaceuk.ac.starlink.table.StarTable
- Overrides:
getParameters
in classuk.ac.starlink.table.AbstractStarTable
-
getColumnAuxDataInfos
- Specified by:
getColumnAuxDataInfos
in interfaceuk.ac.starlink.table.StarTable
- Overrides:
getColumnAuxDataInfos
in classuk.ac.starlink.table.AbstractStarTable
-
getRowSequence
- Specified by:
getRowSequence
in interfaceuk.ac.starlink.table.StarTable
- Specified by:
getRowSequence
in classuk.ac.starlink.table.AbstractStarTable
- Throws:
IOException
-
getRowAccess
- Specified by:
getRowAccess
in interfaceuk.ac.starlink.table.StarTable
- Overrides:
getRowAccess
in classuk.ac.starlink.table.AbstractStarTable
- Throws:
IOException
-
getRow
- Specified by:
getRow
in interfaceuk.ac.starlink.table.StarTable
- Overrides:
getRow
in classuk.ac.starlink.table.AbstractStarTable
- Throws:
IOException
-
getCell
- Specified by:
getCell
in interfaceuk.ac.starlink.table.StarTable
- Overrides:
getCell
in classuk.ac.starlink.table.AbstractStarTable
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceuk.ac.starlink.table.StarTable
- Overrides:
close
in classuk.ac.starlink.table.AbstractStarTable
- Throws:
IOException
-
getTableElement
Returns the TABLE element on which this VOStarTable is built.- Returns:
- TABLE element
-
getValueInfo
Returns a ValueInfo object suitable for holding the values in a VOTable Field (or Param) object. The datatype, array shape and other metadata in the returned object are taken from the relevant bits of the supplied field.- Parameters:
field
- the FieldElement object for which the ValueInfo is to be constructed- Returns:
- a ValueInfo suitable for
field
-
getRefColumnIndex
Identifies the column that was labelled with a given ID attribute.- Parameters:
colRef
- ID stringtable
- table to interrogate; this will presumably be based on a VOStarTable, but it may be some kind of wrapped form of one- Returns:
- index of the column in
table
whose FIELD element had an ID attribute ofcolRef
, or -1 if none exists
-
createDecoratedTable
public static VOStarTable createDecoratedTable(uk.ac.starlink.table.StarTable dataTable, TableElement metadataEl) throws IOException Returns a table in which the data comes from an input StarTable, but the metadata is supplied by a TableElement. It is the responsibility of the calling code to ensure that the supplied metadata is consistent with the supplied data.- Parameters:
dataTable
- StarTable supplying datametadataEl
- TABLE element supplying metadata- Returns:
- table, not guaranteed to be consistent
- Throws:
IOException
-