uk.ac.starlink.table.formats
Class TextStarTable

java.lang.Object
  |
  +--uk.ac.starlink.table.AbstractStarTable
        |
        +--uk.ac.starlink.table.RandomStarTable
              |
              +--uk.ac.starlink.table.formats.TextStarTable
All Implemented Interfaces:
StarTable

public class TextStarTable
extends RandomStarTable

Simple ASCII-format table. This reader attempts to make sensible decisions about what is a table and what is not, but inevitably it will not be able to read ASCII tables in any format.

Here are the rules:

This reader reads the whole table into memory before trying to make sense of it, since otherwise it would have to do two passes, one to work out the type of each column and one to read the data. This is not suitable for a very large table, but you're not really expected to have very large tables in plain text format. For similar reasons, it is not coded to provide maximum efficiency for very large tables.


Constructor Summary
TextStarTable(DataSource datsrc)
          Constructs a new TextStarTable from a datasource.
 
Method Summary
 Object getCell(long irow, int icol)
          The AbstractStarTable implementation of this method throws an UnsupportedOperationException, since unless otherwise provided there is no random access.
 int getColumnCount()
          Returns the number of columns in this table.
 ColumnInfo getColumnInfo(int icol)
          Returns the object describing the data in a given column.
 List getParameters()
          Returns a list of table parameters, that is items which pertain to the entire table.
 Object[] getRow(long irow)
          The AbstractStarTable implementation of this method constructs a row by repeated invocation of getCell(long, int).
 long getRowCount()
          The number of rows in this table.
 
Methods inherited from class uk.ac.starlink.table.RandomStarTable
getRowSequence, isRandom
 
Methods inherited from class uk.ac.starlink.table.AbstractStarTable
checkedLongToInt, getColumnAuxDataInfos, getName, getParameterByName, getURL, setName, setParameters, setURL
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextStarTable

public TextStarTable(DataSource datsrc)
              throws IOException
Constructs a new TextStarTable from a datasource.

Method Detail

getColumnCount

public int getColumnCount()
Description copied from interface: StarTable
Returns the number of columns in this table.

Specified by:
getColumnCount in interface StarTable
Specified by:
getColumnCount in class AbstractStarTable
Returns:
the number of columns

getRowCount

public long getRowCount()
Description copied from class: RandomStarTable
The number of rows in this table. Implementations must supply a non-negative return value.

Specified by:
getRowCount in interface StarTable
Specified by:
getRowCount in class RandomStarTable
Returns:
the number of rows in the table

getCell

public Object getCell(long irow,
                      int icol)
Description copied from class: AbstractStarTable
The AbstractStarTable implementation of this method throws an UnsupportedOperationException, since unless otherwise provided there is no random access.

Specified by:
getCell in interface StarTable
Overrides:
getCell in class AbstractStarTable
Parameters:
irow - the index of the cell's row
icol - the index of the cell's column
Returns:
the contents of this cell

getRow

public Object[] getRow(long irow)
Description copied from class: AbstractStarTable
The AbstractStarTable implementation of this method constructs a row by repeated invocation of AbstractStarTable.getCell(long, int).

Specified by:
getRow in interface StarTable
Overrides:
getRow in class AbstractStarTable
Parameters:
irow - the index of the row to retrieve
Returns:
an array of the objects in each cell in row irow

getColumnInfo

public ColumnInfo getColumnInfo(int icol)
Description copied from interface: StarTable
Returns the object describing the data in a given column.

Specified by:
getColumnInfo in interface StarTable
Specified by:
getColumnInfo in class AbstractStarTable
Parameters:
icol - the column for which header information is required
Returns:
a ValueInfo object for column icol

getParameters

public List getParameters()
Description copied from interface: StarTable
Returns a list of table parameters, that is items which pertain to the entire table. Each element of this list must be a DescribedValue object.

Specified by:
getParameters in interface StarTable
Overrides:
getParameters in class AbstractStarTable
Returns:
a List of DescribedValue objects constituting table-wide metadata not covered elsewhere in this interface

Copyright © 2004 CLRC: Central Laboratory of the Research Councils. All rights reserved.