Class StorageNodeForwarding<D, C, V, X extends StorageNode<D,C,V>>

java.lang.Object
org.aksw.commons.index.core.StorageNodeForwarding<D,C,V,X>
Type Parameters:
D -
C -
V -
X -
All Implemented Interfaces:
StorageNode<D,C,V>
Direct Known Subclasses:
StorageNodeMutableForwarding

public abstract class StorageNodeForwarding<D, C, V, X extends StorageNode<D,C,V>> extends Object implements StorageNode<D,C,V>
Author:
Claus Stadler 11/09/2020
  • Constructor Details

    • StorageNodeForwarding

      public StorageNodeForwarding()
  • Method Details

    • getDelegate

      protected abstract X getDelegate()
    • getPublicDelegate

      public StorageNode<D,C,V> getPublicDelegate()
      Specified by:
      getPublicDelegate in interface StorageNode<D,C,V>
    • isDelegate

      public boolean isDelegate()
      Description copied from interface: StorageNode
      Attempt to access a store as a map. The StorageNode and the store must be of the appropriate types in order for this operation to succeed.
      Specified by:
      isDelegate in interface StorageNode<D,C,V>
      Returns:
    • isAltNode

      public boolean isAltNode()
      Description copied from interface: StorageNode
      Whether this storage node stores are a sequences of alternatives Experimental method; may be replaced by a generic getStoreType() method that returns e.g Alt.class, Set.class, etc.
      Specified by:
      isAltNode in interface StorageNode<D,C,V>
      Returns:
    • 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,V>
      Returns:
    • isSetNode

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

      public Map<?,?> getStoreAsMap(Object store)
      Specified by:
      getStoreAsMap in interface StorageNode<D,C,V>
    • getStoreAsSet

      public Set<?> getStoreAsSet(Object store)
      Specified by:
      getStoreAsSet in interface StorageNode<D,C,V>
    • getChildren

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

      public int[] getKeyTupleIdxs()
      Description copied from interface: StorageNode
      The component indexes by which this node indexes May be empty but never null
      Specified by:
      getKeyTupleIdxs in interface StorageNode<D,C,V>
      Returns:
    • getTupleAccessor

      public TupleBridge<D,C> getTupleAccessor()
      Description copied from interface: StorageNode
      Future: Allow the storageNode to answer how efficiently it can answer the constraints in a given constraint list E.g. O(1) or O(log(n)) or O(n)
      Specified by:
      getTupleAccessor in interface StorageNode<D,C,V>
      Returns:
    • streamerForKeysAsComponent

      public <T> Streamer<V,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,V>
      Returns:
    • streamerForKeysAsTuples

      public <T> Streamer<V,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,V>
      Returns:
    • streamerForKeys

      public <T> Streamer<V,?> streamerForKeys(T pattern, TupleAccessor<? super T, ? extends C> accessor)
      Specified by:
      streamerForKeys in interface StorageNode<D,C,V>
    • 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,V>
      Parameters:
      key -
      idx - In the range 0 to
      invalid @link
      {@link getKeyTupleIdxs().length
      } (exclusive) If a key has no components calling this method will always raise IndexOutOfBoundsException
      Returns:
    • chooseSubStore

      public Object chooseSubStore(V store, int subStoreIdx)
      Specified by:
      chooseSubStore in interface StorageNode<D,C,V>
    • streamerForValues

      public <T> Streamer<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,V>
      Type Parameters:
      T -
      Parameters:
      pattern -
      accessor -
      Returns:
    • streamerForKeyAndSubStoreAlts

      public <T> Streamer<V, ? extends Map.Entry<?,?>> 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,V>
      Type Parameters:
      T -
      Parameters:
      pattern -
      accessor -
      Returns:
    • streamEntries

      public <T> Stream<?> streamEntries(V store, 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
      Specified by:
      streamEntries in interface StorageNode<D,C,V>
      Type Parameters:
      T -
      Parameters:
      store -
      tupleLike -
      tupleAccessor -
      Returns: