java.lang.Object
io.jenetics.ext.grammar.Cfg.Rule.Builder<T>
- Type Parameters:
T- the terminal symbol value type
Builder class for building CFG rules.
- Since:
- 8.2
-
Method Summary
Modifier and TypeMethodDescriptionSets the rule annotation.build()Create a new rule object.final Cfg.Rule.Builder<T> E(Cfg.Symbol<T>... symbols) Builder method for creating an expression with the givensymbols.E(Consumer<? super Cfg.Expression.Builder<T>> builder) Builder method for creating a rule expression.Add an expression which consists solely of the given non-terminal symbol.Add an expression which consists solely of the given non-terminal symbol.Add an expression which consists solely of the given terminal symbol.Add an expression which consists solely of the given terminal symbol.Add an expression which consists solely of the given terminal symbol.
-
Method Details
-
E
Builder method for creating a rule expression.- Parameters:
builder- the expression builder- Returns:
thisbuilder for method chaining
-
E
Builder method for creating an expression with the givensymbols.- Parameters:
symbols- the expression symbols- Returns:
thisbuilder for method chaining- Throws:
IllegalArgumentException- if the list ofsymbolsis empty
-
N
Add an expression which consists solely of the given non-terminal symbol.- Parameters:
name- the symbol nameannotation- the symbol annotation- Returns:
thisbuilder for method chaining
-
N
Add an expression which consists solely of the given non-terminal symbol.- Parameters:
name- the symbol name- Returns:
thisbuilder for method chaining
-
T
Add an expression which consists solely of the given terminal symbol.- Parameters:
name- the symbol namevalue- the symbol valueannotation- the symbol annotation- Returns:
thisbuilder for method chaining
-
T
Add an expression which consists solely of the given terminal symbol.- Parameters:
name- the symbol namevalue- the symbol value- Returns:
thisbuilder for method chaining
-
T
Add an expression which consists solely of the given terminal symbol.- Parameters:
name- the symbol name- Returns:
thisbuilder for method chaining
-
at
Sets the rule annotation.- Parameters:
annotation- the rule annotation- Returns:
thisbuilder for method chaining
-
build
Create a new rule object.- Returns:
- a new rule object
-