Class Bins


  • public class Bins
    extends Object
    Operations on bins.
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    • Constructor Detail

      • Bins

        public Bins()
    • Method Detail

      • binSizes

        public static <T> int[] binSizes​(List<Bin<T>> bins)
        Returns the size of the bins.
        Parameters:
        bins - the bins to obtain the size from
        Returns:
        the sizes
      • totalSize

        public static <T> int totalSize​(List<Bin<T>> bins)
        Returns the total size of all the bins.
        Parameters:
        bins - the bins to calculate the size for
        Returns:
        the size
      • useBinIndex

        public static <T> List<Bin<T>> useBinIndex​(List<Bin<T>> bins)
        Pushes the bin index into the binnable as value to use.
        Type Parameters:
        T - the payload type
        Parameters:
        bins - the bins to update
        Returns:
        the updated bins
      • flatten

        public static <T> List<Binnable<T>> flatten​(List<Bin<T>> bins)
        Flattens the bins back into a list of binnables in the order of the bins.
        Type Parameters:
        T - the payload type
        Parameters:
        bins - the bins to flatten
        Returns:
        the flattened list
      • binnableValues

        public static <T> List<double[]> binnableValues​(List<Bin<T>> bins)
        Collects the binnable values from each bin and returns them as array per bin.
        Type Parameters:
        T - the type of payload
        Parameters:
        bins - the bins to process
        Returns:
        the binnable values per bin
      • summarizeBinnableValues

        public static <T> double[] summarizeBinnableValues​(List<Bin<T>> bins,
                                                           Bins.SummaryType type,
                                                           double emptyBinValue)
        Collects the binnable values from each bin, summarizes them and then returns that per bin.
        Type Parameters:
        T - the type of payload
        Parameters:
        bins - the bins to process
        type - how to summarize the values
        emptyBinValue - the value to use for empty bins
        Returns:
        the summarized values per bin