public class DoubleMaps extends Object
Double
keys and/or values| Modifier and Type | Method and Description |
|---|---|
static <K> Map<K,Double> |
create(Collection<? extends K> keys,
DoubleUnaryOperator operator)
Create a map with the given keys, which are mapped to values that
are computed by applying the given operator to the range [0,1],
linearly interpolated for the given keys.
|
static <K> List<Map<K,Double>> |
create(Collection<? extends K> keys,
List<? extends DoubleUnaryOperator> operators)
Create maps with the given keys, which are mapped to values that
are computed by applying the given operators to the range [0,1],
linearly interpolated for the given keys.
|
static <K> Map<K,Double> |
create(Iterable<? extends K> keys,
double min,
double max,
Random random)
Create a map with the given keys, which are mapped to random values
in the specified range
|
static double |
getInterpolated(NavigableMap<Double,? extends Number> map,
double key)
Returns a linearly interpolated value from the given map.
|
static <K> Map<K,Double> |
scaleValuesToRange(Map<K,? extends Number> map,
double targetMin,
double targetMax)
Scale the values in the given map to be in the specified range.
|
static <K> Map<K,Double> |
scaleValuesToRange(Map<K,? extends Number> map,
double targetMin,
double targetMax,
double epsilon,
double defaultValue)
Scale the values in the given map to be in the specified range.
|
static <K> Map<K,Double> |
transformValues(Map<K,? extends Number> map,
DoubleUnaryOperator op)
Returns a new map that contains the same keys as the given one,
but has its values transformed with the given operator.
|
public static <K> Map<K,Double> create(Iterable<? extends K> keys, double min, double max, Random random)
K - The key typekeys - The keysmin - The minimum valuemax - The maximum valuerandom - The random number generatorpublic static <K> List<Map<K,Double>> create(Collection<? extends K> keys, List<? extends DoubleUnaryOperator> operators)
K - The key typekeys - The keysoperators - The operatorspublic static <K> Map<K,Double> create(Collection<? extends K> keys, DoubleUnaryOperator operator)
K - The key typekeys - The keysoperator - The operatorpublic static <K> Map<K,Double> scaleValuesToRange(Map<K,? extends Number> map, double targetMin, double targetMax)
K - The key typemap - The maptargetMin - The target minimumtargetMax - The target maximumpublic static <K> Map<K,Double> scaleValuesToRange(Map<K,? extends Number> map, double targetMin, double targetMax, double epsilon, double defaultValue)
K - The key typemap - The maptargetMin - The target minimumtargetMax - The target maximumepsilon - The epsilondefaultValue - The default valuepublic static <K> Map<K,Double> transformValues(Map<K,? extends Number> map, DoubleUnaryOperator op)
null, then the value in the
result will also be null.K - The key typemap - The mapop - The operatorpublic static double getInterpolated(NavigableMap<Double,? extends Number> map, double key)
map - The mapkey - The keyIllegalArgumentException - If the given map is emptyCopyright © 2020. All rights reserved.