/** * {@inheritDoc} */ @Override protected boolean update(Double sample) { if (isAccepted(sample)) { if (getNumAccepted() == 0) { min = max = sample; } else { if (sample > max) { max = sample; } if (sample < min) { min = sample; } } return true; } return false; }
/** * {@inheritDoc} */ public Double get(Statistic stat) { if (getNumAccepted() == 0) { return Double.NaN; } switch (stat) { case MAX: return max; case MIN: return min; case RANGE: return max - min; default: throw new IllegalArgumentException(stat + " not supported by " + getClass().getName()); } }