Class BottomUpImmutableNodeTransformer<SN extends Node,DN extends Node>

java.lang.Object
io.usethesource.capsule.core.trie.BottomUpImmutableNodeTransformer<SN,DN>

public class BottomUpImmutableNodeTransformer<SN extends Node,DN extends Node> extends Object
Bottom Up Trie Transformer, e.g., for combined mapping plus canonicalization of the tree. TODO: finish implementation (WIP converting from transient to immutable transformer)
  • Field Details

    • MAX_DEPTH

      private static final int MAX_DEPTH
      See Also:
    • nodeMapper

      private final BiFunction<SN extends Node,DN extends Node[],DN extends Node> nodeMapper
    • mutator

      private final AtomicReference<Thread> mutator
    • dstRootNode

      private final DN extends Node dstRootNode
    • arrayConstructor

      private final IntFunction<DN extends Node[]> arrayConstructor
    • stackIndex

      private int stackIndex
    • srcNodeStack

      private final SN extends Node[] srcNodeStack
    • srcNodeCursorsAndLengths

      private final int[] srcNodeCursorsAndLengths
    • mappedNodesStack

      private final Stack<DN extends Node> mappedNodesStack
    • EMPTY_DN_ARRAY

      private final DN extends Node[] EMPTY_DN_ARRAY
  • Constructor Details

    • BottomUpImmutableNodeTransformer

      public BottomUpImmutableNodeTransformer(SN srcRootNode, BiFunction<SN,DN[],DN> nodeMapper, IntFunction<DN[]> arrayConstructor)
  • Method Details

    • applyNodeTransformation

      static final <SN extends Node, DN extends Node> DN applyNodeTransformation(SN rootNode, BiFunction<SN,DN[],DN> nodeMapper, IntFunction<DN[]> arrayConstructor)
    • apply

      public final DN apply()
    • isStackEmpty

      private final boolean isStackEmpty()
    • pushOnStack

      private final void pushOnStack(SN srcNode)
    • dropFromStack

      private final void dropFromStack()
    • processStack

      private final void processStack()