Package org.zkoss.pivot.impl.calc
Class VarianceContext
- java.lang.Object
-
- org.zkoss.pivot.impl.calc.VarianceContext
-
- All Implemented Interfaces:
Context<VarianceContext>
public class VarianceContext extends Object implements Context<VarianceContext>
The context for calculating variance and standard deviation.- Author:
- simonpai
-
-
Field Summary
Fields Modifier and Type Field Description protected int_ncountprotected double_sqsumprotected double_sumstatic ContextFactory<VarianceContext>FACTORY
-
Constructor Summary
Constructors Constructor Description VarianceContext()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(Object item)Add an item into the aggregation.intgetNumberCount()Retrieve number count.doublegetSum()Retrieve sum of the numbers.doublegetSumOfSquare()Retrieve sum of the square of the numbers.DoublegetVar()DoublegetVarP()voidmerge(VarianceContext ctx)Merge from another context of the same type.
-
-
-
Field Detail
-
_sqsum
protected double _sqsum
-
_sum
protected double _sum
-
_ncount
protected int _ncount
-
FACTORY
public static final ContextFactory<VarianceContext> FACTORY
-
-
Method Detail
-
add
public void add(Object item)
Description copied from interface:ContextAdd an item into the aggregation.- Specified by:
addin interfaceContext<VarianceContext>
-
merge
public void merge(VarianceContext ctx)
Description copied from interface:ContextMerge from another context of the same type.- Specified by:
mergein interfaceContext<VarianceContext>
-
getSumOfSquare
public double getSumOfSquare()
Retrieve sum of the square of the numbers.
-
getSum
public double getSum()
Retrieve sum of the numbers.
-
getNumberCount
public int getNumberCount()
Retrieve number count. Non-number objects are ignored.
-
getVar
public Double getVar()
-
getVarP
public Double getVarP()
-
-