Class AbstractBitwiseTrie<K,​V>

  • Type Parameters:
    K - the type of the keys in this map
    V - the type of the values in this map
    All Implemented Interfaces:
    java.io.Serializable, java.util.Map<K,​V>, java.util.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 java.util.AbstractMap<K,​V>
    implements Trie<K,​V>, java.io.Serializable
    This class provides some basic Trie functionality and utility methods for actual bitwise Trie implementations.
    Since:
    4.0
    See Also:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      (package private) static class  AbstractBitwiseTrie.BasicEntry<K,​V>
      A basic implementation of Map.Entry.
      • Nested classes/interfaces inherited from class java.util.AbstractMap

        java.util.AbstractMap.SimpleEntry<K extends java.lang.Object,​V extends java.lang.Object>, java.util.AbstractMap.SimpleImmutableEntry<K extends java.lang.Object,​V extends java.lang.Object>
      • Nested classes/interfaces inherited from interface java.util.Map

        java.util.Map.Entry<K extends java.lang.Object,​V extends java.lang.Object>
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) int bitIndex​(K key, K foundKey)
      (package private) int bitsPerElement()
      Returns the number of bits per element in the key
      (package private) K castKey​(java.lang.Object key)
      A utility method to cast keys.
      (package private) static boolean compare​(java.lang.Object a, java.lang.Object b)
      Returns true if both values are either null or equal.
      (package private) boolean compareKeys​(K key, K other)
      An utility method for calling KeyAnalyzer.compare(Object, Object)
      protected KeyAnalyzer<? super K> getKeyAnalyzer()
      Returns the KeyAnalyzer that constructed the Trie.
      (package private) 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.
      (package private) int lengthInBits​(K key)
      Returns the length of the given key in bits
      java.lang.String toString()  
      • 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 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.Put

        clear, put, putAll
      • Methods inherited from interface java.util.SortedMap

        comparator, entrySet, firstKey, headMap, keySet, lastKey, subMap, tailMap, values
      • Methods inherited from interface org.apache.commons.collections4.Trie

        prefixMap
    • Constructor Detail

      • AbstractBitwiseTrie

        protected AbstractBitwiseTrie​(KeyAnalyzer<? super K> keyAnalyzer)
        Constructs a new Trie using the given KeyAnalyzer.
        Parameters:
        keyAnalyzer - the KeyAnalyzer to use
    • Method Detail

      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.util.AbstractMap<K,​V>
      • castKey

        final K castKey​(java.lang.Object key)
        A utility method to cast keys. It actually doesn't cast anything. It's just fooling the compiler!
      • 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)
      • compare

        static boolean compare​(java.lang.Object a,
                               java.lang.Object b)
        Returns true if both values are either null or equal.