Class Integer1dBinMapper<T extends IntegerType<T>>

  • All Implemented Interfaces:
    BinMapper1d<T>

    public class Integer1dBinMapper<T extends IntegerType<T>>
    extends java.lang.Object
    implements BinMapper1d<T>
    Maps integer values into a 1-d set of bins.
    Author:
    Barry DeZonia
    • Constructor Summary

      Constructors 
      Constructor Description
      Integer1dBinMapper​(long minVal, long numBins, boolean tailBins)
      Specify a mapping of integral data from a user defined range into a specified number of bins.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Integer1dBinMapper<T> copy()
      Returns a copy of this BinMapper1d<T>.
      long getBinCount()
      Returns the number of bins within this bin mapping distribution.
      void getCenterValue​(long binPos, T value)
      Gets the data value associated with the center of a bin.
      void getLowerBound​(long binPos, T value)
      Gets the data value associated with the left edge of a bin.
      void getUpperBound​(long binPos, T value)
      Gets the data value associated with the right edge of a bin.
      boolean hasTails()
      Returns true if this bin mapping has bins on the ends of the distribution that count out of bounds values.
      static <K extends IntegerType<K>>
      HistogramNd<K>
      histogramNd​(long[] minVals, long[] numBins, boolean[] tailBins)
      This is a convenience method for creating a HistogramNd from inputs that describe a set of integer 1-d based bin mappers.
      boolean includesLowerBound​(long binPos)
      Returns true if values matching the left edge data value for a given bin are counted in the distribution.
      boolean includesUpperBound​(long binPos)
      Returns true if values matching the right edge data value for a given bin are counted in the distribution.
      long map​(T value)
      Converts a data value to a long index within the bin distribution.
      • Methods inherited from class java.lang.Object

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

      • Integer1dBinMapper

        public Integer1dBinMapper​(long minVal,
                                  long numBins,
                                  boolean tailBins)
        Specify a mapping of integral data from a user defined range into a specified number of bins. If tailBins is true then there will be two bins that count values outside the user specified ranges. If false then values outside the range fail to map to any bin.
        Parameters:
        minVal - The first data value of interest.
        numBins - The total number of bins to create.
        tailBins - A boolean specifying whether to have a bin in each tail to count values outside the user defined range.
    • Method Detail

      • getBinCount

        public long getBinCount()
        Description copied from interface: BinMapper1d
        Returns the number of bins within this bin mapping distribution.
        Specified by:
        getBinCount in interface BinMapper1d<T extends IntegerType<T>>
      • map

        public long map​(T value)
        Description copied from interface: BinMapper1d
        Converts a data value to a long index within the bin distribution.
        Specified by:
        map in interface BinMapper1d<T extends IntegerType<T>>
      • getCenterValue

        public void getCenterValue​(long binPos,
                                   T value)
        Description copied from interface: BinMapper1d
        Gets the data value associated with the center of a bin.
        Specified by:
        getCenterValue in interface BinMapper1d<T extends IntegerType<T>>
        value - Output to contain center data value
      • getLowerBound

        public void getLowerBound​(long binPos,
                                  T value)
        Description copied from interface: BinMapper1d
        Gets the data value associated with the left edge of a bin.
        Specified by:
        getLowerBound in interface BinMapper1d<T extends IntegerType<T>>
        Parameters:
        binPos - Bin number of interest
        value - Output to contain left edge data value
      • getUpperBound

        public void getUpperBound​(long binPos,
                                  T value)
        Description copied from interface: BinMapper1d
        Gets the data value associated with the right edge of a bin.
        Specified by:
        getUpperBound in interface BinMapper1d<T extends IntegerType<T>>
        Parameters:
        binPos - Bin number of interest
        value - Output to contain right edge data value
      • includesLowerBound

        public boolean includesLowerBound​(long binPos)
        Description copied from interface: BinMapper1d
        Returns true if values matching the left edge data value for a given bin are counted in the distribution. Basically is this bin interval closed on the left or not.
        Specified by:
        includesLowerBound in interface BinMapper1d<T extends IntegerType<T>>
        Parameters:
        binPos - Bin number of interest
      • includesUpperBound

        public boolean includesUpperBound​(long binPos)
        Description copied from interface: BinMapper1d
        Returns true if values matching the right edge data value for a given bin are counted in the distribution. Basically is this bin interval closed on the right or not.
        Specified by:
        includesUpperBound in interface BinMapper1d<T extends IntegerType<T>>
        Parameters:
        binPos - Bin number of interest
      • hasTails

        public boolean hasTails()
        Description copied from interface: BinMapper1d
        Returns true if this bin mapping has bins on the ends of the distribution that count out of bounds values.
        Specified by:
        hasTails in interface BinMapper1d<T extends IntegerType<T>>
      • histogramNd

        public static <K extends IntegerType<K>> HistogramNd<K> histogramNd​(long[] minVals,
                                                                            long[] numBins,
                                                                            boolean[] tailBins)
        This is a convenience method for creating a HistogramNd from inputs that describe a set of integer 1-d based bin mappers. The inputs should all have n entries for an n-d set of mappers.
        Parameters:
        minVals - The minimum bin values for each dimension
        numBins - The total bin count for each dimension
        tailBins - Flags per dimension for whether to include tail bins
        Returns:
        An unpopulated HistogramNd