org.knime.base.data.nominal
Class NominalTable

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

public class NominalTable
extends Object
implements DataTable

This class wraps a DataTable into a new one by computing all possible values for one particular column. This is then returned by the DataTableSpec.getColumnSpec(int) method. All binned columns are then handled as String-valued columns.

Note, this computation can be time consuming, since it is necessary to iterate to the full data table and checking each value.

Author:
Thomas Gabriel, University of Konstanz
See Also:
DataColumnSpec, DataTableSpec

Constructor Summary
NominalTable(BufferedDataTable table, ExecutionMonitor exec)
          Wraps the given table into a new table by computing all possible values for all columns.
NominalTable(BufferedDataTable table, ExecutionMonitor exec, int... columnIndex)
          Wraps the given table into a new table by computing all possible values for the given column indices.
NominalTable(BufferedDataTable table, ExecutionMonitor exec, String... columns)
          Wraps the given table into a new table by computing all possible values for the given column.
 
Method Summary
static DataTableSpec computeValues(BufferedDataTable table, ExecutionMonitor exec)
          Wraps the given table into a new table by computing all possible values for all columns.
static DataTableSpec computeValues(BufferedDataTable table, ExecutionMonitor exec, int... columnIndex)
          Finds all possible values based on a table and a number of given column indices by iterating through the table.
static DataTableSpec computeValues(BufferedDataTable table, ExecutionMonitor exec, String... columns)
          Computes all possible values based in the given table and column name.
 DataTableSpec getDataTableSpec()
          The table spec which contains at least all possible values for one particular column.
 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

NominalTable

public NominalTable(BufferedDataTable table,
                    ExecutionMonitor exec,
                    String... columns)
             throws CanceledExecutionException
Wraps the given table into a new table by computing all possible values for the given column.

Parameters:
table - the data table to work on
columns - the column to find nominal values for
exec - object to check with if user canceled
Throws:
CanceledExecutionException - if user canceled execution
NullPointerException - if the table or column is null
IllegalArgumentException - if the column does not appear in the table
IllegalStateException - if the column appears at least twice in table
See Also:
computeValues(BufferedDataTable,ExecutionMonitor,String...)

NominalTable

public NominalTable(BufferedDataTable table,
                    ExecutionMonitor exec)
             throws CanceledExecutionException
Wraps the given table into a new table by computing all possible values for all columns.

Parameters:
table - the data table to work on
exec - object to check with if user canceled
Throws:
CanceledExecutionException - if user canceled execution
NullPointerException - if the table is null

NominalTable

public NominalTable(BufferedDataTable table,
                    ExecutionMonitor exec,
                    int... columnIndex)
             throws CanceledExecutionException
Wraps the given table into a new table by computing all possible values for the given column indices.

Parameters:
table - the data table to work on
columnIndex - the selected columns
exec - object to check with if user canceled
Throws:
CanceledExecutionException - if user canceled execution
NullPointerException - if the table is null
IndexOutOfBoundsException - if the column index is not in the range of the table
IllegalArgumentException - if the array of column indices is not sorted
Method Detail

computeValues

public static final DataTableSpec computeValues(BufferedDataTable table,
                                                ExecutionMonitor exec)
                                         throws CanceledExecutionException
Wraps the given table into a new table by computing all possible values for all columns.

Parameters:
table - the data table to work on
exec - object to check with if user canceled
Returns:
a new spec containing all possible value for all columns
Throws:
CanceledExecutionException - if user canceled execution
NullPointerException - if the table is null

getDataTableSpec

public DataTableSpec getDataTableSpec()
The table spec which contains at least all possible values for one particular column.

Specified by:
getDataTableSpec in interface DataTable
Returns:
the data table spec

iterator

public RowIterator iterator()
Description copied from interface: DataTable
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:
the original table's row iterator
See Also:
DataTable.iterator()

computeValues

public static final DataTableSpec computeValues(BufferedDataTable table,
                                                ExecutionMonitor exec,
                                                String... columns)
                                         throws CanceledExecutionException
Computes all possible values based in the given table and column name.

Parameters:
table - the underlying table
columns - the columns to retrieve all possible values for
exec - object to check with if user canceled operation
Returns:
a new table spec
Throws:
NullPointerException - if either the table or the columns array is null
IllegalArgumentException - if the column does not appear in the data
IllegalStateException - if the column appears at least twice in the table
CanceledExecutionException - if user canceled execution
See Also:
computeValues(BufferedDataTable,ExecutionMonitor,int...)

computeValues

public static final DataTableSpec computeValues(BufferedDataTable table,
                                                ExecutionMonitor exec,
                                                int... columnIndex)
                                         throws CanceledExecutionException
Finds all possible values based on a table and a number of given column indices by iterating through the table.

Parameters:
table - ihe table to get values from
columnIndex - an array of sorted column indices
exec - an object to check if user canceled
Returns:
a modified table spec containing all possible values
Throws:
NullPointerException - if the table is null
IllegalArgumentException - if column indices are not sorted
IndexOutOfBoundsException - if a column index is out of range
CanceledExecutionException - if user canceled operation


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.