K - the key typeV - the value typepublic class IntervalTree<K,V> extends java.lang.Object implements IntervalMap<K,V>
IntervalMap.EMPTY| Constructor and Description |
|---|
IntervalTree()
Creates a new
IntervalTree that uses the natural order of the keys. |
IntervalTree(java.util.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
|
java.util.Optional<V> |
get(K lower,
K upper)
Get the first value falling into the interval.
|
java.util.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(java.util.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 java.lang.IllegalArgumentException
min - the lower bound of the intervalmax - the upper bound of the intervalvalue - the associated valuejava.lang.IllegalArgumentException - if min > maxpublic void add(K key, V value)
key - the lower and upper bound of the intervalvalue - the associated valuepublic java.util.Set<V> search(K lower, K upper)
IntervalMapsearch in interface IntervalMap<K,V>lower - the upper boundupper - the lower boundpublic java.util.Optional<V> get(K lower, K upper)
IntervalMapget in interface IntervalMap<K,V>lower - the lower boundupper - the upper boundCopyright © 2015–2018 52°North Initiative for Geospatial Open Source Software GmbH. All rights reserved.