cppformlang::finite_automata::NondeterministicTransitions class

A nondeterministic transition function in a finite automaton.

The difference between a deterministic transition is that the initial state and the transition symbol can specify a set of states

Derived classes

template<typename Transitions>
class FiniteAutomaton
Represents a general finite automaton.

Public functions

template<typename Functor>
void ForeachTransition(Functor f) const
Whether the transition function is deterministic.
auto TransitionsCount() const -> std::size_t
Gives the number of transitions describe by the function.

Protected functions

auto AddTransition(State from, Symbol by, State to) -> bool
Adds a new transition to the function.
auto RemoveTransition(State from, Symbol by, State to) -> bool
Removes a transition to the function.
auto IsDeterministic() const -> bool
Whether the transition function is deterministic.
auto operator()(State from, Symbol by) const -> const std::unordered_set<State>*
Removes a transition to the function.

Function documentation

template<typename Functor>
void cppformlang::finite_automata::NondeterministicTransitions::ForeachTransition(Functor f) const

Whether the transition function is deterministic.

Parameters
in/out The functor
Returns Nothing

std::size_t cppformlang::finite_automata::NondeterministicTransitions::TransitionsCount() const

Gives the number of transitions describe by the function.

Returns The number of transitions

bool cppformlang::finite_automata::NondeterministicTransitions::AddTransition(State from, Symbol by, State to) protected

Adds a new transition to the function.

Parameters
from in The source state
by in The transition symbol
to in The destination state
Returns true is the transition was not found and added, false otherwise

bool cppformlang::finite_automata::NondeterministicTransitions::RemoveTransition(State from, Symbol by, State to) protected

Removes a transition to the function.

Parameters
from in The source state
by in The transition symbol
to in The destination state
Returns true is the transition was found and removed, false otherwise

bool cppformlang::finite_automata::NondeterministicTransitions::IsDeterministic() const protected

Whether the transition function is deterministic.

Returns Whether the function is deterministic

const std::unordered_set<State>* cppformlang::finite_automata::NondeterministicTransitions::operator()(State from, Symbol by) const protected

Removes a transition to the function.

Parameters
from in The source state
by in The transition symbol
Returns The destination states or nullptr if it does not exists