Package uk.ac.starlink.ttools.filter
Class PermutedColumnSupplement
- java.lang.Object
-
- uk.ac.starlink.ttools.filter.PermutedColumnSupplement
-
- All Implemented Interfaces:
ColumnSupplement
public class PermutedColumnSupplement extends java.lang.Object implements ColumnSupplement
ColumnSupplement implementation which contains a selection of the columns in the base table. Each column is a view of one in the base table.An int[] array, colMap, is used to keep track of which columns in this table correspond to which columns in the base table; the i'th column in this table corresponds to the colMap[i]'th column in the base table. The colMap array may contain duplicate entries, but all its entries must be in the range 0..baseSup.getColumnCount()-1. This table will have colMap.length columns.
- Since:
- 2 Apr 2012
- Author:
- Mark Taylor
-
-
Constructor Summary
Constructors Constructor Description PermutedColumnSupplement(uk.ac.starlink.table.StarTable baseTable, int[] colMap)
Constructs a permuted column supplement based on a given table.PermutedColumnSupplement(ColumnSupplement baseSup, int[] colMap)
Constructs a permuted column supplement based on a given column supplement.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SupplementSequence
createSequence(uk.ac.starlink.table.RowSequence rseq)
Returns a new iterator over the values in the columns defined by this object.java.lang.Object
getCell(long irow, int icol)
Random access read of a cell defined by this object.int
getColumnCount()
Returns the number of columns defined by this object.uk.ac.starlink.table.ColumnInfo
getColumnInfo(int icol)
Returns the column metadata object for a given column.java.lang.Object[]
getRow(long irow)
Random access read of a row defined by this object.
-
-
-
Constructor Detail
-
PermutedColumnSupplement
public PermutedColumnSupplement(ColumnSupplement baseSup, int[] colMap)
Constructs a permuted column supplement based on a given column supplement.- Parameters:
baseSup
- column supplement supplying the base datacolMap
- array of column indices, one for each column in this object
-
PermutedColumnSupplement
public PermutedColumnSupplement(uk.ac.starlink.table.StarTable baseTable, int[] colMap)
Constructs a permuted column supplement based on a given table.- Parameters:
baseTable
- table supplying the base datacolMap
- array of column indices, one for each column in this object
-
-
Method Detail
-
getColumnCount
public int getColumnCount()
Description copied from interface:ColumnSupplement
Returns the number of columns defined by this object.- Specified by:
getColumnCount
in interfaceColumnSupplement
- Returns:
- number of columns
-
getColumnInfo
public uk.ac.starlink.table.ColumnInfo getColumnInfo(int icol)
Description copied from interface:ColumnSupplement
Returns the column metadata object for a given column.- Specified by:
getColumnInfo
in interfaceColumnSupplement
- Parameters:
icol
- column index within this object- Returns:
- column metadata for the icol'th column defined by this object
-
getCell
public java.lang.Object getCell(long irow, int icol) throws java.io.IOException
Description copied from interface:ColumnSupplement
Random access read of a cell defined by this object.- Specified by:
getCell
in interfaceColumnSupplement
- Parameters:
irow
- row indexicol
- column index- Returns:
- cell content
- Throws:
java.io.IOException
-
getRow
public java.lang.Object[] getRow(long irow) throws java.io.IOException
Description copied from interface:ColumnSupplement
Random access read of a row defined by this object.- Specified by:
getRow
in interfaceColumnSupplement
- Parameters:
irow
- row index- Returns:
- array of cell contents for all the cells in this row
- Throws:
java.io.IOException
-
createSequence
public SupplementSequence createSequence(uk.ac.starlink.table.RowSequence rseq) throws java.io.IOException
Description copied from interface:ColumnSupplement
Returns a new iterator over the values in the columns defined by this object. The supplied row sequence must be from an appropriate host table; if not, behaviour is undefined.- Specified by:
createSequence
in interfaceColumnSupplement
- Parameters:
rseq
- row sequence providing data from the host table- Returns:
- iterator over row data from supplementary columns
- Throws:
java.io.IOException
-
-