Package org.zkoss.pivot.impl
Enum StandardCalculator
- java.lang.Object
-
- java.lang.Enum<StandardCalculator>
-
- org.zkoss.pivot.impl.StandardCalculator
-
- All Implemented Interfaces:
Serializable,Comparable<StandardCalculator>,Calculator,ContextualCalculator
public enum StandardCalculator extends Enum<StandardCalculator> implements ContextualCalculator
The built-in Calculator set forTabularPivotModel.- Author:
- simonpai
-
-
Enum Constant Summary
Enum Constants Enum Constant Description AVERAGECalculates the arithmetic average of data.COUNTReturns the count of data, including non-number entries.COUNT_NUMBERReturns the count of numerical data.MAXCalculates the maximum of data.MINCalculates the minimum of data.PRODUCTReturns the arithmetic product of data.STD_DEVReturns the sample standard deviation.STD_DEV_PReturns the standard deviation of the sample.SUMReturns the arithmetic sum of data.SUM_OR_COUNTReturns the sum of data if the data entries are all numeric.VARIANCEReturns the variance corresponding to the sample standard deviation.VARIANCE_PReturns the variance corresponding to the standard deviation of the sample.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StandardContextTypegetContextType()Get theContextType.StringgetLabel()StringgetLabelKey()NumbergetResult(Context context)Retrieve the aggregation result from the context.static StandardCalculatorvalueOf(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.
-
-
-
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(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:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
getResult
public Number getResult(Context context)
Description copied from interface:ContextualCalculatorRetrieve the aggregation result from the context.- Specified by:
getResultin interfaceContextualCalculator
-
getContextType
public StandardContextType getContextType()
Description copied from interface:ContextualCalculatorGet theContextType.- Specified by:
getContextTypein interfaceContextualCalculator
-
getLabel
public String getLabel()
- Specified by:
getLabelin interfaceCalculator
-
getLabelKey
public String getLabelKey()
- Specified by:
getLabelKeyin interfaceCalculator
-
-