net.sf.jagg
Class ProductAggregator

java.lang.Object
  extended by net.sf.jagg.Aggregator
      extended by net.sf.jagg.ProductAggregator

public class ProductAggregator
extends Aggregator

This class allows represents the "product" aggregator over numeric values.

Since:
0.1.0
Author:
Randy Gettman

Field Summary
 
Fields inherited from class net.sf.jagg.Aggregator
PROP_SELF
 
Constructor Summary
ProductAggregator(java.lang.String property)
          Constructs an ProductAggregator that operates on the specified property.
 
Method Summary
 void init()
          Initialize the product to one.
 void iterate(java.lang.Object value)
          Multiply-in the factor given by this value, ignorning nulls.
 void merge(Aggregator agg)
          Merge the given Aggregator into this one by multiplying the respective products.
 ProductAggregator replicate()
          Returns an uninitialized copy of this Aggregator object, with the same property(ies) to analyze.
 java.lang.Double terminate()
          Return the product of all values.
 DoubleDouble terminateDoubleDouble()
          Return the result as a DoubleDouble.
 
Methods inherited from class net.sf.jagg.Aggregator
equals, getAggregator, getAggregator, getProperty, getValueFromProperty, hashCode, isInUse, setInUse, setProperty, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ProductAggregator

public ProductAggregator(java.lang.String property)
Constructs an ProductAggregator that operates on the specified property.

Parameters:
property - Multiply all this property's values.
Method Detail

replicate

public ProductAggregator replicate()
Returns an uninitialized copy of this Aggregator object, with the same property(ies) to analyze.

Specified by:
replicate in class Aggregator
Returns:
An uninitialized copy of this Aggregator object.

init

public void init()
Initialize the product to one.

Specified by:
init in class Aggregator

iterate

public void iterate(java.lang.Object value)
Multiply-in the factor given by this value, ignorning nulls.

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 by multiplying the respective products.

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

terminate

public java.lang.Double terminate()
Return the product of all values.

Specified by:
terminate in class Aggregator
Returns:
The product, as a Double, or 1 if no values have been processed.

terminateDoubleDouble

public DoubleDouble terminateDoubleDouble()
Return the result as a DoubleDouble. This is used mainly when other Aggregators that use this result must maintain a high precision.

Overrides:
terminateDoubleDouble in class Aggregator
Returns:
The product, as a DoubleDouble, or 1 if no values have been accumulated.
Since:
0.4.0
See Also:
DoubleDouble


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