74template <
class SymbolType = DefaultSymbolType,
class StateType = DefaultStateType >
75class ExtendedNFTA final :
public core::Components < ExtendedNFTA < SymbolType, StateType >, ext::set < common::ranked_symbol < SymbolType > >, component::Set, InputAlphabet, ext::set < StateType >, component::Set, std::tuple < States, FinalStates > > {
116 return this->
template accessComponent < States > ( ).get ( );
125 return std::move ( this->
template accessComponent < States > ( ).
get ( ) );
136 return this->
template accessComponent < States > ( ).add ( std::move ( state ) );
145 this->
template accessComponent < States > ( ).set ( std::move ( states ) );
156 this->
template accessComponent < States > ( ).remove ( state );
165 return this->
template accessComponent < FinalStates > ( ).get ( );
174 return std::move ( this->
template accessComponent < FinalStates > ( ).
get ( ) );
185 return this->
template accessComponent < FinalStates > ( ).add ( std::move ( state ) );
194 this->
template accessComponent < FinalStates > ( ).set ( std::move ( states ) );
205 this->
template accessComponent < FinalStates > ( ).remove ( state );
214 return this->
template accessComponent < InputAlphabet > ( ).get ( );
223 return std::move ( this->
template accessComponent < InputAlphabet > ( ).
get ( ) );
234 return this->
template accessComponent < InputAlphabet > ( ).add ( std::move ( symbol ) );
243 this->
template accessComponent < InputAlphabet > ( ).add ( std::move ( symbols ) );
252 this->
template accessComponent < InputAlphabet > ( ).set ( std::move ( symbols ) );
263 this->
template accessComponent < InputAlphabet > ( ).remove ( symbol );
324 return std::move ( transitions );
385 return out <<
"(ExtendedNFTA"
386 <<
" states = " << instance.
getStates ( )
394template <
class SymbolType,
class StateType >
395ExtendedNFTA < SymbolType, StateType >::ExtendedNFTA (
ext::set < StateType > states,
ext::set < common::ranked_symbol < SymbolType > > inputAlphabet,
ext::set < StateType > finalStates ) :
core::Components <
ExtendedNFTA,
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 ) ) {
398template <
class SymbolType,
class StateType >
402template <
class SymbolType,
class StateType >
404 for (
const auto & transition : other.getTransitions ( ) ) {
409 for (
const StateType & state : transition.first.second )
414 transitions [
ext::make_pair (
rte, transition.first.second ) ].insert ( transition.second );
418template <
class SymbolType,
class StateType >
420 for (
const auto & transition : other.getTransitions ( ) ) {
425 for (
const StateType & state : transition.first.second )
430 transitions [
ext::make_pair (
rte, transition.first.second ) ].insert ( transition.second );
434template <
class SymbolType,
class StateType >
444 if (! getStates().count(next))
448 if (! getStates().count(it))
453 return transitions [ std::move ( key ) ].insert ( std::move ( next ) ).second;
456template <
class SymbolType,
class StateType >
466 if ( !std::includes ( getStates ( ).
begin ( ), getStates ( ).
end ( ), next.begin ( ), next.end ( ) ) )
470 if (! getStates().count(it))
478template <
class SymbolType,
class StateType >
481 return transitions [ key ].erase ( next );
484template <
class SymbolType,
class StateType >
490template <
class SymbolType,
class StateType >
494 for(
const auto& transition : transitions )
495 res += transition.second.size();
500template<
class SymbolType,
class StateType >
502 if ( !getStates ( ).count ( to ) )
507 for (
const auto & transition : transitions )
508 if ( transition.second.count ( to ) > 0 )
514template<
class SymbolType,
class StateType >
516 if ( !getStates ( ).count ( from ) )
521 for (
const auto & transition : transitions )
522 if ( std::find ( transition.first.second.begin ( ), transition.first.second.end ( ), from ) != transition.first.second.end ( ) )
523 res.insert ( transition );
538template <
class SymbolType,
class StateType >
586template <
class SymbolType,
class StateType >
598 if (
automaton.getFinalStates ( ).count ( state ) )
602 if(
ext::contains(t.first.second.begin(), t.first.second.end(), state ) || t .
second.count ( state ) )
635template <
class SymbolType,
class StateType >
659 return automaton.template accessComponent < automaton::States > ( ).get ( ).count ( state );
677template <
class SymbolType,
class StateType >
691 res.addTransitions ( std::move (
rte ), std::move ( from ), std::move ( to ) );
static ext::set< common::ranked_symbol< DefaultSymbolType > > normalizeRankedAlphabet(ext::set< common::ranked_symbol< SymbolType > > &&symbols)
Definition: SymbolNormalize.h:59
Definition: AutomatonException.h:15
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
Nondeterministic finite tree automaton without epsilon transitions. Accepts regular tree languages.
Definition: ExtendedNFTA.h:75
bool isDeterministic() const
Determines whether the automaton is deterministic.
Definition: ExtendedNFTA.h:485
ext::map< ext::pair< rte::FormalRTEStructure< ext::variant< SymbolType, StateType > >, ext::vector< StateType > >, ext::set< StateType > > && getTransitions() &&
Definition: ExtendedNFTA.h:323
void removeInputSymbol(const common::ranked_symbol< SymbolType > &symbol)
Definition: ExtendedNFTA.h:262
bool operator==(const ExtendedNFTA &other) const
Definition: ExtendedNFTA.h:372
ext::map< ext::pair< rte::FormalRTEStructure< ext::variant< SymbolType, StateType > >, ext::vector< StateType > >, StateType > getTransitionsToState(const StateType &to) const
Definition: ExtendedNFTA.h:501
void addTransitions(rte::FormalRTEStructure< ext::variant< SymbolType, StateType > > rte, ext::vector< StateType >, ext::set< StateType > next)
Add a transition to the automaton.
Definition: ExtendedNFTA.h:457
bool removeTransition(const rte::FormalRTEStructure< ext::variant< SymbolType, StateType > > &rte, const ext::vector< StateType > &prevStates, const StateType &next)
Removes a transition from the automaton.
Definition: ExtendedNFTA.h:479
void setStates(ext::set< StateType > states)
Definition: ExtendedNFTA.h:144
bool addTransition(rte::FormalRTEStructure< ext::variant< SymbolType, StateType > > rte, ext::vector< StateType >, StateType next)
Add a transition to the automaton.
Definition: ExtendedNFTA.h:435
ext::set< common::ranked_symbol< SymbolType > > && getInputAlphabet() &&
Definition: ExtendedNFTA.h:222
const ext::set< StateType > & getStates() const &
Definition: ExtendedNFTA.h:115
friend ext::ostream & operator<<(ext::ostream &out, const ExtendedNFTA &instance)
Definition: ExtendedNFTA.h:384
void removeState(const StateType &state)
Definition: ExtendedNFTA.h:155
void removeFinalState(const StateType &state)
Definition: ExtendedNFTA.h:204
const ext::map< ext::pair< rte::FormalRTEStructure< ext::variant< SymbolType, StateType > >, ext::vector< StateType > >, ext::set< StateType > > & getTransitions() const &
Definition: ExtendedNFTA.h:314
void addInputSymbols(ext::set< common::ranked_symbol< SymbolType > > symbols)
Definition: ExtendedNFTA.h:242
bool addFinalState(StateType state)
Definition: ExtendedNFTA.h:184
ext::set< StateType > && getFinalStates() &&
Definition: ExtendedNFTA.h:173
unsigned transitionsSize() const
Computes number of transitions in the automaton.
Definition: ExtendedNFTA.h:491
bool addInputSymbol(common::ranked_symbol< SymbolType > symbol)
Definition: ExtendedNFTA.h:233
auto operator<=>(const ExtendedNFTA &other) const
Definition: ExtendedNFTA.h:361
const ext::set< StateType > & getFinalStates() const &
Definition: ExtendedNFTA.h:164
ext::set< StateType > && getStates() &&
Definition: ExtendedNFTA.h:124
ExtendedNFTA()
Creates a new instance of the automaton.
Definition: ExtendedNFTA.h:399
const ext::set< common::ranked_symbol< SymbolType > > & getInputAlphabet() const &
Definition: ExtendedNFTA.h:213
void setFinalStates(ext::set< StateType > states)
Definition: ExtendedNFTA.h:193
bool addState(StateType state)
Definition: ExtendedNFTA.h:135
ext::map< ext::pair< rte::FormalRTEStructure< ext::variant< SymbolType, StateType > >, ext::vector< StateType > >, ext::set< StateType > > getTransitionsFromState(const StateType &from) const
Definition: ExtendedNFTA.h:515
void setInputAlphabet(ext::set< common::ranked_symbol< SymbolType > > symbols)
Definition: ExtendedNFTA.h:251
Nondeterministic finite tree automaton without epsilon transitions. Accepts regular tree languages.
Definition: NFTA.h:72
Definition: ranked_symbol.hpp:20
Definition: components.hpp:181
static bool used(const automaton::ExtendedNFTA< SymbolType, StateType > &, const common::ranked_symbol< SymbolType > &)
Definition: ExtendedNFTA.h:549
static bool available(const automaton::ExtendedNFTA< SymbolType, StateType > &, const common::ranked_symbol< SymbolType > &)
Definition: ExtendedNFTA.h:566
static void valid(const automaton::ExtendedNFTA< SymbolType, StateType > &, const common::ranked_symbol< SymbolType > &)
Definition: ExtendedNFTA.h:576
static void valid(const automaton::ExtendedNFTA< SymbolType, StateType > &, const StateType &)
Definition: ExtendedNFTA.h:668
static bool available(const automaton::ExtendedNFTA< SymbolType, StateType > &automaton, const StateType &state)
Definition: ExtendedNFTA.h:658
static bool used(const automaton::ExtendedNFTA< SymbolType, StateType > &, const StateType &)
Definition: ExtendedNFTA.h:646
static void valid(const automaton::ExtendedNFTA< SymbolType, StateType > &, const StateType &)
Definition: ExtendedNFTA.h:626
static bool used(const automaton::ExtendedNFTA< SymbolType, StateType > &automaton, const StateType &state)
Definition: ExtendedNFTA.h:597
static bool available(const automaton::ExtendedNFTA< SymbolType, StateType > &, const StateType &)
Definition: ExtendedNFTA.h:616
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
Implementation of vector storing dynamicaly allocated instances of given type. The class mimicks the ...
Definition: ptr_vector.hpp:44
void push_back(R &&value)
Appends a new value at the end of the container.
Definition: ptr_vector.hpp:1228
Implementation of the variant class allowing to store any type of those listed in the template parame...
Definition: variant.hpp:98
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
p second
Definition: ToRegExpAlgebraic.h:126
return res
Definition: MinimizeByPartitioning.h:145
Definition: ToGrammar.h:31
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 begin(Container &&cont) -> decltype(std::forward(cont).begin())
Definition: iterator.hpp:900
void end()
Definition: measurements.cpp:19
Definition: ToFTAGlushkov.h:22
auto & get(ext::ptr_array< Type, N > &tpl)
Specialisation of get function for pointer arrays.
Definition: ptr_array.hpp:693
static automaton::ExtendedNFTA< > eval(automaton::ExtendedNFTA< SymbolType, StateType > &&value)
Definition: ExtendedNFTA.h:679
Definition: normalize.hpp:13