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

java.lang.Object
  extended by org.knime.base.node.preproc.missingval.ColSetting

final class ColSetting
extends Object

An object that holds some the properties how to handle missing values in an individual column (called individual) or in columns of one type (called meta). This object holds all properties that can be set in one single component in the missing value dialog, i.e.

where name and type are read only.

Author:
Bernd Wiswedel, University of Konstanz

Field Summary
protected static String CFG_COLNAME
          NodeSettings key: write column name (only for individual columns).
protected static String CFG_FIXVAL
          NodeSettings key: write fixed value replacement (if any).
protected static String CFG_INDIVIDUAL
          NodeSettings branch identifier for individual settings.
protected static String CFG_META
          NodeSettings branch identifier for meta settings.
protected static String CFG_META_DOUBLE
          NodeSettings branch identifier for meta setting, Double.
protected static String CFG_META_INT
          NodeSettings branch identifier for meta setting, Int.
protected static String CFG_META_OTHER
          NodeSettings branch identifier for meta setting, Other.
protected static String CFG_META_STRING
          NodeSettings branch identifier for meta setting, String (Individual columns have their name as identifier).
protected static String CFG_METHOD
          NodeSettings key: write method.
protected static String CFG_TYPE
          NodeSettings key: write column type.
static int METHOD_FIX_VAL
          Method: Replace by fixed value, available for Double, Int, String.
static int METHOD_IGNORE_ROWS
          Method: Remove row from data set, available for all types.
static int METHOD_MAX
          Method: Replace by max in column, available for Double and Int.
static int METHOD_MEAN
          Method: Replace by mean, available for Double and Int (rounded).
static int METHOD_MIN
          Method: Replace by min in column, available for Double and Int.
static int METHOD_MOST_FREQUENT
          Method: Replace by most frequent value, available for String.
static int METHOD_NO_HANDLING
          Method: Do nothing, leave untouched, available for all types.
static int TYPE_DOUBLE
          Type of column: Double.
static int TYPE_INT
          Type of column: Int.
static int TYPE_STRING
          Type of column: String.
static int TYPE_UNKNOWN
          Type of column: anything but String, Double, Int.
 
Constructor Summary
ColSetting(DataColumnSpec spec)
          Constructor for individual column.
ColSetting(int type)
          Constructor for meta column setting.
 
Method Summary
 DataCell getFixCell()
           
 int getMethod()
           
 String getName()
           
 int getType()
           
 boolean isMetaConfig()
          Is this config a meta-config?
protected static ColSetting[] loadIndividualColSettings(NodeSettingsRO settings)
          Helper that load individual settings from a config object, used in NodeModel.
protected static ColSetting[] loadIndividualColSettings(NodeSettingsRO settings, DataTableSpec spec)
          Helper that individual settings from a config object, used in NodeDialog.
protected static ColSetting[] loadMetaColSettings(NodeSettingsRO settings)
          Helper that load meta settings from a config object, used in NodeModel.
protected static ColSetting[] loadMetaColSettings(NodeSettingsRO settings, DataTableSpec spec)
          Helper that loads meta settings from a config object, used in NodeDialog.
protected  void loadSettings(NodeSettingsRO settings)
          Loads settings from a NodeSettings object, used in NodeModel.
protected static void saveIndividualsColSettings(ColSetting[] colSettings, NodeSettingsWO settings)
          Saves the individual settings to a config object.
protected static void saveMetaColSettings(ColSetting[] colSettings, NodeSettingsWO settings)
          Saves the meta settings to a config object.
protected  void saveSettings(NodeSettingsWO settings)
          Save settings to config object.
 void setFixCell(DataCell newFix)
           
 void setMethod(int method)
           
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE_UNKNOWN

public static final int TYPE_UNKNOWN
Type of column: anything but String, Double, Int.

See Also:
Constant Field Values

TYPE_DOUBLE

public static final int TYPE_DOUBLE
Type of column: Double.

See Also:
Constant Field Values

TYPE_INT

public static final int TYPE_INT
Type of column: Int.

See Also:
Constant Field Values

TYPE_STRING

public static final int TYPE_STRING
Type of column: String.

See Also:
Constant Field Values

METHOD_NO_HANDLING

public static final int METHOD_NO_HANDLING
Method: Do nothing, leave untouched, available for all types.

See Also:
Constant Field Values

METHOD_IGNORE_ROWS

public static final int METHOD_IGNORE_ROWS
Method: Remove row from data set, available for all types.

See Also:
Constant Field Values

METHOD_FIX_VAL

public static final int METHOD_FIX_VAL
Method: Replace by fixed value, available for Double, Int, String.

See Also:
Constant Field Values

METHOD_MEAN

public static final int METHOD_MEAN
Method: Replace by mean, available for Double and Int (rounded).

See Also:
Constant Field Values

METHOD_MIN

public static final int METHOD_MIN
Method: Replace by min in column, available for Double and Int.

