org.knime.base.data.append.column
Class AppendedColumnTable

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

public class AppendedColumnTable
extends Object
implements DataTable

A table that appends columns to a given input table. The new columns' values are provided by an AppendedCellFactory.

This implementation does not verify that the generated cells (from the factory) actually fit to the column spec. Instead, this is checked dynamically in the iterator.

Author:
Bernd Wiswedel, University of Konstanz

Constructor Summary
AppendedColumnTable(DataTable table, AppendedCellFactory cellFactory, DataColumnSpec... appendColSpec)
          Creates new table.
AppendedColumnTable(DataTable table, Map<RowKey,DataCell> map, DataColumnSpec... appendedColSpec)
          Create new table based on an underlying table with a map providing the row key --> new cell mapping.
 
Method Summary
(package private)  DataType[] getAppendedColumnClasses()
          Get the class values of the appended columns.
(package private)  RowIterator getBaseIterator()
          Get new iterator over the underlying table.
 DataTableSpec getDataTableSpec()
          Returns the DataTableSpec object of this table which gives information about the structure of this data table.
(package private)  AppendedCellFactory getFactory()
          Get reference to the constructor argument.
static DataTableSpec getTableSpec(DataTableSpec table, DataColumnSpec... cols)
          Get table spec that is generated when the table is extended by the columns.
 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

AppendedColumnTable

public AppendedColumnTable(DataTable table,
                           AppendedCellFactory cellFactory,
                           DataColumnSpec... appendColSpec)
Creates new table.

Parameters:
table - the underlying table providing the first columns
cellFactory - a factory providing the content of the new columns
appendColSpec - the column specs for the new columns.

AppendedColumnTable

public AppendedColumnTable(DataTable table,
                           Map<RowKey,DataCell> map,
                           DataColumnSpec... appendedColSpec)
Create new table based on an underlying table with a map providing the row key --> new cell mapping. (Thus, this constructor allows only the extension by one column.)

Parameters:
table - the underlying table
map - tTe map that has to contain all mappings of row key to new cell. If it does not contain all, an exception is throw while iterating over the table.
appendedColSpec - the column specs of the new column
Throws:
NullPointerException - if any argument is null
Method Detail

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

getBaseIterator

RowIterator getBaseIterator()
Get new iterator over the underlying table.

Returns:
a new iterator

getFactory

AppendedCellFactory getFactory()
Get reference to the constructor argument.

Returns:
the factory for cells

getAppendedColumnClasses

DataType[] getAppendedColumnClasses()
Get the class values of the appended columns.

Returns:
those classes

getTableSpec

public static final DataTableSpec getTableSpec(DataTableSpec table,
                                               DataColumnSpec... cols)
Get table spec that is generated when the table is extended by the columns.

Parameters:
table - the underlying table
cols - the column specs by which table is extended
Returns:
the resulting table spec


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.