Package org.aksw.commons.index
Class StorageComposers
- java.lang.Object
-
- org.aksw.commons.index.StorageComposers
-
public class StorageComposers extends Object
A collection of static methods for composing storage structures such as arbitrarily nested maps- Author:
- Claus Stadler 11/09/2020
-
-
Constructor Summary
Constructors Constructor Description StorageComposers()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <D,C,V1,V2>
StorageNodeMutable<D,C,Alt2<V1,V2>>alt2(StorageNodeMutable<D,C,V1> child1, StorageNodeMutable<D,C,V2> child2)static <D,C,V1,V2,V3>
StorageNodeMutable<D,C,Alt3<V1,V2,V3>>alt3(StorageNodeMutable<D,C,V1> child1, StorageNodeMutable<D,C,V2> child2, StorageNodeMutable<D,C,V3> child3)static <D,C>
StorageNodeMutable<D,C,?>altN(List<? extends StorageNodeMutable<D,C,?>> children)Generic construction for composition from multiple composers Breaks strong typing in contrast to static alternatives{1, 2, ...} constructions that could e.g.static <D,C,V,S extends Map<C,V>>
StorageNodeMutable<D,C,S>innerMap(int tupleIdx, MapSupplier mapSupplier, StorageNodeMutable<D,C,V> child)static <D,C,S extends Set<C>>
StorageNodeMutable<D,C,S>leafComponentSet(int tupleIdx, SetSupplier setSupplier, org.aksw.commons.tuple.TupleAccessor<D,C> tupleAccessor)static <D,C>
StorageNodeMutable<D,C,List<D>>leafList(ListSupplier listSupplier, org.aksw.commons.tuple.TupleAccessor<D,C> tupleAccessor)static <D,C,S extends Map<C,D>>
StorageNodeMutable<D,C,S>leafMap(int tupleIdx, MapSupplier mapSupplier, org.aksw.commons.tuple.TupleAccessor<D,C> tupleAccessor)static <D,C,S extends Set<D>>
StorageNodeMutable<D,C,S>leafSet(SetSupplier setSupplier, org.aksw.commons.tuple.TupleAccessor<D,C> tupleAccessor)static <D,C,V>
StorageNodeMutable<D,C,V>postProcessAdd(StorageNodeMutable<D,C,V> delegate, java.util.function.BiConsumer<V,D> postProcessor)A wrapper for aStorageNodeMutable.add(Object, Object)that allows for running a post processing action after a regular insert.static <D,C,V,X extends StorageNodeMutable<D,C,V>>
StorageNodeWrapperCodec<D,C,V,X>wrapWithCanonicalization(X delegate)Canonicalization maps all equivalent tuples and components w.r.t.static <D1,C1,D2,C2,V,X extends StorageNodeMutable<D2,C2,V>>
StorageNodeMutable<D1,C1,V>wrapWithDictionary(X delegate, org.aksw.commons.tuple.TupleAccessor<D1,C1> sourceTupleAccessor)DON'T USE ; maintain a TupleCodec separately instead
-
-
-
Method Detail
-
leafSet
public static <D,C,S extends Set<D>> StorageNodeMutable<D,C,S> leafSet(SetSupplier setSupplier, org.aksw.commons.tuple.TupleAccessor<D,C> tupleAccessor)
-
leafComponentSet
public static <D,C,S extends Set<C>> StorageNodeMutable<D,C,S> leafComponentSet(int tupleIdx, SetSupplier setSupplier, org.aksw.commons.tuple.TupleAccessor<D,C> tupleAccessor)
-
leafList
public static <D,C> StorageNodeMutable<D,C,List<D>> leafList(ListSupplier listSupplier, org.aksw.commons.tuple.TupleAccessor<D,C> tupleAccessor)
-
leafMap
public static <D,C,S extends Map<C,D>> StorageNodeMutable<D,C,S> leafMap(int tupleIdx, MapSupplier mapSupplier, org.aksw.commons.tuple.TupleAccessor<D,C> tupleAccessor)
-
innerMap
public static <D,C,V,S extends Map<C,V>> StorageNodeMutable<D,C,S> innerMap(int tupleIdx, MapSupplier mapSupplier, StorageNodeMutable<D,C,V> child)
-
altN
public static <D,C> StorageNodeMutable<D,C,?> altN(List<? extends StorageNodeMutable<D,C,?>> children)
Generic construction for composition from multiple composers Breaks strong typing in contrast to static alternatives{1, 2, ...} constructions that could e.g. yield Map> types - Type Parameters:
D-C-V-- Parameters:
tupleIdx-mapSupplier-child-- Returns:
-
alt2
public static <D,C,V1,V2> StorageNodeMutable<D,C,Alt2<V1,V2>> alt2(StorageNodeMutable<D,C,V1> child1, StorageNodeMutable<D,C,V2> child2)
-
alt3
public static <D,C,V1,V2,V3> StorageNodeMutable<D,C,Alt3<V1,V2,V3>> alt3(StorageNodeMutable<D,C,V1> child1, StorageNodeMutable<D,C,V2> child2, StorageNodeMutable<D,C,V3> child3)
-
postProcessAdd
public static <D,C,V> StorageNodeMutable<D,C,V> postProcessAdd(StorageNodeMutable<D,C,V> delegate, java.util.function.BiConsumer<V,D> postProcessor)
A wrapper for aStorageNodeMutable.add(Object, Object)that allows for running a post processing action after a regular insert.- Type Parameters:
D-C-V-- Parameters:
delegate-postProcessor-- Returns:
-
wrapWithCanonicalization
public static <D,C,V,X extends StorageNodeMutable<D,C,V>> StorageNodeWrapperCodec<D,C,V,X> wrapWithCanonicalization(X delegate)
Canonicalization maps all equivalent tuples and components w.r.t. .equals() to canonical instances such that '==' becomes sufficient for equality checks.- Type Parameters:
D-C-V-X-- Parameters:
delegate-- Returns:
-
wrapWithDictionary
public static <D1,C1,D2,C2,V,X extends StorageNodeMutable<D2,C2,V>> StorageNodeMutable<D1,C1,V> wrapWithDictionary(X delegate, org.aksw.commons.tuple.TupleAccessor<D1,C1> sourceTupleAccessor)
DON'T USE ; maintain a TupleCodec separately instead- Type Parameters:
D1- The source domain tuple type, e.g. TripleC1- The source domain component type, e.g. NodeD2- The target domain tuple type, e.g. int[]C2- The target domain component type, e.g. IntegerV- The type of the store structure being wrapped; must be based on D2 and C2X- The type of the storage being wrapped
-
-