Interface SymbolIndex

All Known Implementing Classes:
Codons
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

Functional interface for selecting a Cfg.Symbol by its index within a rule. It is an abstraction of the codon values used for selecting the alternatives from a rule during the sentence generation.
Since:
7.1
Version:
7.1
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    next(Cfg.Rule<?> rule, int bound)
    Selects an index with the given upper bound, exclusively.
    Create a new symbol-index object from the given random generator.
  • Method Details

    • next

      int next(Cfg.Rule<?> rule, int bound)
      Selects an index with the given upper bound, exclusively.
      Parameters:
      rule - the rule which requested the index
      bound - the upper bound of the symbol index, exclusively
      Returns:
      the next symbol index
      Throws:
      IllegalArgumentException - if the given bound is smaller than one
    • of

      static SymbolIndex of(RandomGenerator random)
      Create a new symbol-index object from the given random generator. This can be used for generating random sentences of derivation-trees.
      Parameters:
      random - the random generator used for generating the sentences
      Returns:
      a new symbol-index object from the given random generator
      Throws:
      NullPointerException - if the given random generator is null