Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
Public Types | Public Member Functions | Friends
automaton::ArcFactoredDeterministicZAutomaton< SymbolTypeT, StateTypeT > Class Template Referencefinal

Deterministic Z-Automaton in Arc-Factored Normal Form. Computation model for unranked regular tree languages. More...

#include <ArcFactoredDeterministicZAutomaton.h>

Inheritance diagram for automaton::ArcFactoredDeterministicZAutomaton< SymbolTypeT, StateTypeT >:
[legend]
Collaboration diagram for automaton::ArcFactoredDeterministicZAutomaton< SymbolTypeT, StateTypeT >:
[legend]

Public Types

typedef SymbolTypeT SymbolType
 
typedef StateTypeT StateType
 

Public Member Functions

 ArcFactoredDeterministicZAutomaton ()
 Creates a new instance of the automaton. More...
 
 ArcFactoredDeterministicZAutomaton (ext::set< StateType > states, ext::set< 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...
 
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< SymbolType > & getInputAlphabet () const &
 
ext::set< SymbolType > && getInputAlphabet () &&
 
bool addInputSymbol (SymbolType symbol)
 
void addInputSymbols (ext::set< SymbolType > symbols)
 
void setInputAlphabet (ext::set< SymbolType > symbols)
 
void removeInputSymbol (const SymbolType &symbol)
 
bool addTransition (ext::variant< SymbolType, ext::pair< StateType, StateType > > lhs, StateType rhs)
 Add a transition to the automaton. More...
 
bool addTransition (SymbolType lhs, StateType rhs)
 
bool addTransition (ext::pair< StateType, StateType > lhs, StateType rhs)
 
bool removeTransition (const ext::variant< SymbolType, ext::pair< StateType, StateType > > &lhs, const StateType &next)
 Removes a transition from the automaton. More...
 
const ext::map< ext::variant< SymbolType, ext::pair< StateType, StateType > >, StateType > & getTransitions () const &
 
ext::map< ext::variant< SymbolType, ext::pair< StateType, StateType > >, StateType > && getTransitions () &&
 
ext::map< ext::variant< SymbolType, ext::pair< StateType, StateType > >, StateTypegetTransitionsToState (const StateType &q) const
 
ext::map< ext::variant< SymbolType, ext::pair< StateType, StateType > >, StateTypegetTransitionsFromState (const StateType &q) const
 
auto operator<=> (const ArcFactoredDeterministicZAutomaton &other) const
 
bool operator== (const ArcFactoredDeterministicZAutomaton &other) const
 
- Public Member Functions inherited from core::Components< ArcFactoredDeterministicZAutomaton< DefaultSymbolType, DefaultStateType >, ext::set< DefaultSymbolType >, component::Set, InputAlphabet, ext::set< DefaultStateType >, component::Set, std::tuple< States, FinalStates > >
void accessComponent ()
 

Friends

ext::ostreamoperator<< (ext::ostream &out, const ArcFactoredDeterministicZAutomaton &instance)
 

Additional Inherited Members

- Static Public Member Functions inherited from core::Components< ArcFactoredDeterministicZAutomaton< DefaultSymbolType, DefaultStateType >, ext::set< DefaultSymbolType >, component::Set, InputAlphabet, ext::set< DefaultStateType >, component::Set, std::tuple< States, FinalStates > >
static void registerComponent ()
 
static void unregisterComponent ()
 

Detailed Description

template<class SymbolTypeT = DefaultSymbolType, class StateTypeT = DefaultStateType>
class automaton::ArcFactoredDeterministicZAutomaton< SymbolTypeT, StateTypeT >

Deterministic Z-Automaton in Arc-Factored Normal Form. Computation model for unranked regular tree languages.

Defined in Björklund, Drewes, Satta: Z-Automata for Compact and Direct Representation of Unranked Tree Languages https://doi.org/10.1007/978-3-030-23679-3_7

Nondeterministic Z-Automaton in Arc-Factored Normal Form is a Nondeterministic Z-Automaton where every transition is in arc-factored normal form. A transition is in arc-factored normal form if its lhs is in (\Sigma \cup Q(Q)).

Template Parameters
SymbolTypeTused for the symbols of the tree the automaton is executed on.
StateTypeTused for the states, and the initial state of the automaton.

Member Typedef Documentation

◆ StateType

template<class SymbolTypeT = DefaultSymbolType, class StateTypeT = DefaultStateType>
typedef StateTypeT automaton::ArcFactoredDeterministicZAutomaton< SymbolTypeT, StateTypeT >::StateType

◆ SymbolType

template<class SymbolTypeT = DefaultSymbolType, class StateTypeT = DefaultStateType>
typedef SymbolTypeT automaton::ArcFactoredDeterministicZAutomaton< SymbolTypeT, StateTypeT >::SymbolType

Constructor & Destructor Documentation

◆ ArcFactoredDeterministicZAutomaton() [1/2]

Creates a new instance of the automaton.

◆ ArcFactoredDeterministicZAutomaton() [2/2]

Creates a new instance of the automaton with a concrete set of states, input alphabet, and a set of final states.

Parameters
statesthe initial set of states of the automaton
inputAlphabetthe initial input alphabet
finalStatesthe initial set of final states of the automaton

Member Function Documentation

◆ addFinalState()

template<class SymbolTypeT = DefaultSymbolType, class StateTypeT = DefaultStateType>
bool automaton::ArcFactoredDeterministicZAutomaton< SymbolTypeT, StateTypeT >::addFinalState ( StateType  state)
inline

Adder of a final state.

Parameters
statethe new state to be added to a set of final states
Returns
true if the state was indeed added

◆ addInputSymbol()

template<class SymbolTypeT = DefaultSymbolType, class StateTypeT = DefaultStateType>
bool automaton::ArcFactoredDeterministicZAutomaton< SymbolTypeT, StateTypeT >::addInputSymbol ( SymbolType  symbol)
inline

Adder of a input symbol.

Parameters
symbolthe new symbol to be added to an input alphabet
Returns
true if the symbol was indeed added

◆ addInputSymbols()

template<class SymbolTypeT = DefaultSymbolType, class StateTypeT = DefaultStateType>
void automaton::ArcFactoredDeterministicZAutomaton< SymbolTypeT, StateTypeT >::addInputSymbols ( ext::set< SymbolType symbols)
inline

Adder of input symbols.

Parameters
symbolsnew symbols to be added to an input alphabet

◆ addState()

template<class SymbolTypeT = DefaultSymbolType, class StateTypeT = DefaultStateType>
bool automaton::ArcFactoredDeterministicZAutomaton< SymbolTypeT, StateTypeT >::addState ( StateType  state)
inline

Adder of a state.

Parameters
statethe new state to be added to a set of states
Returns
true if the state was indeed added

◆ addTransition() [1/3]

template<class SymbolType , class StateType >
bool automaton::ArcFactoredDeterministicZAutomaton< SymbolType, StateType >::addTransition ( ext::pair< StateType, StateType lhs,
StateType  rhs 
)

◆ addTransition() [2/3]

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

Parameters
childrenthe source states (A, B, C, ...)
currentthe input symbol (a)
nextthe target state (B)
Exceptions
AutomatonExceptionwhen transition contains state or symbol not present in the automaton components
Returns
true if the transition was indeed added
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addTransition() [3/3]

template<class SymbolType , class StateType >
bool automaton::ArcFactoredDeterministicZAutomaton< SymbolType, StateType >::addTransition ( SymbolType  lhs,
StateType  rhs 
)

◆ getFinalStates() [1/2]

template<class SymbolTypeT = DefaultSymbolType, class StateTypeT = DefaultStateType>
ext::set< StateType > && automaton::ArcFactoredDeterministicZAutomaton< SymbolTypeT, StateTypeT >::getFinalStates ( ) &&
inline

Getter of final states.

Returns
the final states of the automaton
Here is the call graph for this function:

◆ getFinalStates() [2/2]

template<class SymbolTypeT = DefaultSymbolType, class StateTypeT = DefaultStateType>
const ext::set< StateType > & automaton::ArcFactoredDeterministicZAutomaton< SymbolTypeT, StateTypeT >::getFinalStates ( ) const &
inline

Getter of final states.

Returns
the final states of the automaton
Here is the caller graph for this function:

◆ getInputAlphabet() [1/2]

template<class SymbolTypeT = DefaultSymbolType, class StateTypeT = DefaultStateType>
ext::set< SymbolType > && automaton::ArcFactoredDeterministicZAutomaton< SymbolTypeT, StateTypeT >::getInputAlphabet ( ) &&
inline

Getter of the input alphabet.

Returns
the input alphabet of the automaton
Here is the call graph for this function:

◆ getInputAlphabet() [2/2]

template<class SymbolTypeT = DefaultSymbolType, class StateTypeT = DefaultStateType>
const ext::set< SymbolType > & automaton::ArcFactoredDeterministicZAutomaton< SymbolTypeT, StateTypeT >::getInputAlphabet ( ) const &
inline

Getter of the input alphabet.

Returns
the input alphabet of the automaton
Here is the caller graph for this function:

◆ getStates() [1/2]

template<class SymbolTypeT = DefaultSymbolType, class StateTypeT = DefaultStateType>
ext::set< StateType > && automaton::ArcFactoredDeterministicZAutomaton< SymbolTypeT, StateTypeT >::getStates ( ) &&
inline

Getter of states.

Returns
the states of the automaton
Here is the call graph for this function:

◆ getStates() [2/2]

template<class SymbolTypeT = DefaultSymbolType, class StateTypeT = DefaultStateType>
const ext::set< StateType > & automaton::ArcFactoredDeterministicZAutomaton< SymbolTypeT, StateTypeT >::getStates ( ) const &
inline

Getter of states.

Returns
the states of the automaton
Here is the caller graph for this function:

◆ getTransitions() [1/2]

template<class SymbolTypeT = DefaultSymbolType, class StateTypeT = DefaultStateType>
ext::map< ext::variant< SymbolType, ext::pair< StateType, StateType > >, StateType > && automaton::ArcFactoredDeterministicZAutomaton< SymbolTypeT, StateTypeT >::getTransitions ( ) &&
inline

Get the transition function of the automaton in its natural form.

Returns
transition function of the automaton

◆ getTransitions() [2/2]

template<class SymbolTypeT = DefaultSymbolType, class StateTypeT = DefaultStateType>
const ext::map< ext::variant< SymbolType, ext::pair< StateType, StateType > >, StateType > & automaton::ArcFactoredDeterministicZAutomaton< SymbolTypeT, StateTypeT >::getTransitions ( ) const &
inline

Get the transition function of the automaton in its natural form.

Returns
transition function of the automaton
Here is the caller graph for this function:

◆ getTransitionsFromState()

template<class SymbolTypeT = DefaultSymbolType, class StateTypeT = DefaultStateType>
ext::map< ext::variant< SymbolType, ext::pair< StateType, StateType > >, StateType > automaton::ArcFactoredDeterministicZAutomaton< SymbolTypeT, StateTypeT >::getTransitionsFromState ( const StateType q) const
inline
Returns
transitions from state q
Here is the call graph for this function:

◆ getTransitionsToState()

template<class SymbolTypeT = DefaultSymbolType, class StateTypeT = DefaultStateType>
ext::map< ext::variant< SymbolType, ext::pair< StateType, StateType > >, StateType > automaton::ArcFactoredDeterministicZAutomaton< SymbolTypeT, StateTypeT >::getTransitionsToState ( const StateType q) const
inline
Returns
transitions to state q
Here is the call graph for this function:

◆ operator<=>()

template<class SymbolTypeT = DefaultSymbolType, class StateTypeT = DefaultStateType>
auto automaton::ArcFactoredDeterministicZAutomaton< SymbolTypeT, StateTypeT >::operator<=> ( const ArcFactoredDeterministicZAutomaton< SymbolTypeT, StateTypeT > &  other) const
inline

The three way comparison implementation

Parameters
otherthe other instance
Returns
the ordering between this object and the other.
Here is the call graph for this function:

◆ operator==()

template<class SymbolTypeT = DefaultSymbolType, class StateTypeT = DefaultStateType>
bool automaton::ArcFactoredDeterministicZAutomaton< SymbolTypeT, StateTypeT >::operator== ( const ArcFactoredDeterministicZAutomaton< SymbolTypeT, StateTypeT > &  other) const
inline

The equality comparison implementation.

Parameters
otherthe other object to compare with.
Returns
true if this and other objects are equal, false othervise
Here is the call graph for this function:

◆ removeFinalState()

template<class SymbolTypeT = DefaultSymbolType, class StateTypeT = DefaultStateType>
void automaton::ArcFactoredDeterministicZAutomaton< SymbolTypeT, StateTypeT >::removeFinalState ( const StateType state)
inline

Remover of a final state.

Parameters
statea state to be removed from a set of final states
Returns
true if the state was indeed removed

◆ removeInputSymbol()

template<class SymbolTypeT = DefaultSymbolType, class StateTypeT = DefaultStateType>
void automaton::ArcFactoredDeterministicZAutomaton< SymbolTypeT, StateTypeT >::removeInputSymbol ( const SymbolType symbol)
inline

Remover of an input symbol.

Parameters
symbola symbol to be removed from an input alphabet
Returns
true if the symbol was indeed removed

◆ removeState()

template<class SymbolTypeT = DefaultSymbolType, class StateTypeT = DefaultStateType>
void automaton::ArcFactoredDeterministicZAutomaton< SymbolTypeT, StateTypeT >::removeState ( const StateType state)
inline

Remover of a state.

Parameters
statea state to be removed from a set of states
Returns
true if the state was indeed removed

◆ removeTransition()

template<class SymbolType , class StateType >
bool automaton::ArcFactoredDeterministicZAutomaton< SymbolType, StateType >::removeTransition ( const ext::variant< SymbolType, ext::pair< StateType, StateType > > &  lhs,
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

Parameters
childrenthe source states (A, B, C, ...)
currentthe input symbol (a)
nextthe target state (B)
Returns
true if the transition was indeed removed

◆ setFinalStates()

template<class SymbolTypeT = DefaultSymbolType, class StateTypeT = DefaultStateType>
void automaton::ArcFactoredDeterministicZAutomaton< SymbolTypeT, StateTypeT >::setFinalStates ( ext::set< StateType states)
inline

Setter of final states.

Parameters
statescompletely new set of final states
Here is the caller graph for this function:

◆ setInputAlphabet()

template<class SymbolTypeT = DefaultSymbolType, class StateTypeT = DefaultStateType>
void automaton::ArcFactoredDeterministicZAutomaton< SymbolTypeT, StateTypeT >::setInputAlphabet ( ext::set< SymbolType symbols)
inline

Setter of input alphabet.

Parameters
symbolscompletely new input alphabet
Here is the caller graph for this function:

◆ setStates()

template<class SymbolTypeT = DefaultSymbolType, class StateTypeT = DefaultStateType>
void automaton::ArcFactoredDeterministicZAutomaton< SymbolTypeT, StateTypeT >::setStates ( ext::set< StateType states)
inline

Setter of states.

Parameters
statescompletely new set of states
Here is the caller graph for this function:

Friends And Related Function Documentation

◆ operator<<

template<class SymbolTypeT = DefaultSymbolType, class StateTypeT = DefaultStateType>
ext::ostream & operator<< ( ext::ostream out,
const ArcFactoredDeterministicZAutomaton< SymbolTypeT, StateTypeT > &  instance 
)
friend

Print this object as raw representation to ostream.

Parameters
outostream where to print
instanceobject to print
Returns
modified output stream

The documentation for this class was generated from the following file: