java.lang.Object
io.jenetics.ext.grammar.Cfg.Builder<T>
- Type Parameters:
T
- the terminal symbol value type
Builder class for building
Cfg
objects.- Since:
- 8.2
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Creates a new CFG object.R
(Cfg.NonTerminal<T> start, Consumer<? super Cfg.Rule.Builder<T>> builder) Building a new rule for the CFG.R
(String name, Consumer<? super Cfg.Rule.Builder<T>> builder) Building a new rule for the CFG.
-
Method Details
-
R
Building a new rule for the CFG.- Parameters:
start
- the rule startbuilder
- the rule builder- Returns:
this
builder for method chaining
-
R
Building a new rule for the CFG.- Parameters:
name
- the rule namebuilder
- the rule builder- Returns:
this
builder for method chaining
-
build
Creates a new CFG object.- Returns:
- a newly created CFG object
- Throws:
IllegalArgumentException
- if the rule list is empty or a rule is defined more than once, the start symbol points to a missing rule or the rules uses symbols not defined in the list ofCfg.nonTerminals()
orCfg.terminals()
- See Also:
-