org.zkoss.pivot.impl
Enum StandardCalculator

java.lang.Object
  extended by java.lang.Enum<StandardCalculator>
      extended by org.zkoss.pivot.impl.StandardCalculator
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<StandardCalculator>, Calculator, ContextualCalculator

public enum StandardCalculator
extends java.lang.Enum<StandardCalculator>
implements ContextualCalculator

The built-in Calculator set for TabularPivotModel.

Author:
simonpai

Enum Constant Summary
AVERAGE
          Calculates the arithmetic average of data.
COUNT
          Returns the count of data, including non-number entries.
COUNT_NUMBER
          Returns the count of numerical data.
MAX
          Calculates the maximum of data.
MIN
          Calculates the minimum of data.
PRODUCT
          Returns the arithmetic product of data.
STD_DEV
          Returns the sample standard deviation.
STD_DEV_P
          Returns the standard deviation of the sample.
SUM
          Returns the arithmetic sum of data.
SUM_OR_COUNT
          Returns the sum of data if the data entries are all numeric.
VARIANCE
          Returns the variance corresponding to the sample standard deviation.
VARIANCE_P
          Returns the variance corresponding to the standard deviation of the sample.
 
Method Summary
 StandardContextType getContextType()
          Get the ContextType.
 java.lang.String getLabel()
           
 java.lang.String getLabelKey()
           
 java.lang.Number getResult(Context context)
          Retrieve the aggregation result from the context.
static StandardCalculator valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static StandardCalculator[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

SUM

public static final StandardCalculator SUM
Returns the arithmetic sum of data. Non numeric values are omitted. Returns 0 if no numeric values are present.


COUNT

public static final StandardCalculator COUNT
Returns the count of data, including non-number entries.


AVERAGE

public static final StandardCalculator AVERAGE
Calculates the arithmetic average of data. Non numeric values are omitted. Returns null if no numeric values are present.


MAX

public static final StandardCalculator MAX
Calculates the maximum of data. Non numeric values are omitted. Returns null if no numeric values are present.


MIN

public static final StandardCalculator MIN
Calculates the minimum of data. Non numeric values are omitted. Returns null if no numeric values are present.


SUM_OR_COUNT

public static final StandardCalculator SUM_OR_COUNT
Returns the sum of data if the data entries are all numeric. Returns count of data otherwise.


COUNT_NUMBER

public static final StandardCalculator COUNT_NUMBER
Returns the count of numerical data. Non-number entries are omitted.


PRODUCT

public static final StandardCalculator PRODUCT
Returns the arithmetic product of data. Non numeric values are omitted. Returns 1 if no numeric values are present.


STD_DEV

public static final StandardCalculator STD_DEV
Returns the sample standard deviation. (The one with variance by dividing N - 1.)


STD_DEV_P

public static final StandardCalculator STD_DEV_P
Returns the standard deviation of the sample. (The one with variance by dividing N.)


VARIANCE

public static final StandardCalculator VARIANCE
Returns the variance corresponding to the sample standard deviation. (The one by dividing N - 1.)


VARIANCE_P

public static final StandardCalculator VARIANCE_P
Returns the variance corresponding to the standard deviation of the sample. (The one by dividing N.)

Method Detail

values

public static StandardCalculator[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (StandardCalculator c : StandardCalculator.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static StandardCalculator valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
java.lang.NullPointerException - if the argument is null

getResult

public java.lang.Number getResult(Context context)
Description copied from interface: ContextualCalculator
Retrieve the aggregation result from the context.

Specified by:
getResult in interface ContextualCalculator

getContextType

public StandardContextType getContextType()
Description copied from interface: ContextualCalculator
Get the ContextType.

Specified by:
getContextType in interface ContextualCalculator

getLabel

public java.lang.String getLabel()
Specified by:
getLabel in interface Calculator

getLabelKey

public java.lang.String getLabelKey()
Specified by:
getLabelKey in interface Calculator


Copyright © 2013. All Rights Reserved.