Package uk.ac.starlink.votable

## Class VOStarTable

- java.lang.Object
- - uk.ac.starlink.table.AbstractStarTable
  - - uk.ac.starlink.votable.VOStarTable

All Implemented Interfaces:
  `java.io.Closeable`, `java.lang.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

Fields
`static uk.ac.starlink.table.ValueInfo` `COOSYS_EPOCH_INFO` ValueInfo for COOSYS `epoch` attribute.
`static uk.ac.starlink.table.ValueInfo` `COOSYS_EQUINOX_INFO` ValueInfo for COOSYS `equinox` attribute.
`static uk.ac.starlink.table.ValueInfo` `COOSYS_SYSTEM_INFO` ValueInfo for COOSYS `system` attribute.
`static uk.ac.starlink.table.ValueInfo` `DATATYPE_INFO` ValueInfo for VOTable `datatype` attribute.
`static uk.ac.starlink.table.ValueInfo` `ID_INFO` ValueInfo for VOTable `ID` attribute.
`static uk.ac.starlink.table.ValueInfo` `PRECISION_INFO` ValueInfo for VOTable `precision` attribute.
`static uk.ac.starlink.table.ValueInfo` `REF_INFO` ValueInfo for VOTable `ref` attribute.
`static uk.ac.starlink.table.ValueInfo` `TIMESYS_REFPOSITION_INFO` ValueInfo for TIMESYS `refposition` attribute.
`static uk.ac.starlink.table.ValueInfo` `TIMESYS_TIMEORIGIN_INFO` ValueInfo for TIMESYS `timeorigin` attribute.
`static uk.ac.starlink.table.ValueInfo` `TIMESYS_TIMESCALE_INFO` ValueInfo for TIMESYS `timescale` attribute.
`static uk.ac.starlink.table.ValueInfo` `TYPE_INFO` ValueInfo for VOTable `type` attribute.
`static uk.ac.starlink.table.ValueInfo` `UCD_INFO` ValueInfo for VOTable `ucd` attribute.
`static uk.ac.starlink.table.ValueInfo` `UTYPE_INFO` ValueInfo for VOTable `utype` attribute.
`static uk.ac.starlink.table.ValueInfo` `WIDTH_INFO` ValueInfo for VOTable `width` attribute.

### Constructor Summary

Constructors
`VOStarTable​(TableElement votable)` Construct a VOStarTable from a TABLE element.

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`void` `close()`
`java.lang.Object` `getCell​(long lrow, int icol)`
`java.util.List<uk.ac.starlink.table.ValueInfo>` `getColumnAuxDataInfos()`
`int` `getColumnCount()`
`uk.ac.starlink.table.ColumnInfo` `getColumnInfo​(int icol)`
`java.util.List<uk.ac.starlink.table.DescribedValue>` `getParameters()`
`static int` `getRefColumnIndex​(java.lang.String colRef, uk.ac.starlink.table.StarTable table)` Identifies the column that was labelled with a given ID attribute.
`java.lang.Object[]` `getRow​(long lrow)`
`uk.ac.starlink.table.RowAccess` `getRowAccess()`
`long` `getRowCount()`
`uk.ac.starlink.table.RowSequence` `getRowSequence()`
`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 Detail

#### ID_INFO

    public static final uk.ac.starlink.table.ValueInfo ID_INFO

ValueInfo for VOTable `ID` attribute.

#### UCD_INFO

    public static final uk.ac.starlink.table.ValueInfo UCD_INFO

ValueInfo for VOTable `ucd` attribute.

#### UTYPE_INFO

    public static final uk.ac.starlink.table.ValueInfo UTYPE_INFO

ValueInfo for VOTable `utype` attribute.

#### WIDTH_INFO

    public static final uk.ac.starlink.table.ValueInfo WIDTH_INFO

ValueInfo for VOTable `width` attribute.

#### PRECISION_INFO

    public static final uk.ac.starlink.table.ValueInfo PRECISION_INFO

ValueInfo for VOTable `precision` attribute.

#### REF_INFO

    public static final uk.ac.starlink.table.ValueInfo REF_INFO

ValueInfo for VOTable `ref` attribute.

#### TYPE_INFO

    public static final uk.ac.starlink.table.ValueInfo TYPE_INFO

ValueInfo for VOTable `type` attribute.

#### DATATYPE_INFO

    public static final uk.ac.starlink.table.ValueInfo DATATYPE_INFO

ValueInfo for VOTable `datatype` attribute.

#### COOSYS_SYSTEM_INFO

    public static final uk.ac.starlink.table.ValueInfo COOSYS_SYSTEM_INFO

ValueInfo for COOSYS `system` attribute.

#### COOSYS_EPOCH_INFO

    public static final uk.ac.starlink.table.ValueInfo COOSYS_EPOCH_INFO

ValueInfo for COOSYS `epoch` attribute.

