PercentileDef(String name, Source source, double percentile, boolean ignorenan) { super(name); m_percentile = percentile; m_ignorenan = ignorenan; m_source = source; //The best we can do at this point; until this object has it's value realized over a // particular time period (with calculate()), there's not much else to do this.setValue(Double.NaN); }
/** * Realize the calculation of this definition, over the given time period * * @param tStart the time period start * @param tEnd the time period end * @throws RrdException Thrown if we cannot get a percentile value for the time period. */ public void calculate(long tStart, long tEnd) throws RrdException { if(m_source != null) { this.setValue(m_source.getPercentile(tStart, tEnd, m_percentile)); } }
@Override void setTimestamps(long[] timestamps) { super.setTimestamps(timestamps); //And now also call setValue with the current value, to sort out "values" setValue(m_value); }