java.lang.Object
java.lang.Record
io.jenetics.ext.grammar.Cfg.Rule<T>
- Type Parameters:
T
- the terminal symbol value type
public static record Cfg.Rule<T>(Cfg.NonTerminal<T> start, List<Cfg.Expression<T>> alternatives)
extends Record
Represents a production rule of the grammar (
R
).-
Constructor Summary
ConstructorDescriptionRule
(Cfg.NonTerminal<T> start, List<Cfg.Expression<T>> alternatives) Creates a new rule object. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thealternatives
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.start()
Returns the value of thestart
record component.final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
Rule
Creates a new rule object.- Parameters:
start
- the start symbol of the rulealternatives
- the list of alternative rule expressions- Throws:
IllegalArgumentException
- if the given list ofalternatives
is emptyNullPointerException
- if one of the arguments isnull
-
-
Method Details
-
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
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)
. -
start
Returns the value of thestart
record component.- Returns:
- the value of the
start
record component
-
alternatives
Returns the value of thealternatives
record component.- Returns:
- the value of the
alternatives
record component
-