Class ReservoirSampler


  • public class ReservoirSampler
    extends java.lang.Object
    Keeps the sample for percentile calculations.

    Please check this for more details

    Since:
    6.0
    Author:
    Roberto Palmieri, Diego Didona, Pedro Ruivo
    • Constructor Detail

      • ReservoirSampler

        public ReservoirSampler()
      • ReservoirSampler

        public ReservoirSampler​(int numSpots)
    • Method Detail

      • insertSample

        public final void insertSample​(double sample)
      • getKPercentile

        public final double getKPercentile​(int k)
                                    throws java.lang.IllegalArgumentException
        Parameters:
        k - the percentage of observations. Should be a value between 0 and 100 exclusively.
        Returns:
        the percentile value for the k% observations.
        Throws:
        java.lang.IllegalArgumentException - if k is not between 0 and 100 exclusively.
      • reset

        public final void reset()