org.knime.base.data.append.row
Class AppendedRowsTable

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

public class AppendedRowsTable
extends Object
implements DataTable

DataTable implementation that concatenates a set of DataTable objects. All tables should have the same columns (identified by their column name). Missing columns in tables are tried to be filled with missing cells (where it is possible - so far for string, double, int). Non matching column types are adjusted such that they match (if not possible, the column's type is DataCell).

The order of colums of this table is determined by the order of the top table (the first array argument in the constructor)

Author:
Bernd Wiswedel, University of Konstanz

Constructor Summary
AppendedRowsTable(DataTable... tables)
          Concatenates a set of tables.
AppendedRowsTable(String suffix, DataTable... tables)
          Concatenates a set of tables.
 
Method Summary
static DataTableSpec generateDataTableSpec(DataTableSpec... tableSpecs)
          Factory method that determines the final DataTableSpec given the tables.
 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.
 AppendedRowsIterator iterator(ExecutionMonitor exec, int totalRowCount)
          Get an iterator whose RowIterator.next() method may throw an exception if the execution is canceled.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AppendedRowsTable

public AppendedRowsTable(DataTable... tables)
Concatenates a set of tables. Duplicate entries are skipped.

Parameters:
tables - all tables to be appended
Throws:
NullPointerException - if argument is null or contains null elements.

AppendedRowsTable

public AppendedRowsTable(String suffix,
                         DataTable... tables)
Concatenates a set of tables. Duplicate keys may be skipped (suffix argument is null) or may be avoided by appending a fixed suffix to any subsequent occurence of a duplicate.

Parameters:
tables - all tables to be appended
suffix - suffix to append to duplicate keys or null to skip them
Throws:
NullPointerException - if argument is null or contains null elements
IllegalArgumentException - if suffix is empty (null is ok)
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

iterator

public AppendedRowsIterator iterator(ExecutionMonitor exec,
                                     int totalRowCount)
Get an iterator whose RowIterator.next() method may throw an exception if the execution is canceled. In particular if you try to concatenate a table to itself and do not allow duplicates, the RowIterator.next() method runs very long (scanning the entire table to just figure out that there are only duplicates).

Parameters:
exec - the execution monitor for cancel / progress
totalRowCount - the total number rows or negative if unknown
Returns:
an iterator which reacts on cancel events
See Also:
AppendedRowsIterator.RuntimeCanceledExecutionException

generateDataTableSpec

public static final DataTableSpec generateDataTableSpec(DataTableSpec... tableSpecs)
Factory method that determines the final DataTableSpec given the tables.

Parameters:
tableSpecs - the table specs as in the constructor
Returns:
the outcoming {qlink DataTableSpec}
See Also:
AppendedRowsTable(DataTable[])


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.