Class StorageNodeLeafMap<D,C,K,V,M extends Map<K,V>>

java.lang.Object
org.aksw.commons.index.core.StorageNodeBase<D,C,M>
org.aksw.commons.index.core.StorageNodeLeafMap<D,C,K,V,M>
Type Parameters:
D -
C -
K -
V -
All Implemented Interfaces:
StorageNode<D,C,M>, StorageNodeMutable<D,C,M>

public class StorageNodeLeafMap<D,C,K,V,M extends Map<K,V>> extends StorageNodeBase<D,C,M>
Author:
Claus Stadler 11/09/2020
  • Field Details

  • Constructor Details

  • Method Details

    • getChildren

      public List<StorageNode<D,C,?>> getChildren()
      Description copied from interface: StorageNode
      Each node in the storage expression may have 0 or more children
      Returns:
    • add

      public boolean add(M map, D tupleLike)
    • remove

      public boolean remove(M map, D tupleLike)
    • clear

      public void clear(M store)
      Description copied from interface: StorageNodeMutable
      Clear a store's content. Cascades to any sub-stores.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • streamEntries

      public <T> Stream<Map.Entry<K,?>> streamEntries(M map, T tupleLike, TupleAccessor<? super T,? extends C> tupleAccessor)
      Description copied from interface: StorageNode
      Stream all entries under equality constraints obtained from a tuple-like pattern
      Returns:
    • tupleToKey

      public K tupleToKey(D tupleLike)
    • isMapNode

      public boolean isMapNode()
      Description copied from interface: StorageNode
      Whether this storage node stores are a maps Experimental method; may be replaced by a generic getStoreType() method that returns e.g Alt.class, Set.class, etc.
      Specified by:
      isMapNode in interface StorageNode<D,C,K>
      Returns:
    • getStoreAsMap

      public M getStoreAsMap(Object store)
      Specified by:
      getStoreAsMap in interface StorageNode<D,C,K>
    • newStore

      public M newStore()
      Specified by:
      newStore in interface StorageNodeMutable<D,C,K>
    • isEmpty

      public boolean isEmpty(M map)
      Specified by:
      isEmpty in interface StorageNodeMutable<D,C,K>
    • projectTupleToArray

      public static <T, C> Object[] projectTupleToArray(int[] tupleIdxs, T tupleLike, TupleAccessor<T,C> tupleAccessor)
    • streamerForKeysUnderConstraints

      public <T> Streamer<M,K> streamerForKeysUnderConstraints(T tupleLike, TupleAccessor<? super T,? extends C> tupleAccessor)
    • streamerForValuesUnderConstraints

      public <T> Streamer<M,V> streamerForValuesUnderConstraints(T tupleLike, TupleAccessor<? super T,? extends C> tupleAccessor)
    • streamerForEntriesUnderConstraints

      public <T> Streamer<M,Map.Entry<K,V>> streamerForEntriesUnderConstraints(T tupleLike, TupleAccessor<? super T,? extends C> tupleAccessor)
    • streamerForKeysAsComponent

      public <T> Streamer<M,C> streamerForKeysAsComponent(T pattern, TupleAccessor<? super T,? extends C> accessor)
      Description copied from interface: StorageNode
      Compiles from a given pattern a function that can stream the matching keys from the appropriate store. The keys must be instances of the component type otherwise an exception is raised
      Specified by:
      streamerForKeysAsComponent in interface StorageNode<D,C,K>
      Returns:
    • streamerForValues

      public <T> Streamer<M,V> streamerForValues(T pattern, TupleAccessor<? super T,? extends C> accessor)
      Description copied from interface: StorageNode
      Returns an object that can extract the stream of values at an index node under constraints map: { entry.value | entry in map and entry.key matches condition} leafSet: set.entries.stream() A leaf set does not have any keys that could affect the result stream
      Specified by:
      streamerForValues in interface StorageNode<D,C,K>
      Returns:
    • streamerForKeysAsTuples

      public <T> Streamer<M,List<C>> streamerForKeysAsTuples(T pattern, TupleAccessor<? super T,? extends C> accessor)
      Description copied from interface: StorageNode
      Compiles from a given pattern a function that can stream the matching keys from the appropriate store. The keys must be instances of the component type otherwise an exception is raised if getKeyTupleIdxs().length == 0 then returns a single tuple that projects no components
      Specified by:
      streamerForKeysAsTuples in interface StorageNode<D,C,K>
      Returns:
    • streamerForKeys

      public <T> Streamer<M,K> streamerForKeys(T pattern, TupleAccessor<? super T,? extends C> accessor)
      Specified by:
      streamerForKeys in interface StorageNode<D,C,K>
    • streamerForKeyAndSubStoreAlts

      public <T> Streamer<M,Map.Entry<K,V>> streamerForKeyAndSubStoreAlts(T pattern, TupleAccessor<? super T,? extends C> accessor)
      Description copied from interface: StorageNode
      The streamer returns entry that hold a tuple-like key and conceptually alternatives of sub-stores The tuple components of the key can be accessed using StorageNode.getKeyComponentRaw(Object, int) There are as many components as the length of StorageNode.getKeyTupleIdxs() If there is 0 components then any invocation of StorageNode.getKeyComponentRaw(Object, int) will fail with a UnsupportedOperationException. To extract a specific alternative from the substore use StorageNode.chooseSubStore(Object, int). If StorageNode.getChildren() is not empty then there are as many substore indices as there are children If there are no children then there is an implicit single sub store with index 0
      Specified by:
      streamerForKeyAndSubStoreAlts in interface StorageNode<D,C,K>
      Returns:
    • getKeyComponentRaw

      public C getKeyComponentRaw(Object key, int idx)
      Description copied from interface: StorageNode
      Obtain components from the internal representation of key that was used for indexing w.r.t. StorageNode.getKeyTupleIdxs().
      Specified by:
      getKeyComponentRaw in interface StorageNode<D,C,K>
      idx - In the range 0 to {@link getKeyTupleIdxs().length} (exclusive) If a key has no components calling this method will always raise IndexOutOfBoundsException
      Returns:
    • getKeyComponent

      public C getKeyComponent(K key, int idx)
    • chooseSubStore

      public Object chooseSubStore(M store, int subStoreIdx)
      Specified by:
      chooseSubStore in interface StorageNode<D,C,K>