uk.ac.starlink.ttools.filter
Class AddColumnsTable
java.lang.Object
uk.ac.starlink.table.WrapperStarTable
uk.ac.starlink.ttools.filter.AddColumnsTable
- All Implemented Interfaces:
- uk.ac.starlink.table.StarTable
public abstract class AddColumnsTable
- extends uk.ac.starlink.table.WrapperStarTable
Modifies a table by adding a set of columns to it which are calculated
as a function of existing columns. Concrete subclasses must provide
an implementation of the calculateValues(java.lang.Object[])
method.
Some attempt is made to arrange things so that if the output
columns are read for the same row, the calculateValues
method is called only once, for the sake of efficiency.
- Since:
- 30 Aug 2005
- Author:
- Mark Taylor
Fields inherited from class uk.ac.starlink.table.WrapperStarTable |
baseTable |
Constructor Summary |
AddColumnsTable(uk.ac.starlink.table.StarTable baseTable,
int[] inColIndices,
uk.ac.starlink.table.ColumnInfo[] outColInfos,
int ipos)
Constructor. |
Methods inherited from class uk.ac.starlink.table.WrapperStarTable |
checkedLongToInt, getBaseTable, getColumnAuxDataInfos, getName, getParameterByName, getParameters, getRowCount, getURL, isRandom, setName, setParameter, setURL, toString |
AddColumnsTable
public AddColumnsTable(uk.ac.starlink.table.StarTable baseTable,
int[] inColIndices,
uk.ac.starlink.table.ColumnInfo[] outColInfos,
int ipos)
- Constructor.
- Parameters:
baseTable
- base tableinColIndices
- array of indices of the columns in the base
table which are used to calculate the new columns in the
resulting tableoutColInfos
- array of column info headers for each of the
new columns which are added in the resulting tableipos
- position which the first of the new columns is
to occupy in the resulting table (other new columns
follow immediately)
calculateValues
protected abstract Object[] calculateValues(Object[] inValues)
- Calcuates the values for the new columns added to this table
based on the values from the relevant columns from the base table.
- Parameters:
inValues
- array of values from the base table,
one from each of the columns indicated by the
inColIndices
array
- Returns:
- array of values to be included in this table,
one for each of the columns indicated by the
outColInfos
array
getColumnCount
public int getColumnCount()
- Specified by:
getColumnCount
in interface uk.ac.starlink.table.StarTable
- Overrides:
getColumnCount
in class uk.ac.starlink.table.WrapperStarTable
getColumnInfo
public uk.ac.starlink.table.ColumnInfo getColumnInfo(int icol)
- Specified by:
getColumnInfo
in interface uk.ac.starlink.table.StarTable
- Overrides:
getColumnInfo
in class uk.ac.starlink.table.WrapperStarTable
getCell
public Object getCell(long irow,
int icol)
throws IOException
- Specified by:
getCell
in interface uk.ac.starlink.table.StarTable
- Overrides:
getCell
in class uk.ac.starlink.table.WrapperStarTable
- Throws:
IOException
getRow
public Object[] getRow(long irow)
throws IOException
- Specified by:
getRow
in interface uk.ac.starlink.table.StarTable
- Overrides:
getRow
in class uk.ac.starlink.table.WrapperStarTable
- Throws:
IOException
getRowSequence
public uk.ac.starlink.table.RowSequence getRowSequence()
throws IOException
- Specified by:
getRowSequence
in interface uk.ac.starlink.table.StarTable
- Overrides:
getRowSequence
in class uk.ac.starlink.table.WrapperStarTable
- Throws:
IOException
Copyright © 2009 Central Laboratory of the Research Councils. All Rights Reserved.