Class AbstractPatriciaTrie.PrefixRangeMap
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- org.apache.commons.collections4.trie.AbstractPatriciaTrie.RangeMap
-
- org.apache.commons.collections4.trie.AbstractPatriciaTrie.PrefixRangeMap
-
- All Implemented Interfaces:
java.util.Map<K,V>
,java.util.SortedMap<K,V>
- Enclosing class:
- AbstractPatriciaTrie<K,V>
private class AbstractPatriciaTrie.PrefixRangeMap extends AbstractPatriciaTrie.RangeMap
A submap used for prefix views over theTrie
.
-
-
Field Summary
Fields Modifier and Type Field Description private int
expectedModCount
private K
fromKey
private int
lengthInBits
private int
offsetInBits
private K
prefix
private int
size
private K
toKey
-
Constructor Summary
Constructors Modifier Constructor Description private
PrefixRangeMap(K prefix, int offsetInBits, int lengthInBits)
Creates aAbstractPatriciaTrie.PrefixRangeMap
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
protected java.util.Set<java.util.Map.Entry<K,V>>
createEntrySet()
Creates and returns anAbstractPatriciaTrie.RangeMap.entrySet()
view of theAbstractPatriciaTrie.RangeMap
.protected java.util.SortedMap<K,V>
createRangeMap(K fromKey, boolean fromInclusive, K toKey, boolean toInclusive)
Creates and returns a sub-range view of the currentAbstractPatriciaTrie.RangeMap
.K
firstKey()
private int
fixup()
This method does two things.K
getFromKey()
Returns the FROM Key.K
getToKey()
Returns the TO Key.protected boolean
inFromRange(K key, boolean forceInclusive)
Returns true if the provided Key is in the FROM range of theAbstractPatriciaTrie.PrefixRangeMap
.protected boolean
inRange(K key)
Returns true if thisAbstractPatriciaTrie.PrefixRangeMap
's key is a prefix of the provided key.protected boolean
inRange2(K key)
Same asinRange(Object)
.protected boolean
inToRange(K key, boolean forceInclusive)
Returns true if the provided Key is in the TO range of theAbstractPatriciaTrie.PrefixRangeMap
.boolean
isFromInclusive()
Whether or not theAbstractPatriciaTrie.RangeMap.getFromKey()
is in the range.boolean
isToInclusive()
Whether or not theAbstractPatriciaTrie.RangeMap.getToKey()
is in the range.K
lastKey()
-
Methods inherited from class org.apache.commons.collections4.trie.AbstractPatriciaTrie.RangeMap
comparator, containsKey, entrySet, get, headMap, put, remove, subMap, tailMap
-
Methods inherited from class java.util.AbstractMap
clone, containsValue, equals, hashCode, isEmpty, keySet, putAll, size, toString, values
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
-
-
-
Constructor Detail
-
PrefixRangeMap
private PrefixRangeMap(K prefix, int offsetInBits, int lengthInBits)
Creates aAbstractPatriciaTrie.PrefixRangeMap
.
-
-
Method Detail
-
fixup
private int fixup()
This method does two things. It determines the FROM and TO range of theAbstractPatriciaTrie.PrefixRangeMap
and the number of elements in the range. This method must be called every time theTrie
has changed.
-
firstKey
public K firstKey()
-
lastKey
public K lastKey()
-
inRange
protected boolean inRange(K key)
Returns true if thisAbstractPatriciaTrie.PrefixRangeMap
's key is a prefix of the provided key.- Overrides:
inRange
in classAbstractPatriciaTrie.RangeMap
-
inRange2
protected boolean inRange2(K key)
Same asinRange(Object)
.- Overrides:
inRange2
in classAbstractPatriciaTrie.RangeMap
-
inFromRange
protected boolean inFromRange(K key, boolean forceInclusive)
Returns true if the provided Key is in the FROM range of theAbstractPatriciaTrie.PrefixRangeMap
.- Overrides:
inFromRange
in classAbstractPatriciaTrie.RangeMap
-
inToRange
protected boolean inToRange(K key, boolean forceInclusive)
Returns true if the provided Key is in the TO range of theAbstractPatriciaTrie.PrefixRangeMap
.- Overrides:
inToRange
in classAbstractPatriciaTrie.RangeMap
-
createEntrySet
protected java.util.Set<java.util.Map.Entry<K,V>> createEntrySet()
Description copied from class:AbstractPatriciaTrie.RangeMap
Creates and returns anAbstractPatriciaTrie.RangeMap.entrySet()
view of theAbstractPatriciaTrie.RangeMap
.- Specified by:
createEntrySet
in classAbstractPatriciaTrie.RangeMap
-
getFromKey
public K getFromKey()
Description copied from class:AbstractPatriciaTrie.RangeMap
Returns the FROM Key.- Specified by:
getFromKey
in classAbstractPatriciaTrie.RangeMap
-
getToKey
public K getToKey()
Description copied from class:AbstractPatriciaTrie.RangeMap
Returns the TO Key.- Specified by:
getToKey
in classAbstractPatriciaTrie.RangeMap
-
isFromInclusive
public boolean isFromInclusive()
Description copied from class:AbstractPatriciaTrie.RangeMap
Whether or not theAbstractPatriciaTrie.RangeMap.getFromKey()
is in the range.- Specified by:
isFromInclusive
in classAbstractPatriciaTrie.RangeMap
-
isToInclusive
public boolean isToInclusive()
Description copied from class:AbstractPatriciaTrie.RangeMap
Whether or not theAbstractPatriciaTrie.RangeMap.getToKey()
is in the range.- Specified by:
isToInclusive
in classAbstractPatriciaTrie.RangeMap
-
createRangeMap
protected java.util.SortedMap<K,V> createRangeMap(K fromKey, boolean fromInclusive, K toKey, boolean toInclusive)
Description copied from class:AbstractPatriciaTrie.RangeMap
Creates and returns a sub-range view of the currentAbstractPatriciaTrie.RangeMap
.- Specified by:
createRangeMap
in classAbstractPatriciaTrie.RangeMap
-
-