diff --git a/alib2elgo/src/automaton/properties/efficient/AllEpsilonClosure.cpp b/alib2elgo/src/automaton/properties/efficient/AllEpsilonClosure.cpp index b7538d680a1a6c1df33f3c7b70c3b8a6b8a9db02..3ce2d4d16a22a0f6852ea00d5f4fa29efced7e83 100644 --- a/alib2elgo/src/automaton/properties/efficient/AllEpsilonClosure.cpp +++ b/alib2elgo/src/automaton/properties/efficient/AllEpsilonClosure.cpp @@ -14,16 +14,12 @@ namespace properties { namespace efficient { -auto AllEpsilonClosureEpsilonNFA = registration::OverloadRegister < AllEpsilonClosure, ext::map < DefaultStateType, ext::set < DefaultStateType > >, automaton::EpsilonNFA < > > ( AllEpsilonClosure::allEpsilonClosure ); -auto AllEpsilonClosureMultiInitialStateNFA = registration::OverloadRegister < AllEpsilonClosure, ext::map < DefaultStateType, ext::set < DefaultStateType > >, automaton::MultiInitialStateNFA < >> ( AllEpsilonClosure::allEpsilonClosure ); -auto AllEpsilonClosureNFA = registration::OverloadRegister < AllEpsilonClosure, ext::map < DefaultStateType, ext::set<DefaultStateType > >, automaton::NFA < > > ( AllEpsilonClosure::allEpsilonClosure ); -auto AllEpsilonClosureDFA = registration::OverloadRegister < AllEpsilonClosure, ext::map < DefaultStateType, ext::set<DefaultStateType > >, automaton::DFA < > > ( AllEpsilonClosure::allEpsilonClosure ); -auto AllEpsilonClosureExtendedNFA = registration::OverloadRegister < AllEpsilonClosure, ext::map < DefaultStateType, ext::set<DefaultStateType > >, automaton::ExtendedNFA < > > ( AllEpsilonClosure::allEpsilonClosure ); -auto AllEpsilonClosureCompactNFA = registration::OverloadRegister < AllEpsilonClosure, ext::map < DefaultStateType, ext::set<DefaultStateType > >, automaton::CompactNFA < > > ( AllEpsilonClosure::allEpsilonClosure ); - -ext::map<DefaultStateType, ext::set<DefaultStateType>> AllEpsilonClosure::allEpsilonClosure(const Automaton& automaton) { - return dispatch(automaton.getData()); -} +auto AllEpsilonClosureEpsilonNFA = registration::AbstractRegister < AllEpsilonClosure, ext::map < DefaultStateType, ext::set < DefaultStateType > >, const automaton::EpsilonNFA < > & > ( AllEpsilonClosure::allEpsilonClosure ); +auto AllEpsilonClosureMultiInitialStateNFA = registration::AbstractRegister < AllEpsilonClosure, ext::map < DefaultStateType, ext::set < DefaultStateType > >, const automaton::MultiInitialStateNFA < > & > ( AllEpsilonClosure::allEpsilonClosure ); +auto AllEpsilonClosureNFA = registration::AbstractRegister < AllEpsilonClosure, ext::map < DefaultStateType, ext::set<DefaultStateType > >, const automaton::NFA < > & > ( AllEpsilonClosure::allEpsilonClosure ); +auto AllEpsilonClosureDFA = registration::AbstractRegister < AllEpsilonClosure, ext::map < DefaultStateType, ext::set<DefaultStateType > >, const automaton::DFA < > & > ( AllEpsilonClosure::allEpsilonClosure ); +auto AllEpsilonClosureExtendedNFA = registration::AbstractRegister < AllEpsilonClosure, ext::map < DefaultStateType, ext::set<DefaultStateType > >, const automaton::ExtendedNFA < > & > ( AllEpsilonClosure::allEpsilonClosure ); +auto AllEpsilonClosureCompactNFA = registration::AbstractRegister < AllEpsilonClosure, ext::map < DefaultStateType, ext::set<DefaultStateType > >, const automaton::CompactNFA < > & > ( AllEpsilonClosure::allEpsilonClosure ); } /* namespace efficient */ diff --git a/alib2elgo/src/automaton/properties/efficient/AllEpsilonClosure.h b/alib2elgo/src/automaton/properties/efficient/AllEpsilonClosure.h index e247202e1413b267de8c535de895cd88fadbfb93..38a70bf568df3044b1f1efadf91061658d27d691 100644 --- a/alib2elgo/src/automaton/properties/efficient/AllEpsilonClosure.h +++ b/alib2elgo/src/automaton/properties/efficient/AllEpsilonClosure.h @@ -8,13 +8,9 @@ #ifndef EFFICIENT_ALL_EPSILON_CLOSURE_H_ #define EFFICIENT_ALL_EPSILON_CLOSURE_H_ -#include <core/multipleDispatch.hpp> #include <set> #include <map> -#include "automaton/Automaton.h" -#include "automaton/AutomatonFeatures.h" - #include <automaton/FSM/ExtendedNFA.h> #include <automaton/FSM/CompactNFA.h> #include <automaton/FSM/EpsilonNFA.h> @@ -22,10 +18,6 @@ #include <automaton/FSM/NFA.h> #include <automaton/FSM/DFA.h> -#include <set> -#include <map> -#include <iostream> - #include <regexp/properties/RegExpEpsilon.h> namespace automaton { @@ -34,12 +26,10 @@ namespace properties { namespace efficient { -class AllEpsilonClosure : public alib::SingleDispatch<AllEpsilonClosure, ext::map<DefaultStateType, ext::set<DefaultStateType>>, const automaton::AutomatonBase &> { +class AllEpsilonClosure { template < class StateType > static void process(const ext::map<StateType, ext::set<StateType>>& epsilonTransitions, const StateType * state, ext::map<StateType, ext::set<StateType>>& closures, ext::set<StateType>& visited, ext::set<StateType>& nonvisited); public: - static ext::map<DefaultStateType, ext::set<DefaultStateType>> allEpsilonClosure( const automaton::Automaton & automaton); - /** * Computes allEpsilon closure of a state in allEpsilon nonfree automaton */ diff --git a/alib2elgo/src/automaton/properties/efficient/ReachableStates.cpp b/alib2elgo/src/automaton/properties/efficient/ReachableStates.cpp index 9a5033081912faaf1b80e0df25079c9001c424fc..0dd8ab19c6792c5984e7e52c5ccba2d7375da72d 100644 --- a/alib2elgo/src/automaton/properties/efficient/ReachableStates.cpp +++ b/alib2elgo/src/automaton/properties/efficient/ReachableStates.cpp @@ -14,16 +14,12 @@ namespace properties { namespace efficient { -ext::set<DefaultStateType> ReachableStates::reachableStates(const Automaton& automaton) { - return dispatch(automaton.getData()); -} - -auto ReachableStatesEpsilonNFA = registration::OverloadRegister < ReachableStates, ext::set < DefaultStateType >, automaton::EpsilonNFA < > > ( ReachableStates::reachableStates ); -auto ReachableStatesNFA = registration::OverloadRegister < ReachableStates, ext::set < DefaultStateType >, automaton::NFA < > > ( ReachableStates::reachableStates ); -auto ReachableStatesCompactNFA = registration::OverloadRegister < ReachableStates, ext::set < DefaultStateType >, automaton::CompactNFA < > > ( ReachableStates::reachableStates ); -auto ReachableStatesExtendedNFA = registration::OverloadRegister < ReachableStates, ext::set < DefaultStateType >, automaton::ExtendedNFA < > > ( ReachableStates::reachableStates ); -auto ReachableStatesMultiInitialStateNFA = registration::OverloadRegister < ReachableStates, ext::set < DefaultStateType >, automaton::MultiInitialStateNFA < > > ( ReachableStates::reachableStates ); -auto ReachableStatesDFA = registration::OverloadRegister < ReachableStates, ext::set < DefaultStateType >, automaton::DFA < > > ( ReachableStates::reachableStates ); +auto ReachableStatesEpsilonNFA = registration::AbstractRegister < ReachableStates, ext::set < DefaultStateType >, const automaton::EpsilonNFA < > & > ( ReachableStates::reachableStates ); +auto ReachableStatesNFA = registration::AbstractRegister < ReachableStates, ext::set < DefaultStateType >, const automaton::NFA < > & > ( ReachableStates::reachableStates ); +auto ReachableStatesCompactNFA = registration::AbstractRegister < ReachableStates, ext::set < DefaultStateType >, const automaton::CompactNFA < > & > ( ReachableStates::reachableStates ); +auto ReachableStatesExtendedNFA = registration::AbstractRegister < ReachableStates, ext::set < DefaultStateType >, const automaton::ExtendedNFA < > & > ( ReachableStates::reachableStates ); +auto ReachableStatesMultiInitialStateNFA = registration::AbstractRegister < ReachableStates, ext::set < DefaultStateType >, const automaton::MultiInitialStateNFA < > & > ( ReachableStates::reachableStates ); +auto ReachableStatesDFA = registration::AbstractRegister < ReachableStates, ext::set < DefaultStateType >, const automaton::DFA < > & > ( ReachableStates::reachableStates ); } /* namespace efficient */ diff --git a/alib2elgo/src/automaton/properties/efficient/ReachableStates.h b/alib2elgo/src/automaton/properties/efficient/ReachableStates.h index 91fc8e19a0d6c0e4128f811760fc74ebcf4798cf..82b66de988b832c73180876f254853b958f53d08 100644 --- a/alib2elgo/src/automaton/properties/efficient/ReachableStates.h +++ b/alib2elgo/src/automaton/properties/efficient/ReachableStates.h @@ -8,16 +8,12 @@ #ifndef EFFICIENT_REACHABLE_STATES_H_ #define EFFICIENT_REACHABLE_STATES_H_ -#include <core/multipleDispatch.hpp> #include <algorithm> #include <deque> #include <set> #include <map> -#include <queue> #include <automaton/Automaton.h> -#include <automaton/AutomatonFeatures.h> - #include <automaton/FSM/ExtendedNFA.h> #include <automaton/FSM/CompactNFA.h> #include <automaton/FSM/EpsilonNFA.h> @@ -30,10 +26,8 @@ namespace properties { namespace efficient { -class ReachableStates : public alib::SingleDispatch<ReachableStates, ext::set<DefaultStateType>, const automaton::AutomatonBase &> { +class ReachableStates { public: - static ext::set<DefaultStateType> reachableStates( const automaton::Automaton & automaton ); - /** * Removes dead states from FSM. Melichar 2.29 */ diff --git a/alib2elgo/src/automaton/properties/efficient/UsefullStates.cpp b/alib2elgo/src/automaton/properties/efficient/UsefullStates.cpp index f77e601518a2a272b14ca0ed02a4de889bee6f00..dcfd2fc596f64e7074cfa4555ce91d03654cfaa7 100644 --- a/alib2elgo/src/automaton/properties/efficient/UsefullStates.cpp +++ b/alib2elgo/src/automaton/properties/efficient/UsefullStates.cpp @@ -14,16 +14,12 @@ namespace properties { namespace efficient { -ext::set<DefaultStateType> UsefullStates::usefullStates(const Automaton& automaton) { - return dispatch(automaton.getData()); -} - -auto UsefullStatesEpsilonNFA = registration::OverloadRegister < UsefullStates, ext::set < DefaultStateType >, automaton::EpsilonNFA < > > ( UsefullStates::usefullStates ); -auto UsefullStatesNFA = registration::OverloadRegister < UsefullStates, ext::set < DefaultStateType >, automaton::NFA < > > ( UsefullStates::usefullStates ); -auto UsefullStatesCompactNFA = registration::OverloadRegister < UsefullStates, ext::set < DefaultStateType >, automaton::CompactNFA < > > ( UsefullStates::usefullStates ); -auto UsefullStatesExtendedNFA = registration::OverloadRegister < UsefullStates, ext::set < DefaultStateType >, automaton::ExtendedNFA < > > ( UsefullStates::usefullStates ); -auto UsefullStatesMultiInitialStateNFA = registration::OverloadRegister < UsefullStates, ext::set < DefaultStateType >, automaton::MultiInitialStateNFA < > > ( UsefullStates::usefullStates ); -auto UsefullStatesDFA = registration::OverloadRegister < UsefullStates, ext::set < DefaultStateType >, automaton::DFA < > > ( UsefullStates::usefullStates ); +auto UsefullStatesEpsilonNFA = registration::AbstractRegister < UsefullStates, ext::set < DefaultStateType >, const automaton::EpsilonNFA < > & > ( UsefullStates::usefullStates ); +auto UsefullStatesNFA = registration::AbstractRegister < UsefullStates, ext::set < DefaultStateType >, const automaton::NFA < > & > ( UsefullStates::usefullStates ); +auto UsefullStatesCompactNFA = registration::AbstractRegister < UsefullStates, ext::set < DefaultStateType >, const automaton::CompactNFA < > & > ( UsefullStates::usefullStates ); +auto UsefullStatesExtendedNFA = registration::AbstractRegister < UsefullStates, ext::set < DefaultStateType >, const automaton::ExtendedNFA < > & > ( UsefullStates::usefullStates ); +auto UsefullStatesMultiInitialStateNFA = registration::AbstractRegister < UsefullStates, ext::set < DefaultStateType >, const automaton::MultiInitialStateNFA < > & > ( UsefullStates::usefullStates ); +auto UsefullStatesDFA = registration::AbstractRegister < UsefullStates, ext::set < DefaultStateType >, const automaton::DFA < > & > ( UsefullStates::usefullStates ); } /* namespace efficient */ diff --git a/alib2elgo/src/automaton/properties/efficient/UsefullStates.h b/alib2elgo/src/automaton/properties/efficient/UsefullStates.h index 51648a57718a4edbb669e944929ce7225066d8fa..c8be7796451db20564eaa6656a1148194a205e00 100644 --- a/alib2elgo/src/automaton/properties/efficient/UsefullStates.h +++ b/alib2elgo/src/automaton/properties/efficient/UsefullStates.h @@ -8,16 +8,12 @@ #ifndef EFFICIENT_USEFULL_STATES_H_ #define EFFICIENT_USEFULL_STATES_H_ -#include <core/multipleDispatch.hpp> #include <algorithm> #include <deque> #include <set> #include <map> -#include <queue> #include <automaton/Automaton.h> -#include <automaton/AutomatonFeatures.h> - #include <automaton/FSM/ExtendedNFA.h> #include <automaton/FSM/CompactNFA.h> #include <automaton/FSM/EpsilonNFA.h> @@ -30,10 +26,8 @@ namespace properties { namespace efficient { -class UsefullStates : public alib::SingleDispatch<UsefullStates, ext::set<DefaultStateType>, const automaton::AutomatonBase &> { +class UsefullStates { public: - static ext::set<DefaultStateType> usefullStates( const automaton::Automaton & automaton ); - /** * Removes dead states from FSM. Melichar 2.32 */ diff --git a/alib2elgo/src/automaton/simplify/efficient/EpsilonRemoverOutgoing.h b/alib2elgo/src/automaton/simplify/efficient/EpsilonRemoverOutgoing.h index b53e585e20cae2d23783edbede1bfd34cbfe14c6..28a48477b4c015442388eb2ce7536df290f9819c 100644 --- a/alib2elgo/src/automaton/simplify/efficient/EpsilonRemoverOutgoing.h +++ b/alib2elgo/src/automaton/simplify/efficient/EpsilonRemoverOutgoing.h @@ -24,7 +24,7 @@ namespace simplify { namespace efficient { -class EpsilonRemoverOutgoing : public alib::SingleDispatch < EpsilonRemoverOutgoing, automaton::Automaton, const automaton::AutomatonBase & > { +class EpsilonRemoverOutgoing { public: /** * Computes epsilon closure of a state in epsilon nonfree automaton