org.knime.base.node.preproc.missingval
Class MissingValueHandlingTable

java.lang.Object
  extended by org.knime.base.node.preproc.missingval.MissingValueHandlingTable
All Implemented Interfaces:
Iterable<DataRow>, DataTable

public final class MissingValueHandlingTable
extends Object
implements DataTable

DataTable that replaces missing values according to ColSetting objects.

Author:
Bernd Wiswedel, University of Konstanz

Method Summary
static BufferedDataTable createMissingValueHandlingTable(DataTable table, ColSetting[] colSettings, ExecutionContext exec, StringBuffer warningBuffer)
          Does missing value handling to the argument table given the col settings in an array and also reports progress.
(package private) static DataTableSpec createTableSpec(DataTableSpec spec, ColSetting[] sets)
          Get the DataTableSpec that is created when creating a MissingValueHandling with the settings sets.
(package private)  ColSetting getColSetting(int column)
          The column settings for a column.
 DataTableSpec getDataTableSpec()
          Returns the DataTableSpec object of this table which gives information about the structure of this data table.
(package private)  RowIterator getInternalIterator()
          Get RowIterator of underlying table.
protected  DataCell getMax(int column)
          Delegating method to StatisticsTable.
protected  double getMean(int column)
          Delegating method to StatisticsTable.
protected  DataCell getMin(int column)
          Delegating method to StatisticsTable.
protected  DataCell getMostFrequent(int column)
          Get the most frequent value in a column.
(package private)  int getNrRowsInReference()
          Tries to retrieve the number of rows in the underlying table.
(package private)  DataTable getUnderlyingTable()
          Get reference to underlying 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
 

Method Detail

getUnderlyingTable

DataTable getUnderlyingTable()
Get reference to underlying table.

Returns:
the table being wrapped by us

getNrRowsInReference

int getNrRowsInReference()
Tries to retrieve the number of rows in the underlying table.

Returns:
The number of rows or -1 if not possible.

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

getMax

protected DataCell getMax(int column)
Delegating method to StatisticsTable.

Parameters:
column - the column of interest
Returns:
the maximum in a column
See Also:
StatisticsTable.getMax(int)

getMean

protected double getMean(int column)
Delegating method to StatisticsTable.

Parameters:
column - the column of interest
Returns:
the mean in a column (or Double.NaN for non-double columns)
See Also:
StatisticsTable.getMean(int)

getMostFrequent

protected DataCell getMostFrequent(int column)
Get the most frequent value in a column.

Parameters:
column - the column of interest
Returns:
Most frequent value in it.
See Also:
StatisticsTable.getMean(int)

getMin

protected DataCell getMin(int column)
Delegating method to StatisticsTable.

Parameters:
column - the column of interest
Returns:
the min in a column
See Also:
StatisticsTable.getMin(int)

getInternalIterator

RowIterator getInternalIterator()
Get RowIterator of underlying table.

Returns:
the iterator of the base table

getColSetting

ColSetting getColSetting(int column)
The column settings for a column.

Parameters:
column - the column of interest
Returns:
the column setting to use

createTableSpec

static DataTableSpec createTableSpec(DataTableSpec spec,
                                     ColSetting[] sets)
                              throws InvalidSettingsException
Get the DataTableSpec that is created when creating a MissingValueHandling with the settings sets.

Parameters:
spec - the spec of the original input table
sets - the column settings to apply
Returns:
the new DataTableSpec when handling missing values
Throws:
InvalidSettingsException - if the settings don't fit to the data

createMissingValueHandlingTable

public static BufferedDataTable createMissingValueHandlingTable(DataTable table,
                                                                ColSetting[] colSettings,
                                                                ExecutionContext exec,
                                                                StringBuffer warningBuffer)
                                                         throws CanceledExecutionException
Does missing value handling to the argument table given the col settings in an array and also reports progress.

Parameters:
table - the table to do missing value handling on
colSettings - the settings
exec - for progress/cancel and to create the buffered data table
warningBuffer - To which potential warning messages are added.
Returns:
a cache table, cleaned up
Throws:
CanceledExecutionException - if canceled


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.