org.knime.base.node.preproc.groupby.aggregation
Class AggregationOperator

java.lang.Object
  extended by org.knime.base.node.preproc.groupby.aggregation.AggregationOperator
Direct Known Subclasses:
NumericOperators.MaxOperator, NumericOperators.MeanOperator, NumericOperators.MinOperator, NumericOperators.SumOperator, NumericOperators.VarianceOperator, Operators.ConcatenateOperator, Operators.CountOperator, Operators.FirstOperator, Operators.LastOperator, Operators.ListCellOperator, Operators.ModeOperator, Operators.SetCellOperator, Operators.UniqueConcatenateOperator, Operators.UniqueConcatenateWithCountOperator, Operators.UniqueCountOperator

public abstract class AggregationOperator
extends Object

Abstract class which has to be extended by all aggregation method operators in the AggregationMethod enumeration to be used in the GroupByTable class.

Author:
Tobias Koetter, University of Konstanz

Field Summary
static String CONCATENATOR
          The String to use by concatenation operators.
 
Constructor Summary
AggregationOperator(String label, boolean numerical, boolean usesLimit, boolean keepColSpec, int maxUniqueValues)
          Constructor for class AggregationOperator.
AggregationOperator(String label, String shortLabel, boolean numerical, boolean usesLimit, boolean keepColSpec, int maxUniqueValues)
          Constructor for class AggregationOperator.
 
Method Summary
 void compute(DataCell cell)
           
protected abstract  boolean computeInternal(DataCell cell)
           
 DataColumnSpec createColumnSpec(String colName, DataColumnSpec origSpec)
           
abstract  AggregationOperator createInstance(DataColumnSpec origColSpec, int maxUniqueValues)
          Creates a new instance of this operator.
protected abstract  DataType getDataType(DataType origType)
           
 String getLabel()
           
 int getMaxUniqueValues()
           
 DataCell getResult()
           
protected abstract  DataCell getResultInternal()
           
 String getShortLabel()
           
 boolean isNumerical()
           
 boolean isSkipped()
           
 boolean isUsesLimit()
           
 void reset()
          Should reset the operator to the start values.
protected abstract  void resetInternal()
          Should reset the operator to the start values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONCATENATOR

public static final String CONCATENATOR
The String to use by concatenation operators.

See Also:
Constant Field Values
Constructor Detail

AggregationOperator

public AggregationOperator(String label,
                           boolean numerical,
                           boolean usesLimit,
                           boolean keepColSpec,
                           int maxUniqueValues)
Constructor for class AggregationOperator.

Parameters:
label - user readable label which is also used for the column name
numerical - true if the operator is only suitable for numerical columns
usesLimit - true if the method checks the number of unique values limit.
keepColSpec - true if the original column specification should be kept if possible
maxUniqueValues - the maximum number of unique values

AggregationOperator

public AggregationOperator(String label,
                           String shortLabel,
                           boolean numerical,
                           boolean usesLimit,
                           boolean keepColSpec,
                           int maxUniqueValues)
Constructor for class AggregationOperator.

Parameters:
label - user readable label
shortLabel - the short label used for the column name
numerical - true if the operator is only suitable for numerical columns
usesLimit - true if the method checks the number of unique values limit.
keepColSpec - true if the original column specification should be kept if possible
maxUniqueValues - the maximum number of unique values
Method Detail

createInstance

public abstract AggregationOperator createInstance(DataColumnSpec origColSpec,
                                                   int maxUniqueValues)
Creates a new instance of this operator.

Parameters:
origColSpec - the DataColumnSpec of the original column
maxUniqueValues - the maximum number of unique values
Returns:
a new instance of this operator

getMaxUniqueValues

public int getMaxUniqueValues()
Returns:
the maxUniqueValues

isSkipped

public boolean isSkipped()
Returns:
true if this operator was skipped

compute

public void compute(DataCell cell)
Parameters:
cell - the DataCell to consider during computing

computeInternal

protected abstract boolean computeInternal(DataCell cell)
Parameters:
cell - the DataCell to consider during computing the cell can't be null.
Returns:
true if this column should be skipped in further calculations

createColumnSpec

public DataColumnSpec createColumnSpec(String colName,
                                       DataColumnSpec origSpec)
Parameters:
colName - the name of the new column
origSpec - the original DataColumnSpec
Returns:
the new DataColumnSpecCreator for the aggregated column

getDataType

protected abstract DataType getDataType(DataType origType)
Parameters:
origType - the DataType of the original column to aggregate
Returns:
the DataType of the aggregation result

getResult

public DataCell getResult()
Returns:
the result DataCell

getResultInternal

protected abstract DataCell getResultInternal()
Returns:
the result DataCell

reset

public void reset()
Should reset the operator to the start values.


resetInternal

protected abstract void resetInternal()
Should reset the operator to the start values.


getLabel

public String getLabel()
Returns:
the label

getShortLabel

public String getShortLabel()
Returns:
the short label which is used in the column name

isNumerical

public boolean isNumerical()
Returns:
the numerical

isUsesLimit

public boolean isUsesLimit()
Returns:
true if this method checks the maximum unique values limit.


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.