Package org.n52.janmayen
Interface IntervalMap<K,V>
-
- Type Parameters:
K- the key typeV- the value type
- All Known Implementing Classes:
IntervalTree
public interface IntervalMap<K,V>A map that uses intervals (specified as an upper and lower bound) as keys.
-
-
Field Summary
Fields Modifier and Type Field Description static IntervalMapEMPTY
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static <K,V>
IntervalMap<K,V>empty()default Optional<V>get(K key)Get the value of the first interval matching the supplied key.Optional<V>get(K lower, K upper)Get the first value falling into the interval.default VgetOrDefault(K lower, K upper, V value)Get the first value falling into the interval or the supplied default.default VgetOrDefault(K key, V value)Get the first value for the specified key or the supplied default.default Set<V>search(K key)Get the values for all intervals matching the supplied key.Set<V>search(K lower, K upper)Get all values falling into the specified interval.static <K,V>
IntervalMap<K,V>universal(V value)Creates aIntervalMapthat returns the same value for each key.
-
-
-
Field Detail
-
EMPTY
static final IntervalMap EMPTY
-
-
Method Detail
-
get
default Optional<V> get(K key)
Get the value of the first interval matching the supplied key.- Parameters:
key- the key- Returns:
- the value
-
get
Optional<V> get(K lower, K upper)
Get the first value falling into the interval.- Parameters:
lower- the lower boundupper- the upper bound- Returns:
- the value
-
getOrDefault
default V getOrDefault(K key, V value)
Get the first value for the specified key or the supplied default.- Parameters:
key- the keyvalue- the default value- Returns:
- the value
-
getOrDefault
default V getOrDefault(K lower, K upper, V value)
Get the first value falling into the interval or the supplied default.- Parameters:
lower- the lower boundupper- the upper boundvalue- the default value- Returns:
- the value
-
search
default Set<V> search(K key)
Get the values for all intervals matching the supplied key.- Parameters:
key- the key- Returns:
- the values
-
search
Set<V> search(K lower, K upper)
Get all values falling into the specified interval.- Parameters:
lower- the upper boundupper- the lower bound- Returns:
- the values
-
universal
static <K,V> IntervalMap<K,V> universal(V value)
Creates aIntervalMapthat returns the same value for each key.- Type Parameters:
K- the key typeV- the value type- Parameters:
value- the value- Returns:
- the
IntervalMap
-
empty
static <K,V> IntervalMap<K,V> empty()
-
-