Class Cfg.Expression.Builder<T>

java.lang.Object
io.jenetics.ext.grammar.Cfg.Expression.Builder<T>
Type Parameters:
T - the terminal symbol value type
Enclosing class:
Cfg.Expression<T>

public static final class Cfg.Expression.Builder<T> extends Object
Builder class for building rule expressions.
Since:
8.2
  • Method Details

    • add

      Add the given symbol to the expression.
      Parameters:
      symbol - the expression symbol
      Returns:
      this builder for method chaining
    • N

      public Cfg.Expression.Builder<T> N(String name, Object annotation)
      Add a non-terminal symbol to the expression.
      Parameters:
      name - the symbol name
      annotation - the symbol annotation
      Returns:
      this builder for method chaining
    • N

      public Cfg.Expression.Builder<T> N(String name)
      Add a non-terminal symbol to the expression.
      Parameters:
      name - the symbol name
      Returns:
      this builder for method chaining
    • T

      public Cfg.Expression.Builder<T> T(String name, T value, Object annotation)
      Add a non-terminal symbol to the expression.
      Parameters:
      name - the symbol name
      value - the symbol value
      annotation - the symbol annotation
      Returns:
      this builder for method chaining
    • T

      public Cfg.Expression.Builder<T> T(String name, T value)
      Add a non-terminal symbol to the expression.
      Parameters:
      name - the symbol name
      value - the symbol value
      Returns:
      this builder for method chaining
    • T

      public Cfg.Expression.Builder<T> T(String name)
      Add a non-terminal symbol to the expression.
      Parameters:
      name - the symbol name
      Returns:
      this builder for method chaining
      Throws:
      ClassCastException - if T is not a string
    • at

      public Cfg.Expression.Builder<T> at(Object annotation)
      Set the expression annotation.
      Parameters:
      annotation - the expression annotation
      Returns:
      this builder for method chaining
    • build

      public Cfg.Expression<T> build()
      Create a new rule object.
      Returns:
      a new rule object