Class ENFA.Builder
- Enclosing class:
ENFA
Builder pattern to construct the ENFA fluently.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddEpsilonTransition(String fromName, String toName) Utility method to make silent transitions more readable.addTransition(String fromName, Character symbol, String toName) Adds a transition (standard or epsilon) between two states.build()Builds and returns the final automaton instance.Methods inherited from class AbstractAutomatonBuilder
addState, getFinalStates, getInitialState, getStatesMap, setInitialState
-
Constructor Details
-
Builder
public Builder()Default constructor for ENFA Builder.
-
-
Method Details
-
addTransition
Adds a transition (standard or epsilon) between two states.- Parameters:
fromName- The name of the source state.symbol- The character required for the transition (null for epsilon).toName- The name of the destination state.- Returns:
- The current builder instance.
-
addEpsilonTransition
Utility method to make silent transitions more readable.- Parameters:
fromName- The name of the source state.toName- The name of the destination state.- Returns:
- The current builder instance.
-
build
Description copied from class:AbstractAutomatonBuilderBuilds and returns the final automaton instance.- Specified by:
buildin classAbstractAutomatonBuilder<ENFA.Builder, ENFA>- Returns:
- The compiled automaton.
-