public class IpTree<V> extends Object implements IntervalMap<IpInterval<?>,V>
NestedIntervalMap to allow for a protocol-independent tree.
Tests are omitted as this merely acts as a logic-less wrapper.| Modifier and Type | Field and Description |
|---|---|
protected NestedIntervalMap<Ipv4Interval,V> |
ipv4Tree |
protected NestedIntervalMap<Ipv6Interval,V> |
ipv6Tree |
| Constructor and Description |
|---|
IpTree() |
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
List<V> |
findAllLessSpecific(IpInterval<?> key)
Finds all values that are associated to intervals that contain
key but are not equal to key. |
List<V> |
findAllMoreSpecific(IpInterval<?> key)
Finds all values associated with intervals that are contained within
(more specific than)
key, but not equal to key. |
List<V> |
findExact(IpInterval<?> key)
Finds the value associated with
key, if it exists. |
List<V> |
findExactAndAllLessSpecific(IpInterval<?> key)
Finds all values that are associated to intervals that contain
key. |
List<V> |
findExactAndAllMoreSpecific(IpInterval<?> key)
Finds all values associated with intervals that are equal to
key or contained within (more specific than)
key. |
List<V> |
findExactOrFirstLessSpecific(IpInterval<?> 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(IpInterval<?> key)
Finds the value associated with closest interval that contains
key but is not equal to key. |
List<V> |
findFirstMoreSpecific(IpInterval<?> 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. |
V |
put(IpInterval<?> 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(IpInterval<?> key)
Removes the mapping for a key from this map if it is present.
|
void |
remove(IpInterval<?> key,
V value)
Removes the mapping for a key and value from this map if both are present.
|
String |
toString() |
protected NestedIntervalMap<Ipv4Interval,V> ipv4Tree
protected NestedIntervalMap<Ipv6Interval,V> ipv6Tree
public V put(IpInterval<?> key, V value)
IntervalMapput in interface IntervalMap<IpInterval<?>,V>key - key with which the specified value is to be associatedvalue - value to be associated with the specified keypublic V remove(IpInterval<?> key)
IntervalMapremove in interface IntervalMap<IpInterval<?>,V>key - key whose mapping is to be removed from the mappublic void remove(IpInterval<?> key, V value)
IntervalMapremove in interface IntervalMap<IpInterval<?>,V>key - key whose mapping is to be removed from the mapvalue - value with the key to be removed from the mappublic void clear()
clear in interface IntervalMap<IpInterval<?>,V>public List<V> findFirstLessSpecific(IpInterval<?> key)
IntervalMapkey but is not equal to key.findFirstLessSpecific in interface IntervalMap<IpInterval<?>,V>key - the key to find the closest enclosing interval forkey, or an empty list if no such mapping exists.public List<V> findExact(IpInterval<?> key)
IntervalMapkey, if it exists.findExact in interface IntervalMap<IpInterval<?>,V>key - the key to find the mapping forkey or an empty list if no
such value existspublic List<V> findExactOrFirstLessSpecific(IpInterval<?> key)
IntervalMapkey, or its closest
enclosing if key is not contained in this map, if it exists.findExactOrFirstLessSpecific in interface IntervalMap<IpInterval<?>,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> findAllLessSpecific(IpInterval<?> 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<IpInterval<?>,V>key - the key to find all containing intervals forkey but is not equal to
key.public List<V> findExactAndAllLessSpecific(IpInterval<?> 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<IpInterval<?>,V>key - the key to find all containing intervals forkeypublic List<V> findFirstMoreSpecific(IpInterval<?> 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<IpInterval<?>,V>key - the key to find the first level more specific values forpublic List<V> findAllMoreSpecific(IpInterval<?> key)
IntervalMapkey, but not equal to key.
The resulting values are ordered from least specific interval to most
specific interval.findAllMoreSpecific in interface IntervalMap<IpInterval<?>,V>key - the key to find all levels more specific values forpublic List<V> findExactAndAllMoreSpecific(IpInterval<?> 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<IpInterval<?>,V>key - the key to find the exact and all levels more specific values
forCopyright © 2022. All rights reserved.