73template <
class SymbolTypeT = DefaultSymbolType,
class StateTypeT = DefaultStateType >
74class DFTA final :
public core::Components < DFTA < SymbolTypeT, StateTypeT >, ext::set < common::ranked_symbol < SymbolTypeT > >, component::Set, InputAlphabet, ext::set < StateTypeT >, component::Set, std::tuple < States, FinalStates > > {
106 return this->
template accessComponent < States > ( ).get ( );
115 return std::move ( this->
template accessComponent < States > ( ).
get ( ) );
126 return this->
template accessComponent < States > ( ).add ( std::move ( state ) );
135 this->
template accessComponent < States > ( ).set ( std::move ( states ) );
146 this->
template accessComponent < States > ( ).remove ( state );
155 return this->
template accessComponent < FinalStates > ( ).get ( );
164 return std::move ( this->
template accessComponent < FinalStates > ( ).
get ( ) );
175 return this->
template accessComponent < FinalStates > ( ).add ( std::move ( state ) );
184 this->
template accessComponent < FinalStates > ( ).set ( std::move ( states ) );
195 this->
template accessComponent < FinalStates > ( ).remove ( state );
204 return this->
template accessComponent < InputAlphabet > ( ).get ( );
213 return std::move ( this->
template accessComponent < InputAlphabet > ( ).
get ( ) );
224 return this->
template accessComponent < InputAlphabet > ( ).add ( std::move ( symbol ) );
233 this->
template accessComponent < InputAlphabet > ( ).add ( std::move ( symbols ) );
242 this->
template accessComponent < InputAlphabet > ( ).set ( std::move ( symbols ) );
253 this->
template accessComponent < InputAlphabet > ( ).remove ( symbol );
299 return std::move ( transitions );
309 if ( transition.second ==
q )
323 if ( std::find ( transition.first.second.begin ( ), transition.first.second.end ( ),
q ) != transition.first.second.end ( ) )
324 res.insert ( transition );
361 return out <<
"(DFTA"
362 <<
" states = " << instance.
getStates ( )
386template <
class SymbolType,
class StateType >
397template<
class SymbolType,
class StateType >
398DFTA < SymbolType, StateType >::DFTA (
ext::set < StateType > states,
ext::set < common::ranked_symbol < SymbolType > > inputAlphabet,
ext::set < StateType > finalStates ) :
core::Components <
DFTA,
ext::set <
common::ranked_symbol < SymbolType > >, component::Set, InputAlphabet,
ext::set < StateType >, component::Set, std::tuple < States, FinalStates > > ( std::move ( inputAlphabet ), std::move ( states ), std::move ( finalStates ) ) {
401template<
class SymbolType,
class StateType >
405template<
class SymbolType,
class StateType >
407 if ( prevStates.size ( ) != symbol.getRank ( ) )
410 if (! getInputAlphabet().count(symbol))
413 if (! getStates().count(next))
416 for (
const StateType & it : prevStates) {
417 if (! getStates().count(it))
422 if ( transitions.find ( key ) != transitions.end ( ) ) {
423 if ( transitions.find ( key )->second == next )
429 transitions.insert ( std::move ( key ), std::move ( next ) );
433template<
class SymbolType,
class StateType >
437 if ( transitions.find ( key ) == transitions.end ( ) )
440 if ( transitions.find ( key )->second != next )
443 transitions.erase(key);
457template<
class SymbolType,
class StateType >
470 if (t.first.first == symbol)
504template<
class SymbolType,
class StateType >
516 if (
automaton.getFinalStates ( ).count ( state ) )
520 if(
ext::contains(t.first.second.begin(), t.first.second.end(), state ) || t.second == state)
554template<
class SymbolType,
class StateType >
578 return automaton.template accessComponent < automaton::States > ( ).get ( ).count ( state );
596template <
class SymbolType,
class StateType >
610 res.addTransition ( std::move ( input ), std::move ( from ), std::move ( to ) );
static common::ranked_symbol< DefaultSymbolType > normalizeRankedSymbol(common::ranked_symbol< SymbolType > &&symbol)
Definition: SymbolNormalize.h:81
static ext::set< common::ranked_symbol< DefaultSymbolType > > normalizeRankedAlphabet(ext::set< common::ranked_symbol< SymbolType > > &&symbols)
Definition: SymbolNormalize.h:59
Definition: AutomatonException.h:15
static DefaultStateType normalizeState(StateType &&state)
Definition: AutomatonNormalize.h:76
static ext::multiset< DefaultStateType > normalizeStates(ext::multiset< StateType > &&states)
Definition: AutomatonNormalize.h:49
Nondeterministic finite tree automaton without epsilon transitions. Accepts regular tree languages.
Definition: DFTA.h:74
const ext::map< ext::pair< common::ranked_symbol< SymbolType >, ext::vector< StateType > >, StateType > & getTransitions() const &
Definition: DFTA.h:289
ext::map< ext::pair< common::ranked_symbol< SymbolType >, ext::vector< StateType > >, StateType > getTransitionsFromState(const StateType &q) const
Definition: DFTA.h:319
friend ext::ostream & operator<<(ext::ostream &out, const DFTA &instance)
Definition: DFTA.h:360
bool addInputSymbol(common::ranked_symbol< SymbolType > symbol)
Definition: DFTA.h:223
StateTypeT StateType
Definition: DFTA.h:77
const ext::set< common::ranked_symbol< SymbolType > > & getInputAlphabet() const &
Definition: DFTA.h:203
bool operator==(const DFTA &other) const
Definition: DFTA.h:348
void removeInputSymbol(const common::ranked_symbol< SymbolType > &symbol)
Definition: DFTA.h:252
DFTA()
Creates a new instance of the automaton.
Definition: DFTA.h:402
bool addFinalState(StateType state)
Definition: DFTA.h:174
ext::map< ext::pair< common::ranked_symbol< SymbolType >, ext::vector< StateType > >, StateType > getTransitionsToState(const StateType &q) const
Definition: DFTA.h:305
void addInputSymbols(ext::set< common::ranked_symbol< SymbolType > > symbols)
Definition: DFTA.h:232
void removeState(const StateType &state)
Definition: DFTA.h:145
void setFinalStates(ext::set< StateType > states)
Definition: DFTA.h:183
bool addTransition(common::ranked_symbol< SymbolType > symbol, ext::vector< StateType > prevStates, StateType next)
Add a transition to the automaton.
Definition: DFTA.h:406
ext::set< StateType > && getStates() &&
Definition: DFTA.h:114
ext::set< common::ranked_symbol< SymbolType > > && getInputAlphabet() &&
Definition: DFTA.h:212
ext::set< StateType > && getFinalStates() &&
Definition: DFTA.h:163
auto operator<=>(const DFTA &other) const
Definition: DFTA.h:337
bool removeTransition(const common::ranked_symbol< SymbolType > &symbol, const ext::vector< StateType > &states, const StateType &next)
Removes a transition from the automaton.
Definition: DFTA.h:434
void setInputAlphabet(ext::set< common::ranked_symbol< SymbolType > > symbols)
Definition: DFTA.h:241
ext::map< ext::pair< common::ranked_symbol< SymbolType >, ext::vector< StateType > >, StateType > && getTransitions() &&
Definition: DFTA.h:298
bool addState(StateType state)
Definition: DFTA.h:125
void removeFinalState(const StateType &state)
Definition: DFTA.h:194
const ext::set< StateType > & getFinalStates() const &
Definition: DFTA.h:154
void setStates(ext::set< StateType > states)
Definition: DFTA.h:134
const ext::set< StateType > & getStates() const &
Definition: DFTA.h:105
SymbolTypeT SymbolType
Definition: DFTA.h:76
Definition: ranked_symbol.hpp:20
Definition: components.hpp:181
static void valid(const automaton::DFTA< SymbolType, StateType > &, const StateType &)
Definition: DFTA.h:544
static bool used(const automaton::DFTA< SymbolType, StateType > &automaton, const StateType &state)
Definition: DFTA.h:515
static bool available(const automaton::DFTA< SymbolType, StateType > &, const StateType &)
Definition: DFTA.h:534
static void valid(const automaton::DFTA< SymbolType, StateType > &, const StateType &)
Definition: DFTA.h:587
static bool used(const automaton::DFTA< SymbolType, StateType > &, const StateType &)
Definition: DFTA.h:565
static bool available(const automaton::DFTA< SymbolType, StateType > &automaton, const StateType &state)
Definition: DFTA.h:577
static bool used(const automaton::DFTA< SymbolType, StateType > &automaton, const common::ranked_symbol< SymbolType > &symbol)
Definition: DFTA.h:468
static bool available(const automaton::DFTA< SymbolType, StateType > &, const common::ranked_symbol< SymbolType > &)
Definition: DFTA.h:484
static void valid(const automaton::DFTA< SymbolType, StateType > &, const common::ranked_symbol< SymbolType > &)
Definition: DFTA.h:494
Definition: setComponents.hpp:26
Class extending the map class from the standard library. Original reason is to allow printing of the ...
Definition: map.hpp:48
Class extending the pair class from the standard library. Original reason is to allow printing of the...
Definition: pair.hpp:43
Class extending the vector class from the standard library. Original reason is to allow printing of t...
Definition: vector.hpp:45
Definition: BarSymbol.cpp:12
typename T::StateType StateType
Definition: ToGrammarLeftRG.h:64
typename T::SymbolType SymbolType
Definition: ReachableStates.h:176
return res
Definition: MinimizeByPartitioning.h:145
q
Definition: SingleInitialStateEpsilonTransition.h:85
Definition: ToGrammar.h:31
constexpr bool isDFTA
Definition: DFTA.h:395
Definition: normalize.hpp:10
constexpr tuple< Elements &... > tie(Elements &... args) noexcept
Helper of extended tuple of references construction. The tuple is constructed to reffer to values in ...
Definition: tuple.hpp:218
reference_mover< T > make_mover(T ¶m)
Move adaptor construction function specialized to lvalue reference parameter.
Definition: iterator.hpp:468
bool contains(InputIt first, InputIt last, const Element &elem)
Linear version of search in a range of values.
Definition: algorithm.hpp:170
std::string to_string(const T &value)
To string method designated for objects that can be casted to string.
Definition: string.hpp:131
constexpr auto make_pair(T1 &&x, T2 &&y)
Definition: pair.hpp:79
auto & get(ext::ptr_array< Type, N > &tpl)
Specialisation of get function for pointer arrays.
Definition: ptr_array.hpp:693
static automaton::DFTA< > eval(automaton::DFTA< SymbolType, StateType > &&value)
Definition: DFTA.h:598
Definition: normalize.hpp:13