org.knime.core.data.container
Class WrappedTable

java.lang.Object
  extended by org.knime.core.data.container.WrappedTable
All Implemented Interfaces:
Iterable<DataRow>, DataTable, BufferedDataTable.KnowsRowCountTable

public final class WrappedTable
extends Object
implements BufferedDataTable.KnowsRowCountTable

Special table implementation that simply wraps a given BufferedDataTable. This class is used by the framework and should not be of public interest.

Author:
Bernd Wiswedel, University of Konstanz

Constructor Summary
WrappedTable(BufferedDataTable table)
          Creates new table wrapping the argument.
 
Method Summary
 void clear()
          Clears any allocated temporary files.
 void ensureOpen()
          Implementation of BufferedDataTable.ensureOpen().
 DataTableSpec getDataTableSpec()
          Returns the DataTableSpec object of this table which gives information about the structure of this data table.
 BufferedDataTable[] getReferenceTables()
          Reference to the underlying tables, if any.
 int getRowCount()
          Row count of the table.
 CloseableRowIterator iterator()
          Overridden to narrow return type to closeable iterator.
static WrappedTable load(NodeSettingsRO s, Map<Integer,BufferedDataTable> tblRep)
          Restore table, reverse operation to save.
 void putIntoTableRepository(HashMap<Integer,ContainerTable> rep)
          Put this table into the global table repository.
 void removeFromTableRepository(HashMap<Integer,ContainerTable> rep)
          Remove this table from global table repository.
 void saveToFile(File f, NodeSettingsWO s, ExecutionMonitor exec)
          Save the table to a file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WrappedTable

public WrappedTable(BufferedDataTable table)
Creates new table wrapping the argument.

Parameters:
table - Table to wrap
Throws:
NullPointerException - If argument is null.
Method Detail

clear

public void clear()
Clears any allocated temporary files. The table won't be used anymore.

Specified by:
clear in interface BufferedDataTable.KnowsRowCountTable

ensureOpen

public void ensureOpen()
Implementation of BufferedDataTable.ensureOpen().

Specified by:
ensureOpen in interface BufferedDataTable.KnowsRowCountTable

getReferenceTables

public BufferedDataTable[] getReferenceTables()
Reference to the underlying tables, if any. A reference table exists if this object is just a wrapper, such as a RearrangeColumnsTable or if this table concatenates a set of other tables.

Specified by:
getReferenceTables in interface BufferedDataTable.KnowsRowCountTable
Returns:
The reference table or null.

getRowCount

public int getRowCount()
Row count of the table.

Specified by:
getRowCount in interface BufferedDataTable.KnowsRowCountTable
Returns:
The row count.

iterator

public CloseableRowIterator iterator()
Overridden to narrow return type to closeable 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
Specified by:
iterator in interface BufferedDataTable.KnowsRowCountTable
Returns:
row iterator
See Also:
DataRow

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

putIntoTableRepository

public void putIntoTableRepository(HashMap<Integer,ContainerTable> rep)
Put this table into the global table repository. Called when execution finished.

Specified by:
putIntoTableRepository in interface BufferedDataTable.KnowsRowCountTable
Parameters:
rep - The workflow table repository.

removeFromTableRepository

public void removeFromTableRepository(HashMap<Integer,ContainerTable> rep)
Remove this table from global table repository. Called when node is reset.

Specified by:
removeFromTableRepository in interface BufferedDataTable.KnowsRowCountTable
Parameters:
rep - The workflow table repository.

saveToFile

public void saveToFile(File f,
                       NodeSettingsWO s,
                       ExecutionMonitor exec)
                throws IOException,
                       CanceledExecutionException
Save the table to a file.

Specified by:
saveToFile in interface BufferedDataTable.KnowsRowCountTable
Parameters:
f - To write to.
s - To add meta information to.
exec - For progress/cancel.
Throws:
IOException - If writing fails.
CanceledExecutionException - If canceled.

load

public static WrappedTable load(NodeSettingsRO s,
                                Map<Integer,BufferedDataTable> tblRep)
                         throws InvalidSettingsException
Restore table, reverse operation to save.

Parameters:
s - To load from
tblRep - Global table loader map.
Returns:
A freshly created wrapped table.
Throws:
InvalidSettingsException - If settings are invalid.


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.