Class ReducedNode<V>

java.lang.Object
org.egothor.stemmer.trie.ReducedNode<V>
Type Parameters:
V - value type

public final class ReducedNode<V> extends Object
Canonical reduced node used during subtree merging.

The maps exposed by the accessors are the internal backing state of the canonical reduced node. They are returned directly for efficiency and are intended only for closely related trie-reduction infrastructure.

  • Constructor Details

  • Method Details

    • signature

      public ReductionSignature<V> signature()
      Returns the reduction signature of this canonical node.
      Returns:
      reduction signature
    • localCounts

      public Map<V,Integer> localCounts()
      Returns the internal aggregated local value-count map.

      The returned map is the internal backing state of this canonical reduced node and is exposed only for efficient cooperation with trie-reduction infrastructure.

      Returns:
      internal aggregated local value-count map
    • children

      public Map<Character,ReducedNode<V>> children()
      Returns the internal canonical child map indexed by transition character.

      The returned map is the internal backing state of this canonical reduced node and is exposed only for efficient cooperation with trie-reduction infrastructure.

      Returns:
      internal canonical child map
    • mergeLocalCounts

      public void mergeLocalCounts(Map<V,Integer> additionalCounts)
      Merges additional local counts into this node.
      Parameters:
      additionalCounts - additional local counts
    • mergeChildren

      public void mergeChildren(Map<Character,ReducedNode<V>> additionalChildren)
      Merges child references into this node.

      For nodes with the same reduction signature, child edge sets and child signatures must be compatible. This method therefore only needs to verify consistency and store the canonical child instance.

      Parameters:
      additionalChildren - additional children