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

  • 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 Detail

      • keyToComponent

        protected org.aksw.commons.tuple.TupleAccessorCore<? super K,​? extends C> keyToComponent
    • Constructor Detail

      • StorageNodeLeafMap

        public StorageNodeLeafMap​(int[] tupleIdxs,
                                  org.aksw.commons.tuple.TupleAccessor<D,​C> tupleAccessor,
                                  MapSupplier mapSupplier,
                                  TupleValueFunction<C,​K> keyFunction,
                                  org.aksw.commons.tuple.TupleAccessorCore<? super K,​? extends C> keyToComponent,
                                  TupleValueFunction<C,​V> valueFunction)
    • Method Detail

      • 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.
      • streamEntries

        public <T> java.util.stream.Stream<Map.Entry<K,​?>> streamEntries​(M map,
                                                                               T tupleLike,
                                                                               org.aksw.commons.tuple.TupleAccessorCore<? 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:
      • projectTupleToArray

        public static <T,​C> Object[] projectTupleToArray​(int[] tupleIdxs,
                                                               T tupleLike,
                                                               org.aksw.commons.tuple.TupleAccessorCore<T,​C> tupleAccessor)
      • streamerForKeysUnderConstraints

        public <T> Streamer<M,​K> streamerForKeysUnderConstraints​(T tupleLike,
                                                                       org.aksw.commons.tuple.TupleAccessorCore<? super T,​? extends C> tupleAccessor)
      • streamerForValuesUnderConstraints

        public <T> Streamer<M,​V> streamerForValuesUnderConstraints​(T tupleLike,
                                                                         org.aksw.commons.tuple.TupleAccessorCore<? super T,​? extends C> tupleAccessor)
      • streamerForEntriesUnderConstraints

        public <T> Streamer<M,​Map.Entry<K,​V>> streamerForEntriesUnderConstraints​(T tupleLike,
                                                                                             org.aksw.commons.tuple.TupleAccessorCore<? super T,​? extends C> tupleAccessor)
      • streamerForKeysAsComponent

        public <T> Streamer<M,​C> streamerForKeysAsComponent​(T pattern,
                                                                  org.aksw.commons.tuple.TupleAccessorCore<? 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,
                                                         org.aksw.commons.tuple.TupleAccessorCore<? 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,
                                                                     org.aksw.commons.tuple.TupleAccessorCore<? 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,
                                                       org.aksw.commons.tuple.TupleAccessorCore<? super T,​? extends C> accessor)
        Specified by:
        streamerForKeys in interface StorageNode<D,​C,​K>
      • getKeyComponent

        public C getKeyComponent​(K key,
                                 int idx)