Package edu.wpi.first.math.interpolation
Class InterpolatingTreeMap<K,V>
java.lang.Object
edu.wpi.first.math.interpolation.InterpolatingTreeMap<K,V>
- Type Parameters:
K
- The type of keys held in this map.V
- The type of values held in this map.
- Direct Known Subclasses:
InterpolatingDoubleTreeMap
public class InterpolatingTreeMap<K,V> extends Object
Interpolating Tree Maps are used to get values at points that are not defined by making a guess
from points that are defined. This uses linear interpolation.
K
must implement Comparable
, or a Comparator
on K
can be
provided.
-
Constructor Summary
Constructors Constructor Description InterpolatingTreeMap(InverseInterpolator<K> inverseInterpolator, Interpolator<V> interpolator)
Constructs an InterpolatingTreeMap.InterpolatingTreeMap(InverseInterpolator<K> inverseInterpolator, Interpolator<V> interpolator, Comparator<K> comparator)
Constructs an InterpolatingTreeMap usingcomparator
. -
Method Summary
-
Constructor Details
-
InterpolatingTreeMap
public InterpolatingTreeMap(InverseInterpolator<K> inverseInterpolator, Interpolator<V> interpolator)Constructs an InterpolatingTreeMap.- Parameters:
inverseInterpolator
- Function to use for inverse interpolation of the keys.interpolator
- Function to use for interpolation of the values.
-
InterpolatingTreeMap
public InterpolatingTreeMap(InverseInterpolator<K> inverseInterpolator, Interpolator<V> interpolator, Comparator<K> comparator)Constructs an InterpolatingTreeMap usingcomparator
.- Parameters:
inverseInterpolator
- Function to use for inverse interpolation of the keys.interpolator
- Function to use for interpolation of the values.comparator
- Comparator to use on keys.
-
-
Method Details
-
put
Inserts a key-value pair.- Parameters:
key
- The key.value
- The value.
-
get
Returns the value associated with a given key.If there's no matching key, the value returned will be an interpolation between the keys before and after the provided one, using the
Interpolator
andInverseInterpolator
provided.- Parameters:
key
- The key.- Returns:
- The value associated with the given key.
-
clear
Clears the contents.
-