1 package org.djutils.stats.summarizers.quantileaccumulator;
2
3 import org.djutils.stats.summarizers.Tally;
4
5 /**
6 * Interface for quantile accumulator.
7 * <br>
8 * @author <a href="https://www.tudelft.nl/staff/p.knoppers/">Peter Knoppers</a>
9 */
10 public interface QuantileAccumulator
11 {
12 /**
13 * Ingest one value with weight 1. Should be called only from the Tally object and AFTER processing the value in the tally.
14 * @param value double; the value
15 * @return double; the ingested value
16 * @throws IllegalArgumentException when the ingested value is NaN
17 */
18 double ingest(double value);
19
20 /**
21 * Compute (or approximate) the value that corresponds to the given fraction (percentile).
22 * @param tally Tally; the tally object that accumulates mean, minimum, maximum, count, etc.
23 * @param probability double; value between 0.0 and 1.0 (both inclusive)
24 * @return double; the computed or approximated quantile value
25 * @throws IllegalArgumentException when the probability is less than 0 or larger than 1
26 * @throws NullPointerException when tally is null
27 */
28 double getQuantile(Tally tally, double probability);
29
30 /**
31 * Reset (clear all accumulated information).
32 */
33 void initialize();
34
35 }