Class AbstractAutomatonBuilder<B extends AbstractAutomatonBuilder<B,A>, A extends Automaton>

java.lang.Object
org.eu.autogex.core.AbstractAutomatonBuilder<B,A>
Type Parameters:
B - The concrete Builder type (e.g., DFA.Builder)
A - The Automaton type to build (e.g., DFA)
Direct Known Subclasses:
DFA.Builder, ENFA.Builder, NFA.Builder

public abstract class AbstractAutomatonBuilder<B extends AbstractAutomatonBuilder<B,A>, A extends Automaton> extends Object
Abstract builder based on the Curiously Recurring Template Pattern (CRTP). Allows sharing state creation logic among all specific Builders (DFA, NFA, ENFA) while maintaining fluid method chaining.
  • Method Details

    • addState

      public B addState(String name, boolean isFinal)
      Adds a new state to the automaton.
      Parameters:
      name - The name of the state.
      isFinal - True if the state is an accepting state.
      Returns:
      The current builder instance.
    • setInitialState

      public B setInitialState(String name)
      Sets the initial state of the automaton.
      Parameters:
      name - The name of an already added state.
      Returns:
      The current builder instance.
    • build

      public abstract A build()
      Builds and returns the final automaton instance.
      Returns:
      The compiled automaton.
    • getStatesMap

      public Map<String,State> getStatesMap()
      Gets the map of all registered states.
      Returns:
      The states map.
    • getFinalStates

      public Set<State> getFinalStates()
      Gets the set of all registered final states.
      Returns:
      The final states set.
    • getInitialState

      public State getInitialState()
      Gets the registered initial state.
      Returns:
      The initial state.