K - the key typeV - the value typepublic class IntervalTree<K,V> extends Object implements IntervalMap<K,V>
IntervalMap.EMPTY| Constructor and Description |
|---|
IntervalTree()
Creates a new
IntervalTree that uses the natural order of the keys. |
IntervalTree(Comparator<? super K> comparator)
Creates a new
IntervalTree. |
| Modifier and Type | Method and Description |
|---|---|
void |
add(K min,
K max,
V value)
Adds a new element to the interval tree
|
void |
add(K key,
V value)
Adds a new element to the interval tree
|
Optional<V> |
get(K lower,
K upper)
Get the first value falling into the interval.
|
Set<V> |
search(K lower,
K upper)
Get all values falling into the specified interval.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitempty, get, getOrDefault, getOrDefault, search, universalpublic IntervalTree(Comparator<? super K> comparator)
IntervalTree.comparator - the comparator to compare keyspublic IntervalTree()
IntervalTree that uses the natural order of the keys.public void add(K min, K max, V value) throws IllegalArgumentException
min - the lower bound of the intervalmax - the upper bound of the intervalvalue - the associated valueIllegalArgumentException - if min > maxpublic void add(K key, V value)
key - the lower and upper bound of the intervalvalue - the associated valuepublic Set<V> search(K lower, K upper)
IntervalMapsearch in interface IntervalMap<K,V>lower - the upper boundupper - the lower boundpublic Optional<V> get(K lower, K upper)
IntervalMapget in interface IntervalMap<K,V>lower - the lower boundupper - the upper boundCopyright © 2015–2021 52North Initiative for Geospatial Open Source Software GmbH. All rights reserved.