Class AbstractTrieSetMultimap<K,V,C extends Iterable<V>,R extends MultimapNode<K,V,C,R>>

java.lang.Object
io.usethesource.capsule.core.AbstractTrieSetMultimap<K,V,C,R>
All Implemented Interfaces:
SetMultimap<K,V>, Serializable
Direct Known Subclasses:
AbstractPersistentTrieSetMultimap, AbstractTransientTrieSetMultimap

public abstract class AbstractTrieSetMultimap<K,V,C extends Iterable<V>,R extends MultimapNode<K,V,C,R>> extends Object implements SetMultimap<K,V>, Serializable
See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • getRootNode

      abstract R getRootNode()
    • getCachedSize

      abstract int getCachedSize()
    • getCachedKeySetHashCode

      abstract int getCachedKeySetHashCode()
    • getCachedKeySetSize

      abstract int getCachedKeySetSize()
    • valueToTemporaryBox

      protected abstract Set.Immutable<V> valueToTemporaryBox(V value)
    • collectionToInternalFormat

      protected abstract C collectionToInternalFormat(Set.Immutable<V> valueCollection)
    • internalFormatToCollection

      protected abstract Set.Immutable<V> internalFormatToCollection(C values)
    • tupleHash

      private static final <K, V> int tupleHash(int keyHash, int valueHash)
    • tupleHash

      private static final <K, V> int tupleHash(int keyHash, V value)
    • tupleHash

      private static final <K, V> int tupleHash(K key, V value)
    • tupleHash

      private static final <K, V, C extends Collection<V>> int tupleHash(int keyHash, C values)
    • tupleHash

      private static final <K, V, C extends Collection<V>> int tupleHash(K key, C values)
    • transformHashCode

      public static final int transformHashCode(int hash)
    • hashCode

      protected static <K, V, C extends Iterable<V>, R extends MultimapNode<K, V, C, R>> int hashCode(R rootNode)
    • size

      protected static <K, V, C extends Iterable<V>, R extends MultimapNode<K, V, C, R>> int size(R rootNode)
    • keySetHashCode

      protected static <K, V, C extends Iterable<V>, R extends MultimapNode<K, V, C, R>> int keySetHashCode(R rootNode)
    • keySetSize

      protected static <K, V, C extends Iterable<V>, R extends MultimapNode<K, V, C, R>> int keySetSize(R rootNode)
    • checkHashCodeAndSize

      private static final <K, V> boolean checkHashCodeAndSize(int targetHash, int targetSize, Iterator<Map.Entry<K,V>> iterator)
    • checkKeySetHashCodeAndSize

      private static final <K> boolean checkKeySetHashCodeAndSize(int targetHash, int targetSize, Iterator<K> iterator)
    • nodeIterator

      protected Iterator<R> nodeIterator()
    • getNodeCount

      protected int getNodeCount()
    • containsKey

      public final boolean containsKey(Object o)
      Specified by:
      containsKey in interface SetMultimap<K,V>
    • containsValue

      public final boolean containsValue(Object o)
      Specified by:
      containsValue in interface SetMultimap<K,V>
    • containsEntry

      public final boolean containsEntry(Object o0, Object o1)
      Specified by:
      containsEntry in interface SetMultimap<K,V>
    • get

      public final Set.Immutable<V> get(Object o)
      Specified by:
      get in interface SetMultimap<K,V>
    • keyIterator

      public Iterator<K> keyIterator()
      Specified by:
      keyIterator in interface SetMultimap<K,V>
    • valueIterator

      public abstract Iterator<V> valueIterator()
      Specified by:
      valueIterator in interface SetMultimap<K,V>
    • valueIterator

      protected Iterator<V> valueIterator(Function<V,C> converter)
    • entryIterator

      public Iterator<Map.Entry<K,V>> entryIterator()
      Specified by:
      entryIterator in interface SetMultimap<K,V>
    • nativeEntryIterator

      public Iterator<Map.Entry<K,Object>> nativeEntryIterator()
      Description copied from interface: SetMultimap
      Iterates over the raw internal structure. Optional operation.
      Specified by:
      nativeEntryIterator in interface SetMultimap<K,V>
      Returns:
      native iterator, if supported
    • tupleIterator

      public <T> Iterator<T> tupleIterator(BiFunction<K,V,T> tupleOf)
      Specified by:
      tupleIterator in interface SetMultimap<K,V>
    • valueCollectionsSpliterator

      private Spliterator<C> valueCollectionsSpliterator(Function<V,C> converter)
    • valueCollectionsStream

      private Stream<C> valueCollectionsStream(Function<V,C> converter)
    • keySet

      public final Set<K> keySet()
      Specified by:
      keySet in interface SetMultimap<K,V>
    • values

      public final Collection<V> values()
      Specified by:
      values in interface SetMultimap<K,V>
    • entrySet

      public final Set<Map.Entry<K,V>> entrySet()
      Specified by:
      entrySet in interface SetMultimap<K,V>
    • hashCode

      public int hashCode()
      Description copied from interface: SetMultimap
      Returns the hash code for this multimap. The hash code is defined to equal the hash of a Set<Map.Entry<K,V>> view (rather than to equal the hash code of Map<K,Set<V>>).
      Specified by:
      hashCode in interface SetMultimap<K,V>
      Overrides:
      hashCode in class Object
      Returns:
      the hash code for this multimap
    • equals

      public boolean equals(Object other)
      Description copied from interface: SetMultimap
      Compares the specified object for equality against this multimap. The notion of equality is equal to the Set<Map.Entry<K,V>> view of a multimap, i.e., all key-value pairs have to equal.
      Specified by:
      equals in interface SetMultimap<K,V>
      Overrides:
      equals in class Object
      Parameters:
      other - the object that is checked for equality against this multimap
      Returns:
      true if the specified object is equal to this map
    • toString

      public String toString()
      Overrides:
      toString in class Object