Class AbstractBitwiseTrie<K,V>
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- org.apache.commons.collections4.trie.AbstractBitwiseTrie<K,V>
-
- Type Parameters:
K- the type of the keys in this mapV- the type of the values in this map
- All Implemented Interfaces:
Serializable,Map<K,V>,SortedMap<K,V>,Get<K,V>,IterableGet<K,V>,IterableMap<K,V>,IterableSortedMap<K,V>,OrderedMap<K,V>,Put<K,V>,Trie<K,V>
- Direct Known Subclasses:
AbstractPatriciaTrie
public abstract class AbstractBitwiseTrie<K,V> extends AbstractMap<K,V> implements Trie<K,V>, Serializable
This class provides some basicTriefunctionality and utility methods for actual bitwiseTrieimplementations.- Since:
- 4.0
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classAbstractBitwiseTrie.BasicEntry<K,V>A basic implementation ofMap.Entry.-
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object>
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractBitwiseTrie(KeyAnalyzer<? super K> keyAnalyzer)Constructs a newTrieusing the givenKeyAnalyzer.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) intbitIndex(K key, K foundKey)Utility method for callingKeyAnalyzer.bitIndex(Object, int, int, Object, int, int).(package private) intbitsPerElement()Returns the number of bits per element in the key(package private) KcastKey(Object key)A utility method to cast keys.(package private) static booleancompare(Object a, Object b)Returns true if both values are either null or equal.(package private) booleancompareKeys(K key, K other)An utility method for callingKeyAnalyzer.compare(Object, Object)protected KeyAnalyzer<? super K>getKeyAnalyzer()Returns theKeyAnalyzerthat constructed theTrie.(package private) booleanisBitSet(K key, int bitIndex, int lengthInBits)Returns whether or not the given bit on the key is set or false if the key is null.(package private) intlengthInBits(K key)Returns the length of the given key in bitsStringtoString()-
Methods inherited from class java.util.AbstractMap
clear, clone, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.commons.collections4.Get
containsKey, containsValue, entrySet, get, isEmpty, keySet, remove, size, values
-
Methods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, equals, forEach, get, getOrDefault, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size
-
Methods inherited from interface org.apache.commons.collections4.OrderedMap
firstKey, lastKey, mapIterator, nextKey, previousKey
-
-
-
-
Constructor Detail
-
AbstractBitwiseTrie
protected AbstractBitwiseTrie(KeyAnalyzer<? super K> keyAnalyzer)
Constructs a newTrieusing the givenKeyAnalyzer.- Parameters:
keyAnalyzer- theKeyAnalyzerto use
-
-
Method Detail
-
getKeyAnalyzer
protected KeyAnalyzer<? super K> getKeyAnalyzer()
Returns theKeyAnalyzerthat constructed theTrie.- Returns:
- the
KeyAnalyzerused by thisTrie
-
toString
public String toString()
- Overrides:
toStringin classAbstractMap<K,V>
-
castKey
final K castKey(Object key)
A utility method to cast keys. It actually doesn't cast anything. It's just fooling the compiler!
-
lengthInBits
final int lengthInBits(K key)
Returns the length of the given key in bits- See Also:
KeyAnalyzer.lengthInBits(Object)
-
bitsPerElement
final int bitsPerElement()
Returns the number of bits per element in the key- See Also:
KeyAnalyzer.bitsPerElement()
-
isBitSet
final boolean isBitSet(K key, int bitIndex, int lengthInBits)
Returns whether or not the given bit on the key is set or false if the key is null.- See Also:
KeyAnalyzer.isBitSet(Object, int, int)
-
bitIndex
final int bitIndex(K key, K foundKey)
Utility method for callingKeyAnalyzer.bitIndex(Object, int, int, Object, int, int).
-
compareKeys
final boolean compareKeys(K key, K other)
An utility method for callingKeyAnalyzer.compare(Object, Object)
-
-