K - the type of the interval (must implement Interval).V - the type of the values to store.public final class NestedIntervalMap<K extends Interval<K>,V> extends Object implements IntervalMap<K,V>
| Modifier and Type | Class and Description |
|---|---|
static class |
NestedIntervalMap.Key<K extends Interval<K>> |
| Constructor and Description |
|---|
NestedIntervalMap()
Construct an empty
NestedIntervalMap. |
NestedIntervalMap(NestedIntervalMap<K,V> source)
Construct a new
NestedIntervalMap with (key, values) of
source copied. |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clears all values from the map.
|
boolean |
equals(Object obj) |
List<V> |
findAllLessSpecific(K key)
Finds all values that are associated to intervals that contain
key but are not equal to key. |
List<V> |
findAllMoreSpecific(K key)
Finds all values associated with intervals that are contained within
(more specific than)
key, but not equal to key. |
List<V> |
findExact(K key)
Finds the value associated with
key, if it exists. |
List<V> |
findExactAndAllLessSpecific(K key)
Finds all values that are associated to intervals that contain
key. |
List<V> |
findExactAndAllMoreSpecific(K key)
Finds all values associated with intervals that are equal to
key or contained within (more specific than)
key. |
List<V> |
findExactOrFirstLessSpecific(K key)
Finds the value associated with
key, or its closest
enclosing if key is not contained in this map, if it exists. |
List<V> |
findFirstLessSpecific(K key)
Finds the value associated with closest interval that contains
key but is not equal to key. |
List<V> |
findFirstMoreSpecific(K key)
Finds all values associated with intervals that are more specific
(contained in)
key, but excluding the values that are nested
inside the matching intervals. |
int |
hashCode() |
V |
put(K key,
V value)
Associates the specified value with the specified key in this map If the
map previously contained a mapping for the key, the old value is replaced
by the specified value.
|
V |
remove(K key)
Removes the mapping for a key from this map if it is present.
|
void |
remove(K key,
V value)
Removes the mapping for a key and value from this map if both are present.
|
String |
toString() |
public NestedIntervalMap()
NestedIntervalMap.public NestedIntervalMap(NestedIntervalMap<K,V> source)
NestedIntervalMap with (key, values) of
source copied.source - the source to copy.public V put(K key, V value)
IntervalMappublic V remove(K key)
IntervalMappublic void remove(K key, V value)
IntervalMappublic List<V> findFirstLessSpecific(K key)
IntervalMapkey but is not equal to key.findFirstLessSpecific in interface IntervalMap<K extends Interval<K>,V>key - the key to find the closest enclosing interval forkey, or an empty list if no such mapping exists.public List<V> findAllLessSpecific(K key)
IntervalMapkey but are not equal to key.
The resulting values are ordered from least specific interval to most
specific interval.findAllLessSpecific in interface IntervalMap<K extends Interval<K>,V>key - the key to find all containing intervals forkey but is not equal to
key.public List<V> findExactAndAllLessSpecific(K key)
IntervalMapkey.
The resulting values are ordered from least specific interval to most
specific interval. So if a mapping for key exists the last
element of the returned list will contain the value associated with
key.findExactAndAllLessSpecific in interface IntervalMap<K extends Interval<K>,V>key - the key to find all containing intervals forkeypublic List<V> findExact(K key)
IntervalMapkey, if it exists.public List<V> findExactOrFirstLessSpecific(K key)
IntervalMapkey, or its closest
enclosing if key is not contained in this map, if it exists.findExactOrFirstLessSpecific in interface IntervalMap<K extends Interval<K>,V>key - the key to find the mapping forkey or its closest
containing interval, or an empty list if no such value existspublic List<V> findFirstMoreSpecific(K key)
IntervalMapkey, but excluding the values that are nested
inside the matching intervals.
The resulting values are ordered from least specific interval to most
specific interval.findFirstMoreSpecific in interface IntervalMap<K extends Interval<K>,V>key - the key to find the first level more specific values forpublic List<V> findAllMoreSpecific(K key)
IntervalMapkey, but not equal to key.
The resulting values are ordered from least specific interval to most
specific interval.findAllMoreSpecific in interface IntervalMap<K extends Interval<K>,V>key - the key to find all levels more specific values forpublic List<V> findExactAndAllMoreSpecific(K key)
IntervalMapkey or contained within (more specific than)
key.
The resulting values are ordered from least specific interval to most
specific interval. So if a mapping for key exists the first
element of the returned list will contain the value associated with
key.findExactAndAllMoreSpecific in interface IntervalMap<K extends Interval<K>,V>key - the key to find the exact and all levels more specific values
forpublic void clear()
Copyright © 2022. All rights reserved.