T - object typepublic class Bins<T> extends Object
| Constructor and Description |
|---|
Bins(int n)
Constructs an empty bin of valued items.
|
Bins(int n,
Map<Double,T> items)
Constructs a bin with valued items.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(double key,
T item)
Add a valued item to the bin.
|
double[] |
getBinKeyValues(RealScalarFunction f)
Applies a function to the key of each bin.
|
double[] |
getBinObjectValues(Function<List<T>,Double> f)
Applies a function to the items of each bin.
|
List<TreeMap<Double,T>> |
getBins()
Divides the items into
n bins. |
int |
maxBinSize()
Gets the maximal size of the bins.
|
public Bins(int n)
n - the number of binspublic void add(double key,
T item)
key - the valueitem - the itempublic List<TreeMap<Double,T>> getBins()
n bins. If the total cannot be evenly
divided, the last bin may be not fully filled. If the n-th bin is
empty, only n - 1 bins are returned.public double[] getBinKeyValues(RealScalarFunction f)
f - a function to be applied on the keyspublic double[] getBinObjectValues(Function<List<T>,Double> f)
f - a function to be applied on the itemspublic int maxBinSize()
Copyright © 2010-2020 NM FinTech Ltd.. All Rights Reserved.