Package org.egothor.stemmer.trie
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 arraychildren- internal child arrayorderedValues- internal ordered values arrayorderedCounts- 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 Summary
ConstructorsConstructorDescriptionCompiledNode(char[] edgeLabels, CompiledNode<V>[] children, V[] orderedValues, int... orderedCounts) Creates an instance of aCompiledNoderecord class. -
Method Summary
Modifier and TypeMethodDescriptionCompiledNode<V>[]children()Returns the value of thechildrenrecord component.char[]Returns the value of theedgeLabelsrecord component.final booleanIndicates whether some other object is "equal to" this one.findChild(char edge) Finds a child for the supplied edge character.final inthashCode()Returns a hash code value for this object.int[]Returns the value of theorderedCountsrecord component.V[]Returns the value of theorderedValuesrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
CompiledNode
public CompiledNode(char[] edgeLabels, CompiledNode<V>[] children, V[] orderedValues, int... orderedCounts) Creates an instance of aCompiledNoderecord class.- Parameters:
edgeLabels- the value for theedgeLabelsrecord componentchildren- the value for thechildrenrecord componentorderedValues- the value for theorderedValuesrecord componentorderedCounts- the value for theorderedCountsrecord component
-
-
Method Details
-
findChild
Finds a child for the supplied edge character.- Parameters:
edge- edge character- Returns:
- child node, or
nullif absent
-
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. -
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. -
equals
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 withObjects::equals(Object,Object). -
edgeLabels
public char[] edgeLabels()Returns the value of theedgeLabelsrecord component.- Returns:
- the value of the
edgeLabelsrecord component
-
children
Returns the value of thechildrenrecord component.- Returns:
- the value of the
childrenrecord component
-
orderedValues
Returns the value of theorderedValuesrecord component.- Returns:
- the value of the
orderedValuesrecord component
-
orderedCounts
public int[] orderedCounts()Returns the value of theorderedCountsrecord component.- Returns:
- the value of the
orderedCountsrecord component
-