|
Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
|
Epsilon nondeterministic finite automaton. Accepts regular languages. More...
#include <EpsilonNFA.h>
Public Types | |
| typedef SymbolTypeT | SymbolType |
| typedef StateTypeT | StateType |
Additional Inherited Members | |
Static Public Member Functions inherited from core::Components< EpsilonNFA< DefaultSymbolType, DefaultStateType >, ext::set< DefaultSymbolType >, component::Set, InputAlphabet, ext::set< DefaultStateType >, component::Set, std::tuple< States, FinalStates >, DefaultStateType, component::Value, InitialState > | |
| static void | registerComponent () |
| static void | unregisterComponent () |
Epsilon nondeterministic finite automaton. Accepts regular languages.
Definition is classical definition of finite automata. A = (Q, T, I, \delta, F), Q (States) = nonempty finite set of states, T (TerminalAlphabet) = finite set of terminal symbols - having this empty won't let automaton do much though, I (InitialState) = initial state, \delta = transition function of the form A \times a -> P(Q), where A \in Q, a \in T \cup \epsilon\}, and P(Q) is a powerset of states, F (FinalStates) = set of final states
| SymbolTypeT | used for the terminal alphabet |
| StateTypeT | used to the states, and the initial state of the automaton. |
| typedef StateTypeT automaton::EpsilonNFA< SymbolTypeT, StateTypeT >::StateType |
| typedef SymbolTypeT automaton::EpsilonNFA< SymbolTypeT, StateTypeT >::SymbolType |
|
explicit |
Creates a new instance of the automaton with a concrete initial state.
| initialState | the initial state of the automaton |
|
explicit |
Creates a new instance of the automaton with a concrete set of states, input alphabet, initial state, and a set of final states.
| states | the initial set of states of the automaton |
| inputAlphabet | the initial input alphabet |
| initialState | the initial state of the automaton |
| finalStates | the initial set of final states of the automaton |
|
explicit |
|
explicit |
|
explicit |
|
inline |
Adder of a final state.
| state | the new state to be added to a set of final states |
|
inline |
Adder of a input symbol.
| symbol | the new symbol to be added to an input alphabet |
|
inline |
Adder of input symbols.
| symbols | new symbols to be added to an input alphabet |
|
inline |
Adder of a state.
| state | the new state to be added to a set of states |
| bool automaton::EpsilonNFA< SymbolType, StateType >::addTransition | ( | StateType | from, |
| common::symbol_or_epsilon< SymbolType > | input, | ||
| StateType | to | ||
| ) |
Add a transition to the automaton.
The transition is in a form A \times a -> B, where A, B \in Q and a \in T \cup \epsilon\}
| current | the source state (A) |
| input | the input symbol or epsilon (a) |
| next | the target state (B) |
| AutomatonException | when transition contains state or symbol not present in the automaton components |
| bool automaton::EpsilonNFA< SymbolType, StateType >::addTransition | ( | StateType | from, |
| StateType | to | ||
| ) |
Add a transition to the automaton.
The transition is in a form A \times \epsilon -> B, where A, B \in Q
| current | the source state (A) |
| next | the target state (B) |
| AutomatonException | when transition contains state or symbol not present in the automaton components |
| bool automaton::EpsilonNFA< SymbolType, StateType >::addTransition | ( | StateType | from, |
| SymbolType | input, | ||
| StateType | to | ||
| ) |
Add a transition to the automaton.
The transition is in a form A \times a -> B, where A, B \in Q and a \in T
| current | the source state (A) |
| input | the input symbol (a) |
| next | the target state (B) |
| AutomatonException | when transition contains state or symbol not present in the automaton components |
| ext::multimap< StateType, StateType > automaton::EpsilonNFA< SymbolType, StateType >::getEpsilonTransitions |
Get the epsilon transitions of the automaton
| ext::multimap< StateType, StateType > automaton::EpsilonNFA< SymbolType, StateType >::getEpsilonTransitionsFromState | ( | const StateType & | from | ) | const |
Get a subset of epsilon transitions of the automaton, with the source state fixed in the transitions natural representation.
| from | filter the transition function based on this state as a source state |
| ext::multimap< StateType, StateType > automaton::EpsilonNFA< SymbolType, StateType >::getEpsilonTransitionsToState | ( | const StateType & | to | ) | const |
Get a subset of epsilon transitions of the automaton, with the target state fixed in the transitions natural representation.
| to | filter the transition function based on this state as a source state |
|
inline |
Getter of final states.
|
inline |
Getter of final states.
|
inline |
Getter of the initial state.
|
inline |
Getter of the initial state.
|
inline |
Getter of the input alphabet.
|
inline |
Getter of the input alphabet.
|
inline |
Getter of states.
|
inline |
Getter of states.
| ext::multimap< ext::pair< StateType, SymbolType >, StateType > automaton::EpsilonNFA< SymbolType, StateType >::getSymbolTransitions |
Get the non-epsilon transitions of the automaton
| ext::multimap< ext::pair< StateType, SymbolType >, StateType > automaton::EpsilonNFA< SymbolType, StateType >::getSymbolTransitionsFromState | ( | const StateType & | from | ) | const |
Get a subset of non-epsilon transitions of the automaton, with the source state fixed in the transitions natural representation.
| from | filter the transition function based on this state as a source state |
| ext::multimap< ext::pair< StateType, SymbolType >, StateType > automaton::EpsilonNFA< SymbolType, StateType >::getSymbolTransitionsToState | ( | const StateType & | to | ) | const |
Get a subset of non-epsilon transitions of the automaton, with the target state fixed in the transitions natural representation.
| to | filter the transition function based on this state as a source state |
| ext::multimap< ext::pair< StateType, common::symbol_or_epsilon< SymbolType > >, StateType > && automaton::EpsilonNFA< SymbolType, StateType >::getTransitions | ( | ) | && |
Get the transition function of the automaton in its natural form.
| const ext::multimap< ext::pair< StateType, common::symbol_or_epsilon< SymbolType > >, StateType > & automaton::EpsilonNFA< SymbolType, StateType >::getTransitions | ( | ) | const & |
Get the transition function of the automaton in its natural form.
| ext::multimap< ext::pair< StateType, common::symbol_or_epsilon< SymbolType > >, StateType > automaton::EpsilonNFA< SymbolType, StateType >::getTransitionsFromState | ( | const StateType & | from | ) | const |
Get a subset of the transition function of the automaton, with the source state fixed in the transitions natural representation.
| from | filter the transition function based on this state as a source state |
| ext::multimap< ext::pair< StateType, common::symbol_or_epsilon< SymbolType > >, StateType > automaton::EpsilonNFA< SymbolType, StateType >::getTransitionsToState | ( | const StateType & | to | ) | const |
Get a subset of the transition function of the automaton, with the target state fixed in the transitions natural representation.
| to | filter the transition function based on this state as a source state |
| bool automaton::EpsilonNFA< SymbolType, StateType >::isDeterministic |
Determines whether the automaton is deterministic.
The automaton is deterministic if and only if:
is epsilon free. size of transition function \delta (from state, input symbol) \leq 1| bool automaton::EpsilonNFA< SymbolType, StateType >::isEpsilonFree |
Determines whether the automaton is without epsilon transitions.
| bool automaton::EpsilonNFA< SymbolType, StateType >::isTotal |
Determines whether the automaton is total deterministic.
The automaton is deterministic if and only if:
it is deterministic size of transition function \forall states and \forall input symbols \delta (from state, input symbol) = 1
|
inline |
The three way comparison implementation
| other | the other instance |
other.
|
inline |
The equality comparison implementation.
| other | the other object to compare with. |
|
inline |
Remover of a final state.
| state | a state to be removed from a set of final states |
|
inline |
Remover of an input symbol.
| symbol | a symbol to be removed from an input alphabet |
|
inline |
Remover of a state.
| state | a state to be removed from a set of states |
| bool automaton::EpsilonNFA< SymbolType, StateType >::removeTransition | ( | const StateType & | from, |
| const StateType & | to | ||
| ) |
Removes a transition from the automaton.
The transition is in a form A \times \epsilon -> B, where A, B \in Q
| current | the source state (A) |
| next | the target state (B) |
| bool automaton::EpsilonNFA< SymbolType, StateType >::removeTransition | ( | const StateType & | from, |
| const SymbolType & | input, | ||
| const StateType & | to | ||
| ) |
Removes a transition from the automaton.
The transition is in a form A \times a -> B, where A, B \in Q and a \in T
| current | the source state (A) |
| input | the input symbol (a) |
| next | the target state (B) |
| bool automaton::EpsilonNFA< SymbolType, StateType >::removeTransition | ( | StateType | from, |
| common::symbol_or_epsilon< SymbolType > | input, | ||
| StateType | to | ||
| ) |
Removes a transition to the automaton.
The transition is in a form A \times a -> B, where A, B \in Q and a \in T \cup \epsilon\}
| current | the source state (A) |
| input | the input symbol or epsilon (a) |
| next | the target state (B) |
| AutomatonException | when transition contains state or symbol not present in the automaton components |
|
inline |
Setter of final states.
| states | completely new set of final states |
|
inline |
Setter of the initial state.
| state | new initial state of the automaton |
|
inline |
Setter of input alphabet.
| symbols | completely new input alphabet |
|
inline |
Setter of states.
| states | completely new set of states |
|
friend |
Print this object as raw representation to ostream.
| out | ostream where to print |
| instance | object to print |