Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
|
Nondeterministic finite tree automaton without epsilon transitions. Accepts regular tree languages. More...
#include <ExtendedNFTA.h>
Public Member Functions | |
ExtendedNFTA () | |
Creates a new instance of the automaton. More... | |
ExtendedNFTA (ext::set< StateType > states, ext::set< common::ranked_symbol< SymbolType > > inputAlphabet, ext::set< StateType > finalStates) | |
Creates a new instance of the automaton with a concrete set of states, input alphabet, and a set of final states. More... | |
ExtendedNFTA (const DFTA< SymbolType, StateType > &other) | |
ExtendedNFTA (const NFTA< SymbolType, StateType > &other) | |
const ext::set< StateType > & | getStates () const & |
ext::set< StateType > && | getStates () && |
bool | addState (StateType state) |
void | setStates (ext::set< StateType > states) |
void | removeState (const StateType &state) |
const ext::set< StateType > & | getFinalStates () const & |
ext::set< StateType > && | getFinalStates () && |
bool | addFinalState (StateType state) |
void | setFinalStates (ext::set< StateType > states) |
void | removeFinalState (const StateType &state) |
const ext::set< common::ranked_symbol< SymbolType > > & | getInputAlphabet () const & |
ext::set< common::ranked_symbol< SymbolType > > && | getInputAlphabet () && |
bool | addInputSymbol (common::ranked_symbol< SymbolType > symbol) |
void | addInputSymbols (ext::set< common::ranked_symbol< SymbolType > > symbols) |
void | setInputAlphabet (ext::set< common::ranked_symbol< SymbolType > > symbols) |
void | removeInputSymbol (const common::ranked_symbol< SymbolType > &symbol) |
bool | addTransition (rte::FormalRTEStructure< ext::variant< SymbolType, StateType > > rte, ext::vector< StateType >, StateType next) |
Add a transition to the automaton. More... | |
void | addTransitions (rte::FormalRTEStructure< ext::variant< SymbolType, StateType > > rte, ext::vector< StateType >, ext::set< StateType > next) |
Add a transition to the automaton. More... | |
bool | removeTransition (const rte::FormalRTEStructure< ext::variant< SymbolType, StateType > > &rte, const ext::vector< StateType > &prevStates, const StateType &next) |
Removes a transition from the automaton. More... | |
const ext::map< ext::pair< rte::FormalRTEStructure< ext::variant< SymbolType, StateType > >, ext::vector< StateType > >, ext::set< StateType > > & | getTransitions () const & |
ext::map< ext::pair< rte::FormalRTEStructure< ext::variant< SymbolType, StateType > >, ext::vector< StateType > >, ext::set< StateType > > && | getTransitions () && |
ext::map< ext::pair< rte::FormalRTEStructure< ext::variant< SymbolType, StateType > >, ext::vector< StateType > >, StateType > | getTransitionsToState (const StateType &to) const |
ext::map< ext::pair< rte::FormalRTEStructure< ext::variant< SymbolType, StateType > >, ext::vector< StateType > >, ext::set< StateType > > | getTransitionsFromState (const StateType &from) const |
bool | isDeterministic () const |
Determines whether the automaton is deterministic. More... | |
unsigned | transitionsSize () const |
Computes number of transitions in the automaton. More... | |
auto | operator<=> (const ExtendedNFTA &other) const |
bool | operator== (const ExtendedNFTA &other) const |
![]() | |
void | accessComponent () |
Friends | |
ext::ostream & | operator<< (ext::ostream &out, const ExtendedNFTA &instance) |
Additional Inherited Members | |
![]() | |
static void | registerComponent () |
static void | unregisterComponent () |
Nondeterministic finite tree automaton without epsilon transitions. Accepts regular tree languages.
Definition is classical definition of finite automata. A = (Q, T, \delta, F), Q (States) = nonempty finite set of states, T (TerminalAlphabet) = finite set of terminal ranked symbols - having this empty won't let automaton do much though, \delta = transition function of the form (A, B, C, ...) \times a -> P(Q), where A, B, C, ... \in Q, a \in T, and P(Q) is a powerset of states, F (FinalStates) = set of final states
Elements of the \delta mapping must meet following criteria. The size of the state list must equal the rank of the ranked symbol.
SymbolType | used for the symbol part of the ranked symbol |
StateType | used to the states, and the initial state of the automaton. |
|
explicit |
Creates a new instance of the automaton.
|
explicit |
Creates a new instance of the automaton with a concrete set of states, input alphabet, and a set of final states.
states | the initial set of states of the automaton |
inputAlphabet | the initial input alphabet |
finalStates | the initial set of final states of the automaton |
|
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::ExtendedNFTA< SymbolType, StateType >::addTransition | ( | rte::FormalRTEStructure< ext::variant< SymbolType, StateType > > | rte, |
ext::vector< StateType > | prevStates, | ||
StateType | next | ||
) |
Add a transition to the automaton.
The transition is in a form ( A, B, C, ... ) \times a -> X, where A, B, C, ..., X \in Q and a \in T
children | the source states (A, B, C, ...) |
current | the input symbol (a) |
next | the target state (B) |
AutomatonException | when transition contains state or symbol not present in the automaton components |
void automaton::ExtendedNFTA< SymbolType, StateType >::addTransitions | ( | rte::FormalRTEStructure< ext::variant< SymbolType, StateType > > | rte, |
ext::vector< StateType > | prevStates, | ||
ext::set< StateType > | next | ||
) |
Add a transition to the automaton.
The transition is in a form ( A, B, C, ... ) \times a -> P(Q), where A, B, C, ... \in Q and a \in T, P(Q) is a powerset of states
children | the source states (A, B, C, ...) |
current | the input symbol (a) |
next | the target states (P(Q)) |
AutomatonException | when transition contains state or symbol not present in the automaton components |
|
inline |
Getter of final states.
|
inline |
Getter of final states.
|
inline |
Getter of the input alphabet.
|
inline |
Getter of the input alphabet.
|
inline |
Getter of states.
|
inline |
Getter of states.
|
inline |
Get the transition function of the automaton in its natural form.
|
inline |
Get the transition function of the automaton in its natural form.
ext::map< ext::pair< rte::FormalRTEStructure< ext::variant< SymbolType, StateType > >, ext::vector< StateType > >, ext::set< StateType > > automaton::ExtendedNFTA< SymbolType, StateType >::getTransitionsFromState | ( | const StateType & | from | ) | const |
q
is a source state ext::map< ext::pair< rte::FormalRTEStructure< ext::variant< SymbolType, StateType > >, ext::vector< StateType > >, StateType > automaton::ExtendedNFTA< SymbolType, StateType >::getTransitionsToState | ( | const StateType & | to | ) | const |
q
is a target state bool automaton::ExtendedNFTA< SymbolType, StateType >::isDeterministic |
Determines whether the automaton is deterministic.
the automaton is deterministic if and only if:
size
of transition function \delta (from states, input symbol) \leq 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::ExtendedNFTA< SymbolType, StateType >::removeTransition | ( | const rte::FormalRTEStructure< ext::variant< SymbolType, StateType > > & | rte, |
const ext::vector< StateType > & | prevStates, | ||
const StateType & | next | ||
) |
Removes a transition from the automaton.
The transition is in a form ( A, B, C, ... ) \times a -> X, where A, B, C, ..., X \in Q and a \in T
children | the source states (A, B, C, ...) |
current | the input symbol (a) |
next | the target state (B) |
|
inline |
Setter of final states.
states | completely new set of final states |
|
inline |
Setter of input alphabet.
symbols | completely new input alphabet |
|
inline |
Setter of states.
states | completely new set of states |
unsigned automaton::ExtendedNFTA< SymbolType, StateType >::transitionsSize |
Computes number of transitions in the automaton.
|
friend |
Print this object as raw representation to ostream.
out | ostream where to print |
instance | object to print |