Record Class CompiledNode<V>

java.lang.Object
java.lang.Record
org.egothor.stemmer.trie.CompiledNode<V>
Type Parameters:
V - value type
Record Components:
edgeLabels - internal edge label array
children - internal child array
orderedValues - internal ordered values array
orderedCounts - internal ordered counts array

public record CompiledNode<V>(char[] edgeLabels, CompiledNode<V>[] children, V[] orderedValues, int[] orderedCounts) extends Record
Immutable compiled trie node optimized for read access.

The returned arrays are the internal backing storage of the compiled node. They are exposed for efficient access by closely related trie infrastructure and therefore must never be modified by callers.

  • Constructor Details

    • CompiledNode

      public CompiledNode(char[] edgeLabels, CompiledNode<V>[] children, V[] orderedValues, int... orderedCounts)
      Creates an instance of a CompiledNode record class.
      Parameters:
      edgeLabels - the value for the edgeLabels record component
      children - the value for the children record component
      orderedValues - the value for the orderedValues record component
      orderedCounts - the value for the orderedCounts record component
  • Method Details

    • findChild

      public CompiledNode<V> findChild(char edge)
      Finds a child for the supplied edge character.
      Parameters:
      edge - edge character
      Returns:
      child node, or null if absent
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • edgeLabels

      public char[] edgeLabels()
      Returns the value of the edgeLabels record component.
      Returns:
      the value of the edgeLabels record component
    • children

      public CompiledNode<V>[] children()
      Returns the value of the children record component.
      Returns:
      the value of the children record component
    • orderedValues

      public V[] orderedValues()
      Returns the value of the orderedValues record component.
      Returns:
      the value of the orderedValues record component
    • orderedCounts

      public int[] orderedCounts()
      Returns the value of the orderedCounts record component.
      Returns:
      the value of the orderedCounts record component