Package org.aksw.commons.index.core
Class StorageNodeLeafDomainList<D,C,V>
- java.lang.Object
-
- org.aksw.commons.index.core.StorageNodeBase<D,C,List<V>>
-
- org.aksw.commons.index.core.StorageNodeLeafDomainList<D,C,V>
-
- Type Parameters:
D-C-V-
- All Implemented Interfaces:
StorageNode<D,C,List<V>>,StorageNodeMutable<D,C,List<V>>
public class StorageNodeLeafDomainList<D,C,V> extends StorageNodeBase<D,C,List<V>>
Essentially a view of a Setas a Map > - Author:
- Claus Stadler 11/09/2020
-
-
Field Summary
Fields Modifier and Type Field Description protected ListSupplierlistSupplierprotected TupleValueFunction<C,V>valueFunction-
Fields inherited from class org.aksw.commons.index.core.StorageNodeBase
tupleAccessor, tupleIdxs
-
-
Constructor Summary
Constructors Constructor Description StorageNodeLeafDomainList(org.aksw.commons.tuple.TupleAccessor<D,C> tupleAccessor, ListSupplier listSupplier, TupleValueFunction<C,V> valueFunction)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(List<V> list, D tupleLike)ObjectchooseSubStore(List<V> store, int subStoreIdx)voidclear(List<V> store)Clear a store's content.List<StorageNode<D,C,?>>getChildren()Each node in the storage expression may have 0 or more childrenCgetKeyComponentRaw(Object key, int idx)Obtain components from the internal representation of key that was used for indexing w.r.t.List<?>getStoreAsList(Object store)booleanholdsDomainTuples()Flag that when true indicates that this storage node's values are tuples of type D - i.e.booleanisEmpty(List<V> store)booleanisListNode()Whether this storage node stores are lists Experimental method; may be replaced by a generic getStoreType() method that returns e.g Alt.class, Set.class, etc.List<V>newStore()booleanremove(List<V> set, D tupleLike)<T> java.util.stream.Stream<V>streamEntries(List<V> list, T tupleLike, org.aksw.commons.tuple.TupleAccessorCore<? super T,? extends C> tupleAccessor)Stream all entries under equality constraints obtained from a tuple-like pattern<T> Streamer<List<V>,? extends Map.Entry<?,?>>streamerForKeyAndSubStoreAlts(T pattern, org.aksw.commons.tuple.TupleAccessorCore<? 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.<T> Streamer<List<V>,?>streamerForKeys(T pattern, org.aksw.commons.tuple.TupleAccessorCore<? super T,? extends C> accessor)<T> Streamer<List<V>,C>streamerForKeysAsComponent(T pattern, org.aksw.commons.tuple.TupleAccessorCore<? super T,? extends C> accessor)Compiles from a given pattern a function that can stream the matching keys from the appropriate store.<T> Streamer<List<V>,List<C>>streamerForKeysAsTuples(T pattern, org.aksw.commons.tuple.TupleAccessorCore<? super T,? extends C> accessor)Compiles from a given pattern a function that can stream the matching keys from the appropriate store.<T> Streamer<List<V>,V>streamerForValues(T pattern, org.aksw.commons.tuple.TupleAccessorCore<? 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 streamStringtoString()VtupleToValue(D tupleLike)-
Methods inherited from class org.aksw.commons.index.core.StorageNodeBase
getKeyTupleIdxs, getTupleAccessor
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.aksw.commons.index.core.StorageNode
chooseSubStoreRaw, getKeyTupleIdxs, getPublicDelegate, getStoreAsMap, getStoreAsSet, getTupleAccessor, isAltNode, isDelegate, isMapNode, isSetNode, streamEntries, streamEntriesRaw, streamEntriesRaw
-
Methods inherited from interface org.aksw.commons.index.core.StorageNodeMutable
addRaw, clearRaw, isEmptyRaw, removeRaw
-
-
-
-
Field Detail
-
valueFunction
protected TupleValueFunction<C,V> valueFunction
-
listSupplier
protected ListSupplier listSupplier
-
-
Constructor Detail
-
StorageNodeLeafDomainList
public StorageNodeLeafDomainList(org.aksw.commons.tuple.TupleAccessor<D,C> tupleAccessor, ListSupplier listSupplier, TupleValueFunction<C,V> valueFunction)
-
-
Method Detail
-
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:
-
getChildren
public List<StorageNode<D,C,?>> getChildren()
Description copied from interface:StorageNodeEach node in the storage expression may have 0 or more children- Returns:
-
clear
public void clear(List<V> store)
Description copied from interface:StorageNodeMutableClear a store's content. Cascades to any sub-stores.
-
streamerForKeysAsComponent
public <T> Streamer<List<V>,C> streamerForKeysAsComponent(T pattern, org.aksw.commons.tuple.TupleAccessorCore<? 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<List<V>,List<C>> streamerForKeysAsTuples(T pattern, org.aksw.commons.tuple.TupleAccessorCore<? 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<List<V>,V> streamerForValues(T pattern, org.aksw.commons.tuple.TupleAccessorCore<? 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- Returns:
-
streamerForKeyAndSubStoreAlts
public <T> Streamer<List<V>,? extends Map.Entry<?,?>> streamerForKeyAndSubStoreAlts(T pattern, org.aksw.commons.tuple.TupleAccessorCore<? 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- Returns:
-
streamEntries
public <T> java.util.stream.Stream<V> streamEntries(List<V> list, T tupleLike, org.aksw.commons.tuple.TupleAccessorCore<? super T,? extends C> tupleAccessor)
Description copied from interface:StorageNodeStream all entries under equality constraints obtained from a tuple-like pattern- Returns:
-
streamerForKeys
public <T> Streamer<List<V>,?> streamerForKeys(T pattern, org.aksw.commons.tuple.TupleAccessorCore<? super T,? extends C> accessor)
-
getKeyComponentRaw
public C getKeyComponentRaw(Object key, int idx)
Description copied from interface:StorageNodeObtain components from the internal representation of key that was used for indexing w.r.t.StorageNode.getKeyTupleIdxs().idx- In the range 0 to {@link getKeyTupleIdxs().length} (exclusive) If a key has no components calling this method will always raiseIndexOutOfBoundsException- Returns:
-
newStore
public List<V> newStore()
- Specified by:
newStorein interfaceStorageNodeMutable<D,C,V>
-
isListNode
public boolean isListNode()
Description copied from interface:StorageNodeWhether this storage node stores are lists Experimental method; may be replaced by a generic getStoreType() method that returns e.g Alt.class, Set.class, etc.- Specified by:
isListNodein interfaceStorageNode<D,C,V>- Returns:
-
getStoreAsList
public List<?> getStoreAsList(Object store)
- Specified by:
getStoreAsListin interfaceStorageNode<D,C,V>
-
isEmpty
public boolean isEmpty(List<V> store)
- Specified by:
isEmptyin interfaceStorageNodeMutable<D,C,V>
-
-