org.knime.base.data.replace
Class ReplacedColumnsTable

java.lang.Object
  extended by org.knime.base.data.replace.ReplacedColumnsTable
All Implemented Interfaces:
Iterable<DataRow>, DataTable

public class ReplacedColumnsTable
extends Object
implements DataTable

Tables that replaces the values in a given column by other values.

Author:
Bernd Wiswedel, University of Konstanz

Constructor Summary
ReplacedColumnsTable(DataTable table, DataColumnSpec[] specs, int[] columns, ReplacedCellsFactory cellFac)
          Creates a new replaced column table with several replaced columns.
ReplacedColumnsTable(DataTable table, DataColumnSpec spec, int column, ReplacedCellFactory cellFac)
          Creates a new replaced column table with one replaced column.
 
Method Summary
static DataTableSpec createTableSpec(DataTableSpec spec, DataColumnSpec[] cspecs, int[] columns)
          Creates a new table spec with several replaced columns.
static DataTableSpec createTableSpec(DataTableSpec spec, DataColumnSpec cspec, int column)
          Creates a new table spec with one replaced column.
 DataTableSpec getDataTableSpec()
          Returns the DataTableSpec object of this table which gives information about the structure of this data table.
 RowIterator iterator()
          Returns a row iterator which returns each row one-by-one from the table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReplacedColumnsTable

public ReplacedColumnsTable(DataTable table,
                            DataColumnSpec spec,
                            int column,
                            ReplacedCellFactory cellFac)
Creates a new replaced column table with one replaced column.

Parameters:
table - the table to replace one column in
spec - the column spec for the replaced column
column - the column index to replace
cellFac - the factory to get the replacement cells
Throws:
NullPointerException - if the factory is null
IndexOutOfBoundsException - if the column argument is invalid

ReplacedColumnsTable

public ReplacedColumnsTable(DataTable table,
                            DataColumnSpec[] specs,
                            int[] columns,
                            ReplacedCellsFactory cellFac)
Creates a new replaced column table with several replaced columns.

Parameters:
table - the table to replace one or more columns in
specs - the column specs for the replaced columns
columns - the column indices to replace
cellFac - the factory to get the replacement cells
Throws:
NullPointerException - if the factory is null, or the arrays contain null elements
IndexOutOfBoundsException - if the array arguments are invalid
Method Detail

createTableSpec

public static final DataTableSpec createTableSpec(DataTableSpec spec,
                                                  DataColumnSpec cspec,
                                                  int column)
Creates a new table spec with one replaced column.

Parameters:
spec - the table to replace one column in
cspec - the new column spec
column - at position
Returns:
a new data table spec with the replaced column spec
Throws:
IndexOutOfBoundsException - if the column argument is invalid
NullPointerException - if any argument is null

createTableSpec

public static final DataTableSpec createTableSpec(DataTableSpec spec,
                                                  DataColumnSpec[] cspecs,
                                                  int[] columns)
Creates a new table spec with several replaced columns.

Parameters:
spec - the table to replace one or more columns in
cspecs - the new column specs
columns - positions
Returns:
a new data table spec with the replaced column spec
Throws:
IndexOutOfBoundsException - if any column argument is invalid
NullPointerException - if any argument is null or contains null elements

getDataTableSpec

public DataTableSpec getDataTableSpec()
Returns the DataTableSpec object of this table which gives information about the structure of this data table.

Specified by:
getDataTableSpec in interface DataTable
Returns:
the DataTableSpec of this table

iterator

public RowIterator iterator()
Returns a row iterator which returns each row one-by-one from the table.

Specified by:
iterator in interface Iterable<DataRow>
Specified by:
iterator in interface DataTable
Returns:
row iterator
See Also:
DataRow


Copyright, 2003 - 2010. All rights reserved.
University of Konstanz, Germany.
Chair for Bioinformatics and Information Mining, Prof. Dr. Michael R. Berthold.
You may not modify, publish, transmit, transfer or sell, reproduce, create derivative works from, distribute, perform, display, or in any way exploit any of the content, in whole or in part, except as otherwise expressly permitted in writing by the copyright owner or as specified in the license file distributed with this product.