Class StorageNodeInnerMap<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.StorageNodeInnerMap<D,C,K,V,M>
- Type Parameters:
D- The domain type of tupleC- The component type of the domain tupleK- The key type of the map; depends on one or more componentsV- The value type of the map which is
- All Implemented Interfaces:
StorageNode<D,C, M>, StorageNodeMutable<D, C, M>
- Author:
- Claus Stadler 11/09/2020
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StorageNodeMutable<D, C, V> protected TupleValueFunction<C, K> protected TupleAccessor<? super K, ? extends C> protected MapSupplierFields inherited from class StorageNodeBase
tupleAccessor, tupleIdxs -
Constructor Summary
ConstructorsConstructorDescriptionStorageNodeInnerMap(int[] tupleIdxs, TupleBridge<D, C> tupleAccessor, StorageNodeMutable<D, C, V> child, MapSupplier mapSupplier, TupleValueFunction<C, K> keyFunction, TupleAccessor<? super K, ? extends C> keyToComponent) -
Method Summary
Modifier and TypeMethodDescriptionbooleanchooseSubStore(M store, int subStoreIdx) voidClear a store's content.List<StorageNode<D, C, ?>> Each node in the storage expression may have 0 or more childrengetKeyComponent(K key, int idx) getKeyComponentRaw(Object key, int idx) Obtain components from the internal representation of key that was used for indexing w.r.t.getStoreAsMap(Object store) booleanbooleanWhether 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.newStore()static <T,C> Object[] projectTupleToArray(int[] tupleIdxs, T tupleLike, TupleAccessor<T, C> tupleAccessor) booleanstreamEntries(M map, T tupleLike, TupleAccessor<? super T, ? extends C> tupleAccessor) Stream all entries under equality constraints obtained from a tuple-like patternstreamerForEntriesUnderConstraints(T tupleLike, TupleAccessor<? super T, ? extends C> tupleAccessor) streamerForKeyAndSubStoreAlts(T pattern, TupleAccessor<? super T, ? extends C> accessor) 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 usingStorageNode.getKeyComponentRaw(Object, int)There are as many components as the length ofStorageNode.getKeyTupleIdxs()If there is 0 components then any invocation ofStorageNode.getKeyComponentRaw(Object, int)will fail with aUnsupportedOperationException.streamerForKeys(T pattern, TupleAccessor<? super T, ? extends C> accessor) streamerForKeysAsComponent(T pattern, TupleAccessor<? super T, ? extends C> accessor) Compiles from a given pattern a function that can stream the matching keys from the appropriate store.streamerForKeysAsTuples(T pattern, TupleAccessor<? super T, ? extends C> accessor) Compiles from a given pattern a function that can stream the matching keys from the appropriate store.streamerForKeysUnderConstraints(T tupleLike, TupleAccessor<? super T, ? extends C> tupleAccessor) streamerForValues(T pattern, TupleAccessor<? super T, ? extends C> accessor) 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 streamstreamerForValuesUnderConstraints(T tupleLike, TupleAccessor<? super T, ? extends C> tupleAccessor) toString()tupleToKey(D tupleLike) Methods inherited from class StorageNodeBase
getKeyTupleIdxs, getTupleAccessorMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface StorageNode
chooseSubStoreRaw, getKeyTupleIdxs, getPublicDelegate, getStoreAsList, getStoreAsSet, getTupleAccessor, holdsDomainTuples, isAltNode, isDelegate, isListNode, isSetNode, streamEntries, streamEntriesRaw, streamEntriesRawMethods inherited from interface StorageNodeMutable
addRaw, clearRaw, isEmptyRaw, removeRaw
-
Field Details
-
child
-
mapSupplier
-
keyFunction
-
keyToComponent
-
-
Constructor Details
-
StorageNodeInnerMap
public StorageNodeInnerMap(int[] tupleIdxs, TupleBridge<D, C> tupleAccessor, StorageNodeMutable<D, C, V> child, MapSupplier mapSupplier, TupleValueFunction<C, K> keyFunction, TupleAccessor<? super K, ? extends C> keyToComponent)
-
-
Method Details
-
getChildren
Description copied from interface:StorageNodeEach node in the storage expression may have 0 or more children- Returns:
-
newStore
-
add
-
remove
-
clear
Description copied from interface:StorageNodeMutableClear a store's content. Cascades to any sub-stores. -
toString
-
streamEntries
public <T> Stream<Map.Entry<K,?>> streamEntries(M map, T tupleLike, TupleAccessor<? super T, ? extends C> tupleAccessor) Description copied from interface:StorageNodeStream all entries under equality constraints obtained from a tuple-like pattern- Type Parameters:
T-- Parameters:
map-tupleLike-tupleAccessor-- Returns:
-
tupleToKey
-
isMapNode
public boolean isMapNode()Description copied from interface:StorageNodeWhether 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:
isMapNodein interfaceStorageNode<D,C, K> - Returns:
-
getStoreAsMap
- Specified by:
getStoreAsMapin interfaceStorageNode<D,C, K>
-
isEmpty
- Specified by:
isEmptyin interfaceStorageNodeMutable<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
-
streamerForKeysAsComponent
public <T> Streamer<M,C> streamerForKeysAsComponent(T pattern, TupleAccessor<? super T, ? extends C> accessor) Description copied from interface:StorageNodeCompiles 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:
streamerForKeysAsComponentin interfaceStorageNode<D,C, K> - Returns:
-
streamerForValues
public <T> Streamer<M,V> streamerForValues(T pattern, TupleAccessor<? super T, ? extends C> accessor) Description copied from interface:StorageNodeReturns 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:
streamerForValuesin interfaceStorageNode<D,C, K> - Type Parameters:
T-- Parameters:
pattern-accessor-- Returns:
-
streamerForKeysAsTuples
public <T> Streamer<M,List<C>> streamerForKeysAsTuples(T pattern, TupleAccessor<? super T, ? extends C> accessor) Description copied from interface:StorageNodeCompiles 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:
streamerForKeysAsTuplesin interfaceStorageNode<D,C, K> - Returns:
-
streamerForKeys
- Specified by:
streamerForKeysin interfaceStorageNode<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:StorageNodeThe streamer returns entry that hold a tuple-like key and conceptually alternatives of sub-stores The tuple components of the key can be accessed usingStorageNode.getKeyComponentRaw(Object, int)There are as many components as the length ofStorageNode.getKeyTupleIdxs()If there is 0 components then any invocation ofStorageNode.getKeyComponentRaw(Object, int)will fail with aUnsupportedOperationException. To extract a specific alternative from the substore useStorageNode.chooseSubStore(Object, int). IfStorageNode.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:
streamerForKeyAndSubStoreAltsin interfaceStorageNode<D,C, K> - Type Parameters:
T-- Parameters:
pattern-accessor-- Returns:
-
getKeyComponentRaw
Description copied from interface:StorageNodeObtain components from the internal representation of key that was used for indexing w.r.t.StorageNode.getKeyTupleIdxs().- Specified by:
getKeyComponentRawin interfaceStorageNode<D,C, K> - Parameters:
key-idx- In the range 0 to} (exclusive) If a key has no components calling this method will always raiseinvalid @link
{@link getKeyTupleIdxs().lengthIndexOutOfBoundsException- Returns:
-
getKeyComponent
-
chooseSubStore
- Specified by:
chooseSubStorein interfaceStorageNode<D,C, K>
-