Package adams.data.binning.operation
Class Bins
- java.lang.Object
-
- adams.data.binning.operation.Bins
-
public class Bins extends Object
Operations on bins.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Bins.SummaryType
Enumeration on how to summarize multiple binnable values.
-
Constructor Summary
Constructors Constructor Description Bins()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> List<double[]>
binnableValues(List<Bin<T>> bins)
Collects the binnable values from each bin and returns them as array per bin.static <T> int[]
binSizes(List<Bin<T>> bins)
Returns the size of the bins.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.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.static <T> int
totalSize(List<Bin<T>> bins)
Returns the total size of all the bins.static <T> List<Bin<T>>
useBinIndex(List<Bin<T>> bins)
Pushes the bin index into the binnable as value to use.
-
-
-
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 processtype
- how to summarize the valuesemptyBinValue
- the value to use for empty bins- Returns:
- the summarized values per bin
-
-