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 Details

    • StorageComposers

      public StorageComposers()
  • Method Details

    • leafSet

      public static <D, C, S extends Set<D>> StorageNodeMutable<D,C,S> leafSet(SetSupplier setSupplier, TupleBridge<D,C> tupleAccessor)
    • leafComponentSet

      public static <D, C, S extends Set<C>> StorageNodeMutable<D,C,S> leafComponentSet(int tupleIdx, SetSupplier setSupplier, TupleBridge<D,C> tupleAccessor)
    • leafList

      public static <D,C> StorageNodeMutable<D,C,List<D>> leafList(ListSupplier listSupplier, TupleBridge<D,C> tupleAccessor)
    • leafMap

      public static <D, C, S extends Map<C,D>> StorageNodeMutable<D,C,S> leafMap(int tupleIdx, MapSupplier mapSupplier, TupleBridge<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 Mapinvalid input: '<'Foo, Alternatives3invalid input: '<'Bar, Baz, Bax>> 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, BiConsumer<V,D> postProcessor)
      A wrapper for a StorageNodeMutable.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, TupleBridge<D1,C1> sourceTupleAccessor)
      DON'T USE ; maintain a TupleCodec separately instead
      Type Parameters:
      D1 - The source domain tuple type, e.g. Triple
      C1 - The source domain component type, e.g. Node
      D2 - The target domain tuple type, e.g. int[]
      C2 - The target domain component type, e.g. Integer
      V - The type of the store structure being wrapped; must be based on D2 and C2
      X - The type of the storage being wrapped