Class Histogram.ConstantBinScheme

  • All Implemented Interfaces:
    Histogram.BinScheme
    Enclosing class:
    Histogram

    public static class Histogram.ConstantBinScheme
    extends Object
    implements Histogram.BinScheme
    A scheme for calculating the bins where the width of each bin is a constant determined by the range of values and the number of bins.
    • Constructor Detail

      • ConstantBinScheme

        public ConstantBinScheme​(int bins,
                                 double min,
                                 double max)
        Create a bin scheme with the specified number of bins that all have the same width.
        Parameters:
        bins - the number of bins; must be at least 2
        min - the minimum value to be counted in the bins
        max - the maximum value to be counted in the bins
    • Method Detail

      • toBin

        public int toBin​(double x)
        Description copied from interface: Histogram.BinScheme
        Determine the 0-based bin number in which the supplied value should be placed.
        Specified by:
        toBin in interface Histogram.BinScheme
        Parameters:
        x - the value
        Returns:
        the 0-based index of the bin