template<typename Transitions>
FiniteAutomaton class
Represents a general finite automaton.
Contents
- Reference
Public functions
- auto AddTransition(State from, Symbol by, State to) -> bool
- Adds a transition to the finite automata.
- auto RemoveTransition(State from, Symbol by, State to) -> bool
- Remove a transition of the finite automata.
- auto SetStartState(State state, bool is_start) -> bool
- auto SetFinalState(State state, bool is_final) -> bool
- auto IsStateStart(State state) const -> bool
- auto IsStateFinal(State state) const -> bool
- auto IsAcyclic() const -> bool
- auto StatesCount() const -> std::size_t
- auto StartStatesCount() const -> std::size_t
- auto FinalStatesCount() const -> std::size_t
- auto SymbolsCount() const -> std::size_t
-
template<typename Functor>void ForeachState(Functor f) const
-
template<typename Functor>void ForeachStartState(Functor f) const
-
template<typename Functor>void ForeachFinalState(Functor f) const
-
template<typename Functor>void ForeachSymbol(Functor f) const
Protected variables
- std::unordered_map<State, std::uint32_t> states_
- std::unordered_set<State> start_states_
- std::unordered_set<State> final_states_
- std::unordered_map<Symbol, std::uint32_t> symbols_
Function documentation
template<typename Transitions>
bool cppformlang:: finite_automata:: FiniteAutomaton<Transitions>:: AddTransition(State from,
Symbol by,
State to)
Adds a transition to the finite automata.
Parameters | |
---|---|
from in | The source state |
by in | The transition symbol |
to in | The destination state |
Returns | true is the transition was added, false otherwise(was founded) |
template<typename Transitions>
bool cppformlang:: finite_automata:: FiniteAutomaton<Transitions>:: RemoveTransition(State from,
Symbol by,
State to)
Remove a transition of the finite automata.
Parameters | |
---|---|
from in | The source state |
by in | The transition symbol |
to in | The destination state |
Returns | true is the transition was removed, false otherwise(was not founded) |