com.sun.faban.driver.util
Class PairwiseAggregator<T extends PairwiseAggregator.Aggregable<T>>

java.lang.Object
  extended by com.sun.faban.driver.util.PairwiseAggregator<T>

public class PairwiseAggregator<T extends PairwiseAggregator.Aggregable<T>>
extends Object

The PairwiseAggregator implements the pairwise algorithm discussed by Chan's paper at Updating Formulae and a Pairwise Algorithm for Computing Sample Variances

Author:
akara

Nested Class Summary
static interface PairwiseAggregator.Aggregable<T>
          Interface to an aggregable object.
static interface PairwiseAggregator.Provider<T extends PairwiseAggregator.Aggregable<T>>
          Provider interface to provide objects to aggregate.
 
Constructor Summary
PairwiseAggregator(int nodeCount, PairwiseAggregator.Provider<T> provider)
          Creates a PairwiseAggregator.
 
Method Summary
 T collectStats()
          Uses the pairwise algorithm to aggregate all the metrices together.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PairwiseAggregator

public PairwiseAggregator(int nodeCount,
                          PairwiseAggregator.Provider<T> provider)
Creates a PairwiseAggregator.

Parameters:
nodeCount - The number of objects to aggregate
provider - The object provider for aggregation
Method Detail

collectStats

public T collectStats()
Uses the pairwise algorithm to aggregate all the metrices together. This is to minimize floating point error and get mathematically stable results. It also minimizes memory use for a pairwise algorithm.

Returns:
The aggregated metric