Built-In Aggregators

The jagg package contains the “Aggregations”, “Aggregator”, and “AggregateValue” classes, plus many built-in Aggregators. The developer should reference Aggregators in their aggregator specification strings without the “Aggregator” suffix, e.g. “Avg(property)”.

Here is a list of the 20 built-in Aggregators:

  • AvgAggregator – Determines the average of numeric values, e.g. “Avg(testResult)”. The aggregate value returned is a Double.
  • CollectAggregator - Collects all values and places them into a List, e.g. "Collect(item)". The aggregate value returned is a List.
  • ConcatAggregator – Performs a concatenation of the values of a property, with an optional separator String, e.g. “Concat(testResult)” or “Concat(testResult, \”|\”)”. The specified property should return something with a well-defined “toString” method. The aggregate value returned is a String.
  • CorrelationAggregator – Performs an analysis of how well two numeric properties are correlated, ranging from -1 (perfectly anti-correlated) to 0 (uncorrelated) to 1 (perfectly correlated), e.g. “Correlation(prop1, prop2)”. The aggregate value returned is a Double.
  • CountAggregator – Determines the count of all non-null occurrences of a property, or if the given property is “*” (pre-defined property CountAggregator.COUNT_ALL), a count of all records, regardless of the nullity of any property. The aggregate value returned is a Long.
  • CovarianceAggregator – Determines the sample covariance of two numeric properties, e.g. “Covariance(prop1, prop2)”. The aggregate value returned is a Double.
  • CovariancePopAggregator – Determines the population covariance of two numeric properties, e.g. “CovariancePop(prop1, prop2)”. The aggregate value returned is a Double.
  • GeometricMeanAggregator – Determine the geometric mean of a numeric property, e.g. “GeometricMean(testResult)”. The aggregate value returned is a Double.
  • HarmonicMeanAggregator – Determine the harmonic mean of a numeric property, e.g. “HarmonicMean(testResult)”. The aggregate value returned is a Double.
  • LinearRegressionAggregator – Performs a linear regression analysis on two numeric properties, e.g. “LinearRegression(prop1, prop2)”. The aggregate value returned is a LinearRegressionStats, which contains linear regression-related calculations, including the slope and y-intercept of the best-fit line and other linear regression-related stats.
  • MaxAggregator – Determines the maximum value of a property that is Comparable, e.g. “Max(testResult)”. The aggregate value returned is a Comparable.
  • MinAggregator – Determines the minimum value of a property that is Comparable, e.g. “Min(testResult)”. The aggregate value returned is a Comparable.
  • ModeAggregator - Determines the statistical mode of a property that is Comparable, e.g. "Mode(testResult)". The aggregate value returned is a Comparable.
  • PercentileAggregator – Determines the xth percentile (in decimal form) of a numeric property, e.g. for median, “Percentile(0.5, testResult)”. The aggregate value returned is a Double.
  • ProductAggregator – Determines the product of numeric values of a property, e.g. “Product(testResult)”. The aggregate value returned is a Double.
  • StdDevAggregator – Determines the sample standard deviation of a numeric property, e.g. “StdDev(testResult)”. The aggregate value returned is a Double.
  • StdDevPopAggregator – Determines the population standard deviation of a numeric property, e.g. “StdDevPop(testResult)”. The aggregate value returned is a Double.
  • SumAggregator – Determines the sum of numeric values of a property, e.g. “Sum(testResult)”. The aggregate value returned is a Double.
  • VarianceAggregator – Determines the sample variance of a numeric property, e.g. “Variance(testResult)”. The aggregate value returned is a Double.
  • VariancePopAggregator – Determines the population variance of a numeric property, e.g. “VariancePop(testResult)”. The aggregate value returned is a Double.

Multiple Properties

Some Aggregators work on more than one property of an Object. The abstract classes "TwoPropAggregator" and "MultiPropAggregator" support this need. They support two properties and many properties, respectively.

The following built-in Aggregators are also TwoPropAggregators:

  • CorrelationAggregator
  • CovarianceAggregator
  • CovariancePopAggregator
  • LinearRegressionAggregator
  • PercentileAggregator

No built-in Aggregators are also MultiPropAggregators.

The rest of the built-in Aggregators subclass Aggregator directly.