SumAggregator

A SumAggregator is an Aggregator that calculates the sum of numeric values, returning the sum as a Double. If no values were encountered, then the returned sum is zero. This Aggregator overrides the terminateDoubleDouble method, so that the sum is also available as a DoubleDouble. This allows the sum to be used by other Aggregators as a high-precision DoubleDouble.

Usage

Create and use a SumAggregator, with one of the following methods:

  • Aggregator agg = new SumAggregator("property");
  • Aggregator agg = Aggregator.getAggregator("Sum(property)");

The values returned by the property of the object must be numeric.

The sum is calculated as expected, by adding all values together.