org.knime.base.data.aggregation
Class AggregationMethods

java.lang.Object
  extended by org.knime.base.data.aggregation.AggregationMethods

public final class AggregationMethods
extends Object

Singleton that lists all available aggregation methods including helper methods to retrieve meaningful methods.

Author:
Tobias Koetter, University of Konstanz

Field Summary
static String EXT_POINT_ATTR_DF
          The attribute of the aggregation method extension point.
static String EXT_POINT_ID
          The id of the AggregationMethod extension point.
 
Method Summary
static JScrollPane createDescriptionPane()
          Creates a JScrollPane that lists all available aggregation methods and a short description of each method.
static AggregationMethod getAggregationMethod(DataColumnSpec colSpec, AggregationMethod numericColMethod, AggregationMethod nominalColMethod)
           
static List<AggregationMethod> getAvailableMethods()
           
static Map<Class<? extends DataValue>,List<AggregationMethod>> getCompatibleMethodGroups(DataType type)
           
static List<AggregationMethod> getCompatibleMethods(DataType type)
           
static AggregationMethod getDefaultMethod(DataColumnSpec spec)
           
static AggregationMethod getDefaultNotNumericalMethod()
           
static AggregationMethod getDefaultNumericalMethod()
           
static StringBuilder getHTMLDescription()
           
static AggregationMethod getMethod4Id(String id)
           
static AggregationMethod getMethod4SettingsModel(SettingsModelString model)
           
static AggregationMethod getRowOrderMethod()
           
static Collection<Class<? extends DataValue>> getSupportedTypes()
          Returns a set with all data types that are supported by at least one AggregationOperator.
static String getUserTypeLabel(Class<? extends DataValue> type)
          Creates a more user friendly string for the given type.
static Map<Class<? extends DataValue>,List<AggregationMethod>> groupMethodsByType(List<AggregationMethod> methods)
           
static boolean operatorExists(String id)
           
static void registerOperator(AggregationOperator operator)
          This method allows the registration of new AggregationOperators.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EXT_POINT_ID

public static final String EXT_POINT_ID
The id of the AggregationMethod extension point.

See Also:
Constant Field Values

EXT_POINT_ATTR_DF

public static final String EXT_POINT_ATTR_DF
The attribute of the aggregation method extension point.

See Also:
Constant Field Values
Method Detail

registerOperator

public static void registerOperator(AggregationOperator operator)
                             throws DuplicateOperatorException
This method allows the registration of new AggregationOperators. Check first if an AggregationOperator with the same name is already registered using the {operatorExists(String) method.

Parameters:
operator - the AggregationOperator to register
Throws:
DuplicateOperatorException - if an operator with the same name already exists

operatorExists

public static boolean operatorExists(String id)
Parameters:
id - the unique id to check
Returns:
true if an operator with the given name is already registered

getAggregationMethod

public static AggregationMethod getAggregationMethod(DataColumnSpec colSpec,
                                                     AggregationMethod numericColMethod,
                                                     AggregationMethod nominalColMethod)
Parameters:
colSpec - the DataColumnSpec to check
numericColMethod - the AggregationMethod for numerical columns
nominalColMethod - the AggregationMethod for none numerical columns
Returns:
the AggregationMethod to use

getCompatibleMethods

public static List<AggregationMethod> getCompatibleMethods(DataType type)
Parameters:
type - the DataType to check
Returns:
all AggregationOperators that are compatible with the given DataType or an empty list if none is compatible

getCompatibleMethodGroups

public static Map<Class<? extends DataValue>,List<AggregationMethod>> getCompatibleMethodGroups(DataType type)
Parameters:
type - the DataType to check
Returns:
the aggregation methods that are compatible with the given DataType group by the supported data type

getSupportedTypes

public static Collection<Class<? extends DataValue>> getSupportedTypes()
Returns a set with all data types that are supported by at least one AggregationOperator.

Returns:
all data types that are supported by at least one AggregationOperator

getUserTypeLabel

public static String getUserTypeLabel(Class<? extends DataValue> type)
Creates a more user friendly string for the given type. The types are returned starting with a capital letter such as Numerical, Date, etc.

Parameters:
type - the type to get the user readable name starting with a capital letter such as General, Numerical or Date.
Returns:
the user friendlier name starting with a capital letter

groupMethodsByType

public static Map<Class<? extends DataValue>,List<AggregationMethod>> groupMethodsByType(List<AggregationMethod> methods)
Parameters:
methods - the methods to group
Returns:
a Map with the given aggregation methods grouped by their supported data type.

getDefaultMethod

public static AggregationMethod getDefaultMethod(DataColumnSpec spec)
Parameters:
spec - the DataColumnSpec to get the default method for
Returns:
the default AggregationMethod for the given column spec

getMethod4SettingsModel

public static AggregationMethod getMethod4SettingsModel(SettingsModelString model)
Parameters:
model - the SettingsModelString with the id of the AggregationMethod
Returns:
the AggregationMethod for the given id

getMethod4Id

public static AggregationMethod getMethod4Id(String id)
                                      throws IllegalArgumentException
Parameters:
id - the id to get the AggregationMethod for.
Returns:
the AggregationMethod with the given id
Throws:
IllegalArgumentException - if no AggregationMethod exists for the given id

createDescriptionPane

public static JScrollPane createDescriptionPane()
Creates a JScrollPane that lists all available aggregation methods and a short description of each method.

Returns:
a JScrollPane that can be added to any dialog to display all available aggregation methods and their description.

getHTMLDescription

public static StringBuilder getHTMLDescription()
Returns:
the HTML String that lists all available aggregation methods and their description as a definition list.

getAvailableMethods

public static List<AggregationMethod> getAvailableMethods()
Returns:
all available methods ordered by the supported type and the operator name

getDefaultNotNumericalMethod

public static AggregationMethod getDefaultNotNumericalMethod()
Returns:
the default not numerical method

getDefaultNumericalMethod

public static AggregationMethod getDefaultNumericalMethod()
Returns:
the default numerical method

getRowOrderMethod

public static AggregationMethod getRowOrderMethod()
Returns:
the method used to order the rows of the output table if the row order should be retained


Copyright, 2003 - 2012. 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.