#### COOSYS_EQUINOX_INFO

    public static final uk.ac.starlink.table.ValueInfo COOSYS_EQUINOX_INFO

ValueInfo for COOSYS `equinox` attribute.

#### TIMESYS_TIMEORIGIN_INFO

    public static final uk.ac.starlink.table.ValueInfo TIMESYS_TIMEORIGIN_INFO

ValueInfo for TIMESYS `timeorigin` attribute.

#### TIMESYS_TIMESCALE_INFO

    public static final uk.ac.starlink.table.ValueInfo TIMESYS_TIMESCALE_INFO

ValueInfo for TIMESYS `timescale` attribute.

#### TIMESYS_REFPOSITION_INFO

    public static final uk.ac.starlink.table.ValueInfo TIMESYS_REFPOSITION_INFO

ValueInfo for TIMESYS `refposition` attribute.

### Constructor Detail

#### VOStarTable

    public VOStarTable​(TableElement votable)
                throws java.io.IOException

Construct a VOStarTable from a TABLE element. The data itself is inferred or constructed from the state and content of the element.

Parameters:
  `votable` - Table VOElement
Throws:
  `java.io.IOException`

### Method Detail

#### getColumnCount

    public int getColumnCount()

Specified by:
  `getColumnCount` in interface `uk.ac.starlink.table.StarTable`
Specified by:
  `getColumnCount` in class `uk.ac.starlink.table.AbstractStarTable`

#### getRowCount

    public long getRowCount()

Specified by:
  `getRowCount` in interface `uk.ac.starlink.table.StarTable`
Specified by:
  `getRowCount` in class `uk.ac.starlink.table.AbstractStarTable`

#### isRandom

    public boolean isRandom()

Specified by:
  `isRandom` in interface `uk.ac.starlink.table.StarTable`
Overrides:
  `isRandom` in class `uk.ac.starlink.table.AbstractStarTable`

#### getColumnInfo

    public uk.ac.starlink.table.ColumnInfo getColumnInfo​(int icol)

Specified by:
  `getColumnInfo` in interface `uk.ac.starlink.table.StarTable`
Specified by:
  `getColumnInfo` in class `uk.ac.starlink.table.AbstractStarTable`

#### getParameters

    public java.util.List<uk.ac.starlink.table.DescribedValue> getParameters()

Specified by:
  `getParameters` in interface `uk.ac.starlink.table.StarTable`
Overrides:
  `getParameters` in class `uk.ac.starlink.table.AbstractStarTable`

#### getColumnAuxDataInfos

    public java.util.List<uk.ac.starlink.table.ValueInfo> getColumnAuxDataInfos()

Specified by:
  `getColumnAuxDataInfos` in interface `uk.ac.starlink.table.StarTable`
Overrides:
  `getColumnAuxDataInfos` in class `uk.ac.starlink.table.AbstractStarTable`

#### getRowSequence

    public uk.ac.starlink.table.RowSequence getRowSequence()
                                                    throws java.io.IOException

Specified by:
  `getRowSequence` in interface `uk.ac.starlink.table.StarTable`
Specified by:
  `getRowSequence` in class `uk.ac.starlink.table.AbstractStarTable`
Throws:
  `java.io.IOException`

#### getRowAccess

    public uk.ac.starlink.table.RowAccess getRowAccess()
                                                throws java.io.IOException

Specified by:
  `getRowAccess` in interface `uk.ac.starlink.table.StarTable`
Overrides:
  `getRowAccess` in class `uk.ac.starlink.table.AbstractStarTable`
Throws:
  `java.io.IOException`

#### getRow

    public java.lang.Object[] getRow​(long lrow)
                              throws java.io.IOException

Specified by:
  `getRow` in interface `uk.ac.starlink.table.StarTable`
Overrides:
  `getRow` in class `uk.ac.starlink.table.AbstractStarTable`
Throws:
  `java.io.IOException`

#### getCell

    public java.lang.Object getCell​(long lrow,
                                    int icol)
                             throws java.io.IOException

Specified by:
  `getCell` in interface `uk.ac.starlink.table.StarTable`
Overrides:
  `getCell` in class `uk.ac.starlink.table.AbstractStarTable`
Throws:
  `java.io.IOException`

#### close

    public void close()
               throws java.io.IOException

Specified by:
  `close` in interface `java.lang.AutoCloseable`
Specified by:
  `close` in interface `java.io.Closeable`
Specified by:
  `close` in interface `uk.ac.starlink.table.StarTable`
Overrides:
  `close` in class `uk.ac.starlink.table.AbstractStarTable`
Throws:
  `java.io.IOException`

#### getValueInfo

    public 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. 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

    public static int getRefColumnIndex​(java.lang.String colRef,
                                        uk.ac.starlink.table.StarTable table)

Identifies the column that was labelled with a given ID attribute.

Parameters:
  `colRef` - ID string
  `table` - 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 of `colRef`, or -1 if none exists