@Override
public void apply(Builder result, Object measureFact) {
if (!(measureFact instanceof IrregularSample))
return; // we don't know how to sum anything else
IrregularSample sample = (IrregularSample) measureFact;
Object fact = sample.getFact();
if (!(fact instanceof Number))
return;
double x = ((Number) fact).doubleValue();
try {
OnlineCannyRateSummarizer s = super.extractState(result, sumBuf);
if (s == null) {
sumBuf.reset();
s = sumBuf;
}
s.update(x, sample.getTime());
super.saveState(result, sumBuf);
} catch (IOException exc) {
// should not happen .
// otherwise, probably a bad practice.