net.sf.jagg
Class AbstractCovarianceAggregator

java.lang.Object
  extended by net.sf.jagg.Aggregator
      extended by net.sf.jagg.TwoPropAggregator
          extended by net.sf.jagg.AbstractCovarianceAggregator
Direct Known Subclasses:
CovarianceAggregator, CovariancePopAggregator

public abstract class AbstractCovarianceAggregator
extends TwoPropAggregator

This abstract class represents covariance-like aggregator calculations over numeric values.

Since:
0.3.0
Author:
Randy Gettman

Field Summary
protected  long myCount
          A running count of items processed so far where BOTH properties yield non-null values.
protected  DoubleDouble mySum1
          A running sum of items processed so far for the FIRST property.
protected  DoubleDouble mySum2
          A running sum of items processed so far for the SECOND property.
protected  DoubleDouble myVarNumerator
          A running total of the variance, before it is divided by the denominator in the variance calculation.
 
Fields inherited from class net.sf.jagg.Aggregator
PROP_SELF
 
Constructor Summary
AbstractCovarianceAggregator(java.lang.String properties)
          Constructs a CovarianceAggregator on the specified properties, in the format: property, property2.
AbstractCovarianceAggregator(java.lang.String property, java.lang.String property2)
          Constructs a CovarianceAggregator that operates on the specified properties.
 
Method Summary
 void init()
          Initialize the sums, count, and variance numerator to zero.
 void iterate(java.lang.Object value)
          Count only if both properties are non-null.
 void merge(Aggregator agg)
          Merge the given Aggregator into this one.
 
Methods inherited from class net.sf.jagg.TwoPropAggregator
getProperty2, setProperty, toString
 
Methods inherited from class net.sf.jagg.Aggregator
equals, getAggregator, getAggregator, getProperty, getValueFromProperty, hashCode, isInUse, replicate, setInUse, terminate, terminateDoubleDouble
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

myCount

protected long myCount
A running count of items processed so far where BOTH properties yield non-null values.


mySum1

protected DoubleDouble mySum1
A running sum of items processed so far for the FIRST property.


mySum2

protected DoubleDouble mySum2
A running sum of items processed so far for the SECOND property.


myVarNumerator

protected DoubleDouble myVarNumerator
A running total of the variance, before it is divided by the denominator in the variance calculation.

Constructor Detail

AbstractCovarianceAggregator

public AbstractCovarianceAggregator(java.lang.String properties)
Constructs a CovarianceAggregator on the specified properties, in the format: property, property2.

Parameters:
properties - A specification string in the format: property, property2.

AbstractCovarianceAggregator

public AbstractCovarianceAggregator(java.lang.String property,
                                    java.lang.String property2)
Constructs a CovarianceAggregator that operates on the specified properties.

Parameters:
property - Determine the covariance of this property with the other.
property2 - Determine the covariance of this property with the other.
Method Detail

init

public void init()
Initialize the sums, count, and variance numerator to zero.

Specified by:
init in class Aggregator

iterate

public void iterate(java.lang.Object value)
Count only if both properties are non-null. Sum both properties. Update the variance numerator.

Specified by:
iterate in class Aggregator
Parameters:
value - The value to aggregate.
See Also:
Aggregator.getValueFromProperty(java.lang.Object, java.lang.String)

merge

public void merge(Aggregator agg)
Merge the given Aggregator into this one. Add the sums together. Add in the count. Update the variance numerator.

Specified by:
merge in class Aggregator
Parameters:
agg - The Aggregator to merge into this one.


Copyright © 2010-2013 jAgg Team. All Rights Reserved.