Class Quantiles.ScaleAndIndex

  • Enclosing class:
    Quantiles

    public static final class Quantiles.ScaleAndIndex
    extends java.lang.Object
    Describes the point in a fluent API chain where the scale and a single quantile index (i.e. the q and the k in the kth q-quantile) have been specified.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int index  
      private int scale  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private ScaleAndIndex​(int scale, int index)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double compute​(double... dataset)
      Computes the quantile value of the given dataset.
      double compute​(int... dataset)
      Computes the quantile value of the given dataset.
      double compute​(long... dataset)
      Computes the quantile value of the given dataset.
      double compute​(java.util.Collection<? extends java.lang.Number> dataset)
      Computes the quantile value of the given dataset.
      double computeInPlace​(double... dataset)
      Computes the quantile value of the given dataset, performing the computation in-place.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • scale

        private final int scale
      • index

        private final int index
    • Constructor Detail

      • ScaleAndIndex

        private ScaleAndIndex​(int scale,
                              int index)
    • Method Detail

      • compute

        public double compute​(java.util.Collection<? extends java.lang.Number> dataset)
        Computes the quantile value of the given dataset.
        Parameters:
        dataset - the dataset to do the calculation on, which must be non-empty, which will be cast to doubles (with any associated lost of precision), and which will not be mutated by this call (it is copied instead)
        Returns:
        the quantile value
      • compute

        public double compute​(double... dataset)
        Computes the quantile value of the given dataset.
        Parameters:
        dataset - the dataset to do the calculation on, which must be non-empty, which will not be mutated by this call (it is copied instead)
        Returns:
        the quantile value
      • compute

        public double compute​(long... dataset)
        Computes the quantile value of the given dataset.
        Parameters:
        dataset - the dataset to do the calculation on, which must be non-empty, which will be cast to doubles (with any associated lost of precision), and which will not be mutated by this call (it is copied instead)
        Returns:
        the quantile value
      • compute

        public double compute​(int... dataset)
        Computes the quantile value of the given dataset.
        Parameters:
        dataset - the dataset to do the calculation on, which must be non-empty, which will be cast to doubles, and which will not be mutated by this call (it is copied instead)
        Returns:
        the quantile value
      • computeInPlace

        public double computeInPlace​(double... dataset)
        Computes the quantile value of the given dataset, performing the computation in-place.
        Parameters:
        dataset - the dataset to do the calculation on, which must be non-empty, and which will be arbitrarily reordered by this method call
        Returns:
        an unmodifiable map of results: the keys will be the specified quantile indexes, and the values the corresponding quantile values