Class StorageNodeLeafDomainSet<D, C, V, S extends Set<V>>
java.lang.Object
org.aksw.commons.index.core.StorageNodeBase<D,C,S>
org.aksw.commons.index.core.StorageNodeLeafDomainSet<D,C,V,S>
- Type Parameters:
D-C-V-
- All Implemented Interfaces:
StorageNode<D,C, S>, StorageNodeMutable<D, C, S>
Essentially a view of a List<D> as a
Map<EMPTY_LIST, List<D>>
where there for a non-empty List<D> there is exactly a single key that is the empty list.- Author:
- Claus Stadler 11/09/2020
-
Field Summary
FieldsFields inherited from class StorageNodeBase
tupleAccessor, tupleIdxs -
Constructor Summary
ConstructorsConstructorDescriptionStorageNodeLeafDomainSet(TupleBridge<D, C> tupleAccessor, SetSupplier setSupplier, TupleValueFunction<C, V> valueFunction) -
Method Summary
Modifier and TypeMethodDescriptionbooleanchooseSubStore(S store, int subStoreIdx) voidClear a store's content.List<StorageNode<D, C, ?>> Each node in the storage expression may have 0 or more childrengetKeyComponentRaw(Object key, int idx) Obtain components from the internal representation of key that was used for indexing w.r.t.Set<?> getStoreAsSet(Object store) booleanFlag that when true indicates that this storage node's values are tuples of type D - i.e.booleanbooleanWhether 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.newStore()booleanstreamEntries(S set, T tupleLike, TupleAccessor<? super T, ? extends C> tupleAccessor) Stream all entries under equality constraints obtained from a tuple-like patternstreamerForKeyAndSubStoreAlts(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.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 streamtoString()tupleToValue(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, getStoreAsMap, getTupleAccessor, isAltNode, isDelegate, isListNode, isMapNode, streamEntries, streamEntriesRaw, streamEntriesRawMethods inherited from interface StorageNodeMutable
addRaw, clearRaw, isEmptyRaw, removeRaw
-
Field Details
-
valueFunction
-
setSupplier
-
-
Constructor Details
-
StorageNodeLeafDomainSet
public StorageNodeLeafDomainSet(TupleBridge<D, C> tupleAccessor, SetSupplier setSupplier, TupleValueFunction<C, V> valueFunction)
-
-
Method Details
-
holdsDomainTuples
public boolean holdsDomainTuples()Description copied from interface:StorageNodeFlag that when true indicates that this storage node's values are tuples of type D - i.e. "domain tuples".- Returns:
-
tupleToValue
-
getChildren
Description copied from interface:StorageNodeEach node in the storage expression may have 0 or more children- Returns:
-
add
-
remove
-
clear
Description copied from interface:StorageNodeMutableClear a store's content. Cascades to any sub-stores. -
toString
-
streamerForKeysAsComponent
public <T> Streamer<S,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- Returns:
-
streamerForKeysAsTuples
public <T> Streamer<S,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- Returns:
-
streamerForValues
public <T> Streamer<S,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- Type Parameters:
T-- Parameters:
pattern-accessor-- Returns:
-
streamerForKeyAndSubStoreAlts
public <T> Streamer<S, ? extends Map.Entry<?,?>> 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- Type Parameters:
T-- Parameters:
pattern-accessor-- Returns:
-
streamEntries
public <T> Stream<V> streamEntries(S set, 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:
set-tupleLike-tupleAccessor-- Returns:
-
streamerForKeys
-
getKeyComponentRaw
Description copied from interface:StorageNodeObtain components from the internal representation of key that was used for indexing w.r.t.StorageNode.getKeyTupleIdxs().- 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:
-
chooseSubStore
-
newStore
- Specified by:
newStorein interfaceStorageNodeMutable<D,C, V>
-
isSetNode
public boolean isSetNode()Description copied from interface:StorageNodeWhether 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:
isSetNodein interfaceStorageNode<D,C, V> - Returns:
-
getStoreAsSet
- Specified by:
getStoreAsSetin interfaceStorageNode<D,C, V>
-
isEmpty
- Specified by:
isEmptyin interfaceStorageNodeMutable<D,C, V>
-