See Also:
Constant Field Values

METHOD_MAX

public static final int METHOD_MAX
Method: Replace by max in column, available for Double and Int.

See Also:
Constant Field Values

METHOD_MOST_FREQUENT

public static final int METHOD_MOST_FREQUENT
Method: Replace by most frequent value, available for String.

See Also:
Constant Field Values

CFG_METHOD

protected static final String CFG_METHOD
NodeSettings key: write method.

See Also:
Constant Field Values

CFG_COLNAME

protected static final String CFG_COLNAME
NodeSettings key: write column name (only for individual columns).

See Also:
Constant Field Values

CFG_TYPE

protected static final String CFG_TYPE
NodeSettings key: write column type.

See Also:
Constant Field Values

CFG_FIXVAL

protected static final String CFG_FIXVAL
NodeSettings key: write fixed value replacement (if any).

See Also:
Constant Field Values

CFG_META

protected static final String CFG_META
NodeSettings branch identifier for meta settings.

See Also:
Constant Field Values

CFG_INDIVIDUAL

protected static final String CFG_INDIVIDUAL
NodeSettings branch identifier for individual settings.

See Also:
Constant Field Values

CFG_META_STRING

protected static final String CFG_META_STRING
NodeSettings branch identifier for meta setting, String (Individual columns have their name as identifier).

See Also:
Constant Field Values

CFG_META_DOUBLE

protected static final String CFG_META_DOUBLE
NodeSettings branch identifier for meta setting, Double.

See Also:
Constant Field Values

CFG_META_INT

protected static final String CFG_META_INT
NodeSettings branch identifier for meta setting, Int.

See Also:
Constant Field Values

CFG_META_OTHER

protected static final String CFG_META_OTHER
NodeSettings branch identifier for meta setting, Other.

See Also:
Constant Field Values
Constructor Detail

ColSetting

public ColSetting(int type)
Constructor for meta column setting.

Parameters:
type - the type of the meta column

ColSetting

public ColSetting(DataColumnSpec spec)
Constructor for individual column.

Parameters:
spec - the spec to the column
Method Detail

getMethod

public int getMethod()
Returns:
the method

setMethod

public void setMethod(int method)
Parameters:
method - the method to set

getFixCell

public DataCell getFixCell()
Returns:
the replace

setFixCell

public void setFixCell(DataCell newFix)
Parameters:
newFix - the replace to set

getType

public int getType()
Returns:
returns the type

getName

public String getName()
Returns:
returns the name or null if isMetaConfig() returns true

isMetaConfig

public boolean isMetaConfig()
Is this config a meta-config?

Returns:
true if it is

loadSettings

protected void loadSettings(NodeSettingsRO settings)
                     throws InvalidSettingsException
Loads settings from a NodeSettings object, used in NodeModel.

Parameters:
settings - the (sub-) config to load from
Throws:
InvalidSettingsException - if any setting is missing

saveSettings

protected void saveSettings(NodeSettingsWO settings)
Save settings to config object.

Parameters:
settings - to save to

loadMetaColSettings

protected static ColSetting[] loadMetaColSettings(NodeSettingsRO settings)
                                           throws InvalidSettingsException
Helper that load meta settings from a config object, used in NodeModel.

Parameters:
settings - to load from
Returns:
meta settings
Throws:
InvalidSettingsException - if errors occur

loadMetaColSettings

protected static ColSetting[] loadMetaColSettings(NodeSettingsRO settings,
                                                  DataTableSpec spec)
Helper that loads meta settings from a config object, used in NodeDialog.

Parameters:
settings - to load from
spec - To be used for default init
Returns:
meta settings

loadIndividualColSettings

protected static ColSetting[] loadIndividualColSettings(NodeSettingsRO settings)
                                                 throws InvalidSettingsException
Helper that load individual settings from a config object, used in NodeModel.

Parameters:
settings - to load from
Returns:
individual settings
Throws:
InvalidSettingsException - if errors occur

loadIndividualColSettings

protected static ColSetting[] loadIndividualColSettings(NodeSettingsRO settings,
                                                        DataTableSpec spec)
Helper that individual settings from a config object, used in NodeDialog.

Parameters:
settings - to load from
spec - ignored, used here to differ from method that is used by NodeModel
Returns:
individual settings

saveIndividualsColSettings

protected static void saveIndividualsColSettings(ColSetting[] colSettings,
                                                 NodeSettingsWO settings)
Saves the individual settings to a config object.

Parameters:
colSettings - the settings to write, may include meta settings (ignored)
settings - to write to

saveMetaColSettings

protected static void saveMetaColSettings(ColSetting[] colSettings,
                                          NodeSettingsWO settings)
Saves the meta settings to a config object.

Parameters:
colSettings - the settings to write, may include individual settings (ignored)
settings - to write to

toString

public String toString()

Overrides:
toString in class Object


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.