diff --git a/alib2data/src/automaton/PDA/DPDA.h b/alib2data/src/automaton/PDA/DPDA.h index e08468bc77f698d8f512fcb2a21b637108469325..ac1886daf3a4141f86c33aa3bde466498b01aac9 100644 --- a/alib2data/src/automaton/PDA/DPDA.h +++ b/alib2data/src/automaton/PDA/DPDA.h @@ -24,6 +24,7 @@ #include "../AutomatonException.h" #include "../common/AutomatonFromXMLParser.h" #include "../common/AutomatonToXMLComposer.h" +#include "../common/AutomatonNormalize.h" namespace automaton { @@ -205,6 +206,30 @@ public: void composeTransitions ( std::deque < sax::Token > & out ) const; virtual alib::ObjectBase * inc ( ) &&; + + virtual AutomatonBase * normalize ( ) && { + std::set < DefaultSymbolType > alphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < InputAlphabet > ( ).get ( ) ) ); + std::set < DefaultSymbolType > pushdownAlphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < PushdownStoreAlphabet > ( ).get ( ) ) ); + DefaultSymbolType initialSymbol = AutomatonNormalize::normalizeSymbol ( std::move ( this->template accessElement < InitialSymbol > ( ).get ( ) ) ); + std::set < DefaultStateType > states = AutomatonNormalize::normalizeStates ( std::move ( this->template accessComponent < States > ( ).get ( ) ) ); + DefaultStateType initialState = AutomatonNormalize::normalizeState ( std::move ( this->template accessElement < InitialState > ( ).get ( ) ) ); + std::set < DefaultStateType > finalStates = AutomatonNormalize::normalizeStates ( std::move ( this->template accessComponent < FinalStates > ( ).get ( ) ) ); + + std::map < std::tuple < DefaultStateType, std::variant < DefaultEpsilonType, DefaultSymbolType >, std::vector < DefaultSymbolType > >, std::pair < DefaultStateType, std::vector < DefaultSymbolType > > > new_transitions; + for ( std::pair < std::tuple < StateType, std::variant < EpsilonType, InputSymbolType >, std::vector < PushdownStoreSymbolType > >, std::pair < StateType, std::vector < PushdownStoreSymbolType > > > && transition : std::make_moveable_map ( transitions ) ) { + std::pair < DefaultStateType, std::vector < DefaultSymbolType > > target = std::make_pair ( AutomatonNormalize::normalizeState ( std::move ( transition.second.first ) ), AutomatonNormalize::normalizeSymbols ( std::move ( transition.second.second ) ) ); + + std::vector < DefaultSymbolType > pop = AutomatonNormalize::normalizeSymbols ( std::move ( std::get < 2 > ( transition.first ) ) ); + auto key = std::make_tuple ( AutomatonNormalize::normalizeState ( std::move ( std::get < 0 > ( transition.first ) ) ), AutomatonNormalize::normalizeSymbolEpsilon ( std::move ( std::get < 1 > ( transition.first ) ) ), std::move ( pop ) ); + + new_transitions.insert ( std::make_pair ( std::move ( key ), std::move ( target ) ) ); + } + + DPDA < > * res = new DPDA < > ( std::move ( states ), std::move ( alphabet ), std::move ( pushdownAlphabet ), std::move ( initialState ), std::move ( initialSymbol ), std::move ( finalStates ) ); + res->transitions = std::move ( new_transitions ); + + return res; + } }; template < class InputSymbolType, class EpsilonType, class PushdownStoreSymbolType, class StateType > diff --git a/alib2data/src/automaton/PDA/InputDrivenDPDA.h b/alib2data/src/automaton/PDA/InputDrivenDPDA.h index 74078a4752a7096c6ddbd7d817060db9ed194d29..4fde07b4a0b0c66541cdb80ce06b84b1b8312d71 100644 --- a/alib2data/src/automaton/PDA/InputDrivenDPDA.h +++ b/alib2data/src/automaton/PDA/InputDrivenDPDA.h @@ -23,6 +23,7 @@ #include "../AutomatonException.h" #include "../common/AutomatonFromXMLParser.h" #include "../common/AutomatonToXMLComposer.h" +#include "../common/AutomatonNormalize.h" namespace automaton { @@ -209,6 +210,37 @@ public: void composeTransitions ( std::deque < sax::Token > & out ) const; virtual alib::ObjectBase * inc ( ) &&; + + virtual AutomatonBase * normalize ( ) && { + std::set < DefaultSymbolType > alphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < InputAlphabet > ( ).get ( ) ) ); + std::set < DefaultSymbolType > pushdownAlphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < PushdownStoreAlphabet > ( ).get ( ) ) ); + DefaultSymbolType initialSymbol = AutomatonNormalize::normalizeSymbol ( std::move ( this->template accessElement < InitialSymbol > ( ).get ( ) ) ); + std::set < DefaultStateType > states = AutomatonNormalize::normalizeStates ( std::move ( this->template accessComponent < States > ( ).get ( ) ) ); + DefaultStateType initialState = AutomatonNormalize::normalizeState ( std::move ( this->template accessElement < InitialState > ( ).get ( ) ) ); + std::set < DefaultStateType > finalStates = AutomatonNormalize::normalizeStates ( std::move ( this->template accessComponent < FinalStates > ( ).get ( ) ) ); + + std::map < std::pair < DefaultStateType, DefaultSymbolType >, DefaultStateType > new_transitions; + for ( std::pair < std::pair < StateType, InputSymbolType >, StateType > && transition : std::make_moveable_map ( transitions ) ) { + DefaultStateType target = AutomatonNormalize::normalizeState ( std::move ( transition.second ) ); + + auto key = std::make_pair ( AutomatonNormalize::normalizeState ( std::move ( transition.first.first ) ), AutomatonNormalize::normalizeSymbol ( std::move ( transition.first.second ) ) ); + new_transitions.insert ( std::make_pair ( std::move ( key ), std::move ( target ) ) ); + } + + std::map < DefaultSymbolType, std::pair < std::vector < DefaultSymbolType >, std::vector < DefaultSymbolType > > > new_inputSymbolToPushdownStoreOperation; + for ( std::pair < InputSymbolType, std::pair < std::vector < InputSymbolType >, std::vector < InputSymbolType > > > && pushdownOperation : std::make_moveable_map ( inputSymbolToPushdownStoreOperation ) ) { + std::vector < DefaultSymbolType > pop = AutomatonNormalize::normalizeSymbols ( std::move ( pushdownOperation.second.first ) ); + std::vector < DefaultSymbolType > push = AutomatonNormalize::normalizeSymbols ( std::move ( pushdownOperation.second.second ) ); + + new_inputSymbolToPushdownStoreOperation.insert ( std::make_pair ( AutomatonNormalize::normalizeSymbol ( std::move ( pushdownOperation.first ) ), std::make_pair ( std::move ( pop ), std::move ( push ) ) ) ); + } + + InputDrivenDPDA < > * res = new InputDrivenDPDA < > ( std::move ( states ), std::move ( alphabet ), std::move ( pushdownAlphabet ), std::move ( initialState ), std::move ( initialSymbol ), std::move ( finalStates ) ); + res->transitions = std::move ( new_transitions ); + res->inputSymbolToPushdownStoreOperation = new_inputSymbolToPushdownStoreOperation; + + return res; + } }; template < class InputSymbolType, class PushdownStoreSymbolType, class StateType > diff --git a/alib2data/src/automaton/PDA/InputDrivenNPDA.h b/alib2data/src/automaton/PDA/InputDrivenNPDA.h index 03646f62aab4aeea5e6672c87b2ee40d10ec1dcb..45e28d8996662ff06838561d7cae081d7d52d863 100644 --- a/alib2data/src/automaton/PDA/InputDrivenNPDA.h +++ b/alib2data/src/automaton/PDA/InputDrivenNPDA.h @@ -23,6 +23,7 @@ #include "../AutomatonException.h" #include "../common/AutomatonFromXMLParser.h" #include "../common/AutomatonToXMLComposer.h" +#include "../common/AutomatonNormalize.h" namespace automaton { @@ -218,6 +219,37 @@ public: void composeTransitions ( std::deque < sax::Token > & out ) const; virtual alib::ObjectBase * inc ( ) &&; + + virtual AutomatonBase * normalize ( ) && { + std::set < DefaultSymbolType > alphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < InputAlphabet > ( ).get ( ) ) ); + std::set < DefaultSymbolType > pushdownAlphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < PushdownStoreAlphabet > ( ).get ( ) ) ); + DefaultSymbolType initialSymbol = AutomatonNormalize::normalizeSymbol ( std::move ( this->template accessElement < InitialSymbol > ( ).get ( ) ) ); + std::set < DefaultStateType > states = AutomatonNormalize::normalizeStates ( std::move ( this->template accessComponent < States > ( ).get ( ) ) ); + DefaultStateType initialState = AutomatonNormalize::normalizeState ( std::move ( this->template accessElement < InitialState > ( ).get ( ) ) ); + std::set < DefaultStateType > finalStates = AutomatonNormalize::normalizeStates ( std::move ( this->template accessComponent < FinalStates > ( ).get ( ) ) ); + + std::map < std::pair < DefaultStateType, DefaultSymbolType >, std::set < DefaultStateType > > new_transitions; + for ( std::pair < std::pair < StateType, InputSymbolType >, std::set < StateType > > && transition : std::make_moveable_map ( transitions ) ) { + std::set < DefaultStateType > targets = AutomatonNormalize::normalizeStates ( std::move ( transition.second ) ); + + auto key = std::make_pair ( AutomatonNormalize::normalizeState ( std::move ( transition.first.first ) ), AutomatonNormalize::normalizeSymbol ( std::move ( transition.first.second ) ) ); + new_transitions.insert ( std::make_pair ( std::move ( key ), std::move ( targets ) ) ); + } + + std::map < DefaultSymbolType, std::pair < std::vector < DefaultSymbolType >, std::vector < DefaultSymbolType > > > new_inputSymbolToPushdownStoreOperation; + for ( std::pair < InputSymbolType, std::pair < std::vector < InputSymbolType >, std::vector < InputSymbolType > > > && pushdownOperation : std::make_moveable_map ( inputSymbolToPushdownStoreOperation ) ) { + std::vector < DefaultSymbolType > pop = AutomatonNormalize::normalizeSymbols ( std::move ( pushdownOperation.second.first ) ); + std::vector < DefaultSymbolType > push = AutomatonNormalize::normalizeSymbols ( std::move ( pushdownOperation.second.second ) ); + + new_inputSymbolToPushdownStoreOperation.insert ( std::make_pair ( AutomatonNormalize::normalizeSymbol ( std::move ( pushdownOperation.first ) ), std::make_pair ( std::move ( pop ), std::move ( push ) ) ) ); + } + + InputDrivenNPDA < > * res = new InputDrivenNPDA < > ( std::move ( states ), std::move ( alphabet ), std::move ( pushdownAlphabet ), std::move ( initialState ), std::move ( initialSymbol ), std::move ( finalStates ) ); + res->transitions = std::move ( new_transitions ); + res->inputSymbolToPushdownStoreOperation = new_inputSymbolToPushdownStoreOperation; + + return res; + } }; template < class InputSymbolType, class PushdownStoreSymbolType, class StateType > diff --git a/alib2data/src/automaton/PDA/NPDA.h b/alib2data/src/automaton/PDA/NPDA.h index 31e951592d76d42e6d0d4c58c1f62793df95726a..d0b75a5afec72d79d6bc5bd88979057a7f064525 100644 --- a/alib2data/src/automaton/PDA/NPDA.h +++ b/alib2data/src/automaton/PDA/NPDA.h @@ -24,6 +24,7 @@ #include "../AutomatonException.h" #include "../common/AutomatonFromXMLParser.h" #include "../common/AutomatonToXMLComposer.h" +#include "../common/AutomatonNormalize.h" namespace automaton { @@ -203,6 +204,32 @@ public: void composeTransitions ( std::deque < sax::Token > & out ) const; virtual alib::ObjectBase * inc ( ) &&; + + virtual AutomatonBase * normalize ( ) && { + std::set < DefaultSymbolType > alphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < InputAlphabet > ( ).get ( ) ) ); + std::set < DefaultSymbolType > pushdownAlphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < PushdownStoreAlphabet > ( ).get ( ) ) ); + DefaultSymbolType initialSymbol = AutomatonNormalize::normalizeSymbol ( std::move ( this->template accessElement < InitialSymbol > ( ).get ( ) ) ); + std::set < DefaultStateType > states = AutomatonNormalize::normalizeStates ( std::move ( this->template accessComponent < States > ( ).get ( ) ) ); + DefaultStateType initialState = AutomatonNormalize::normalizeState ( std::move ( this->template accessElement < InitialState > ( ).get ( ) ) ); + std::set < DefaultStateType > finalStates = AutomatonNormalize::normalizeStates ( std::move ( this->template accessComponent < FinalStates > ( ).get ( ) ) ); + + std::map < std::tuple < DefaultStateType, std::variant < DefaultEpsilonType, DefaultSymbolType >, std::vector < DefaultSymbolType > >, std::set < std::pair < DefaultStateType, std::vector < DefaultSymbolType > > > > new_transitions; + for ( std::pair < std::tuple < StateType, std::variant < EpsilonType, InputSymbolType >, std::vector < PushdownStoreSymbolType > >, std::set < std::pair < StateType, std::vector < PushdownStoreSymbolType > > > > && transition : std::make_moveable_map ( transitions ) ) { + std::set < std::pair < DefaultStateType, std::vector < DefaultSymbolType > > > targets; + for ( std::pair < StateType, std::vector < PushdownStoreSymbolType > > && target : std::make_moveable_set ( transition.second ) ) + targets.insert ( std::make_pair ( AutomatonNormalize::normalizeState ( std::move ( target.first ) ), AutomatonNormalize::normalizeSymbols ( std::move ( target.second ) ) ) ); + + std::vector < DefaultSymbolType > pop = AutomatonNormalize::normalizeSymbols ( std::move ( std::get < 2 > ( transition.first ) ) ); + auto key = std::make_tuple ( AutomatonNormalize::normalizeState ( std::move ( std::get < 0 > ( transition.first ) ) ), AutomatonNormalize::normalizeSymbolEpsilon ( std::move ( std::get < 1 > ( transition.first ) ) ), std::move ( pop ) ); + + new_transitions.insert ( std::make_pair ( std::move ( key ), std::move ( targets ) ) ); + } + + NPDA < > * res = new NPDA < > ( std::move ( states ), std::move ( alphabet ), std::move ( pushdownAlphabet ), std::move ( initialState ), std::move ( initialSymbol ), std::move ( finalStates ) ); + res->transitions = std::move ( new_transitions ); + + return res; + } }; template < class InputSymbolType, class EpsilonType, class PushdownStoreSymbolType, class StateType > diff --git a/alib2data/src/automaton/PDA/NPDTA.h b/alib2data/src/automaton/PDA/NPDTA.h index 1b134ac3f5a8273e1bdfde53e2e28d6c863c3503..bc625ac02e12fddf7ef4b68eb5f5c8fc578e56a0 100644 --- a/alib2data/src/automaton/PDA/NPDTA.h +++ b/alib2data/src/automaton/PDA/NPDTA.h @@ -24,6 +24,7 @@ #include "../AutomatonException.h" #include "../common/AutomatonFromXMLParser.h" #include "../common/AutomatonToXMLComposer.h" +#include "../common/AutomatonNormalize.h" namespace automaton { @@ -227,6 +228,33 @@ public: void composeTransitions ( std::deque < sax::Token > & out ) const; virtual alib::ObjectBase * inc ( ) &&; + + virtual AutomatonBase * normalize ( ) && { + std::set < DefaultSymbolType > alphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < InputAlphabet > ( ).get ( ) ) ); + std::set < DefaultSymbolType > pushdownAlphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < PushdownStoreAlphabet > ( ).get ( ) ) ); + std::set < DefaultSymbolType > outputAlphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < OutputAlphabet > ( ).get ( ) ) ); + DefaultSymbolType initialSymbol = AutomatonNormalize::normalizeSymbol ( std::move ( this->template accessElement < InitialSymbol > ( ).get ( ) ) ); + std::set < DefaultStateType > states = AutomatonNormalize::normalizeStates ( std::move ( this->template accessComponent < States > ( ).get ( ) ) ); + DefaultStateType initialState = AutomatonNormalize::normalizeState ( std::move ( this->template accessElement < InitialState > ( ).get ( ) ) ); + std::set < DefaultStateType > finalStates = AutomatonNormalize::normalizeStates ( std::move ( this->template accessComponent < FinalStates > ( ).get ( ) ) ); + + std::map < std::tuple < DefaultStateType, std::variant < DefaultEpsilonType, DefaultSymbolType >, std::vector < DefaultSymbolType > >, std::set < std::tuple < DefaultStateType, std::vector < DefaultSymbolType >, std::vector < DefaultSymbolType > > > > new_transitions; + for ( std::pair < std::tuple < StateType, std::variant < EpsilonType, InputSymbolType >, std::vector < PushdownStoreSymbolType > >, std::set < std::tuple < StateType, std::vector < PushdownStoreSymbolType >, std::vector < OutputSymbolType > > > > && transition : std::make_moveable_map ( transitions ) ) { + std::set < std::tuple < DefaultStateType, std::vector < DefaultSymbolType >, std::vector < DefaultSymbolType > > > targets; + for ( std::tuple < StateType, std::vector < PushdownStoreSymbolType >, std::vector < OutputSymbolType > > && target : std::make_moveable_set ( transition.second ) ) + targets.insert ( std::make_tuple ( AutomatonNormalize::normalizeState ( std::move ( std::get < 0 > ( target ) ) ), AutomatonNormalize::normalizeSymbols ( std::move ( std::get < 1 > ( target ) ) ), AutomatonNormalize::normalizeSymbols ( std::move ( std::get < 2 > ( target ) ) ) ) ); + + std::vector < DefaultSymbolType > pop = AutomatonNormalize::normalizeSymbols ( std::move ( std::get < 2 > ( transition.first ) ) ); + auto key = std::make_tuple ( AutomatonNormalize::normalizeState ( std::move ( std::get < 0 > ( transition.first ) ) ), AutomatonNormalize::normalizeSymbolEpsilon ( std::move ( std::get < 1 > ( transition.first ) ) ), std::move ( pop ) ); + + new_transitions.insert ( std::make_pair ( std::move ( key ), std::move ( targets ) ) ); + } + + NPDTA < > * res = new NPDTA < > ( std::move ( states ), std::move ( alphabet ), std::move ( pushdownAlphabet ), std::move ( outputAlphabet ), std::move ( initialState ), std::move ( initialSymbol ), std::move ( finalStates ) ); + res->transitions = std::move ( new_transitions ); + + return res; + } }; template < class InputSymbolType, class OutputSymbolType, class EpsilonType, class PushdownStoreSymbolType, class StateType > diff --git a/alib2data/src/automaton/PDA/RealTimeHeightDeterministicDPDA.h b/alib2data/src/automaton/PDA/RealTimeHeightDeterministicDPDA.h index 0bd995e3b7567c228f0bc0cf283b5bad893ef967..40cacc9c904017ce71b47eeb0dcd7982b9fc1138 100644 --- a/alib2data/src/automaton/PDA/RealTimeHeightDeterministicDPDA.h +++ b/alib2data/src/automaton/PDA/RealTimeHeightDeterministicDPDA.h @@ -23,6 +23,7 @@ #include "../AutomatonException.h" #include "../common/AutomatonFromXMLParser.h" #include "../common/AutomatonToXMLComposer.h" +#include "../common/AutomatonNormalize.h" namespace automaton { @@ -231,6 +232,48 @@ public: void composeTransitions ( std::deque < sax::Token > & out ) const; virtual alib::ObjectBase * inc ( ) &&; + + virtual AutomatonBase * normalize ( ) && { + std::set < DefaultSymbolType > alphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < InputAlphabet > ( ).get ( ) ) ); + std::set < DefaultSymbolType > pushdownAlphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < PushdownStoreAlphabet > ( ).get ( ) ) ); + DefaultSymbolType bottomSymbol = AutomatonNormalize::normalizeSymbol ( std::move ( this->template accessElement < BottomOfTheStackSymbol > ( ).get ( ) ) ); + std::set < DefaultStateType > states = AutomatonNormalize::normalizeStates ( std::move ( this->template accessComponent < States > ( ).get ( ) ) ); + DefaultStateType initialState = AutomatonNormalize::normalizeState ( std::move ( this->template accessElement < InitialState > ( ).get ( ) ) ); + std::set < DefaultStateType > finalStates = AutomatonNormalize::normalizeStates ( std::move ( this->template accessComponent < FinalStates > ( ).get ( ) ) ); + + std::map < std::pair < DefaultStateType, std::variant < DefaultEpsilonType, DefaultSymbolType > >, std::pair < DefaultStateType, DefaultSymbolType > > new_call_transitions; + for ( std::pair < std::pair < StateType, std::variant < EpsilonType, InputSymbolType > >, std::pair < StateType, PushdownStoreSymbolType > > && transition : std::make_moveable_map ( callTransitions ) ) { + std::pair < DefaultStateType, DefaultSymbolType > target = std::make_pair ( AutomatonNormalize::normalizeState ( std::move ( transition.second.first ) ), AutomatonNormalize::normalizeSymbol ( std::move ( transition.second.second ) ) ); + + auto key = std::make_pair ( AutomatonNormalize::normalizeState ( std::move ( transition.first.first ) ), AutomatonNormalize::normalizeSymbolEpsilon ( std::move ( transition.first.second ) ) ); + new_call_transitions.insert ( std::make_pair ( std::move ( key ), std::move ( target ) ) ); + } + + std::map < std::tuple < DefaultStateType, std::variant < DefaultEpsilonType, DefaultSymbolType >, DefaultSymbolType >, DefaultStateType > new_return_transitions; + for ( std::pair < std::tuple < StateType, std::variant < EpsilonType, InputSymbolType >, PushdownStoreSymbolType >, StateType > && transition : std::make_moveable_map ( returnTransitions ) ) { + DefaultStateType target = AutomatonNormalize::normalizeState ( std::move ( transition.second ) ); + + DefaultSymbolType popSymbol ( alib::AnyObject < PushdownStoreSymbolType > ( std::move ( std::get < 2 > ( transition.first ) ) ) ); + + auto key = std::make_tuple ( AutomatonNormalize::normalizeState ( std::move ( std::get < 0 > ( transition.first ) ) ), AutomatonNormalize::normalizeSymbolEpsilon ( std::move ( std::get < 1 > ( transition.first ) ) ), std::move ( popSymbol ) ); + new_return_transitions.insert ( std::make_pair ( std::move ( key ), std::move ( target ) ) ); + } + + std::map < std::pair < DefaultStateType, std::variant < DefaultEpsilonType, DefaultSymbolType > >, DefaultStateType > new_local_transitions; + for ( std::pair < std::pair < StateType, std::variant < EpsilonType, InputSymbolType > >, StateType > && transition : std::make_moveable_map ( localTransitions ) ) { + DefaultStateType target = AutomatonNormalize::normalizeState ( std::move ( transition.second ) ); + + auto key = std::make_pair ( AutomatonNormalize::normalizeState ( std::move ( transition.first.first ) ), AutomatonNormalize::normalizeSymbolEpsilon ( std::move ( transition.first.second ) ) ); + new_local_transitions.insert ( std::make_pair ( std::move ( key ), std::move ( target ) ) ); + } + + RealTimeHeightDeterministicDPDA < > * res = new RealTimeHeightDeterministicDPDA < > ( std::move ( states ), std::move ( alphabet ), std::move ( pushdownAlphabet ), std::move ( initialState ), std::move ( bottomSymbol ), std::move ( finalStates ) ); + res->callTransitions = std::move ( new_call_transitions ); + res->returnTransitions = std::move ( new_return_transitions ); + res->localTransitions = std::move ( new_local_transitions ); + + return res; + } }; template < class InputSymbolType, class EpsilonType, class PushdownStoreSymbolType, class StateType > diff --git a/alib2data/src/automaton/PDA/RealTimeHeightDeterministicNPDA.h b/alib2data/src/automaton/PDA/RealTimeHeightDeterministicNPDA.h index ad866c4fe4fe04807a164c122323f445e1bcce06..0a683c755b91a43bfd4951be02943bc9e6e1a7e8 100644 --- a/alib2data/src/automaton/PDA/RealTimeHeightDeterministicNPDA.h +++ b/alib2data/src/automaton/PDA/RealTimeHeightDeterministicNPDA.h @@ -23,6 +23,7 @@ #include "../AutomatonException.h" #include "../common/AutomatonFromXMLParser.h" #include "../common/AutomatonToXMLComposer.h" +#include "../common/AutomatonNormalize.h" namespace automaton { @@ -272,6 +273,50 @@ public: void composeTransitions ( std::deque < sax::Token > & out ) const; virtual alib::ObjectBase * inc ( ) &&; + + virtual AutomatonBase * normalize ( ) && { + std::set < DefaultSymbolType > alphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < InputAlphabet > ( ).get ( ) ) ); + std::set < DefaultSymbolType > pushdownAlphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < PushdownStoreAlphabet > ( ).get ( ) ) ); + DefaultSymbolType bottomSymbol = AutomatonNormalize::normalizeSymbol ( std::move ( this->template accessElement < BottomOfTheStackSymbol > ( ).get ( ) ) ); + std::set < DefaultStateType > states = AutomatonNormalize::normalizeStates ( std::move ( this->template accessComponent < States > ( ).get ( ) ) ); + std::set < DefaultStateType > initialStates = AutomatonNormalize::normalizeStates ( std::move ( this->template accessComponent < InitialStates > ( ).get ( ) ) ); + std::set < DefaultStateType > finalStates = AutomatonNormalize::normalizeStates ( std::move ( this->template accessComponent < FinalStates > ( ).get ( ) ) ); + + std::map < std::pair < DefaultStateType, std::variant < DefaultEpsilonType, DefaultSymbolType > >, std::set < std::pair < DefaultStateType, DefaultSymbolType > > > new_call_transitions; + for ( std::pair < std::pair < StateType, std::variant < EpsilonType, InputSymbolType > >, std::set < std::pair < StateType, PushdownStoreSymbolType > > > && transition : std::make_moveable_map ( callTransitions ) ) { + std::set < std::pair < DefaultStateType, DefaultSymbolType > > targets; + for ( std::pair < StateType, PushdownStoreSymbolType > && target : std::make_moveable_set ( transition.second ) ) + targets.insert ( std::make_pair ( AutomatonNormalize::normalizeState ( std::move ( target.first ) ), AutomatonNormalize::normalizeSymbol ( std::move ( target.second ) ) ) ); + + auto key = std::make_pair ( AutomatonNormalize::normalizeState ( std::move ( transition.first.first ) ), AutomatonNormalize::normalizeSymbolEpsilon ( std::move ( transition.first.second ) ) ); + new_call_transitions.insert ( std::make_pair ( std::move ( key ), std::move ( targets ) ) ); + } + + std::map < std::tuple < DefaultStateType, std::variant < DefaultEpsilonType, DefaultSymbolType >, DefaultSymbolType >, std::set < DefaultStateType > > new_return_transitions; + for ( std::pair < std::tuple < StateType, std::variant < EpsilonType, InputSymbolType >, PushdownStoreSymbolType >, std::set < StateType > > && transition : std::make_moveable_map ( returnTransitions ) ) { + std::set < DefaultStateType > targets = AutomatonNormalize::normalizeStates ( std::move ( transition.second ) ); + + DefaultSymbolType popSymbol ( alib::AnyObject < PushdownStoreSymbolType > ( std::move ( std::get < 2 > ( transition.first ) ) ) ); + + auto key = std::make_tuple ( AutomatonNormalize::normalizeState ( std::move ( std::get < 0 > ( transition.first ) ) ), AutomatonNormalize::normalizeSymbolEpsilon ( std::move ( std::get < 1 > ( transition.first ) ) ), std::move ( popSymbol ) ); + new_return_transitions.insert ( std::make_pair ( std::move ( key ), std::move ( targets ) ) ); + } + + std::map < std::pair < DefaultStateType, std::variant < DefaultEpsilonType, DefaultSymbolType > >, std::set < DefaultStateType > > new_local_transitions; + for ( std::pair < std::pair < StateType, std::variant < EpsilonType, InputSymbolType > >, std::set < StateType > > && transition : std::make_moveable_map ( localTransitions ) ) { + std::set < DefaultStateType > targets = AutomatonNormalize::normalizeStates ( std::move ( transition.second ) ); + + auto key = std::make_pair ( AutomatonNormalize::normalizeState ( std::move ( transition.first.first ) ), AutomatonNormalize::normalizeSymbolEpsilon ( std::move ( transition.first.second ) ) ); + new_local_transitions.insert ( std::make_pair ( std::move ( key ), std::move ( targets ) ) ); + } + + RealTimeHeightDeterministicNPDA < > * res = new RealTimeHeightDeterministicNPDA < > ( std::move ( states ), std::move ( alphabet ), std::move ( pushdownAlphabet ), std::move ( initialStates ), std::move ( bottomSymbol ), std::move ( finalStates ) ); + res->callTransitions = std::move ( new_call_transitions ); + res->returnTransitions = std::move ( new_return_transitions ); + res->localTransitions = std::move ( new_local_transitions ); + + return res; + } }; template < class InputSymbolType, class EpsilonType, class PushdownStoreSymbolType, class StateType > diff --git a/alib2data/src/automaton/PDA/SinglePopDPDA.h b/alib2data/src/automaton/PDA/SinglePopDPDA.h index c364ccb194e5b485eb42d2ec7585f29ba52db490..0922fb2d5b3dd67d34e296d31b562e24b292a691 100644 --- a/alib2data/src/automaton/PDA/SinglePopDPDA.h +++ b/alib2data/src/automaton/PDA/SinglePopDPDA.h @@ -25,6 +25,7 @@ #include "../AutomatonException.h" #include "../common/AutomatonFromXMLParser.h" #include "../common/AutomatonToXMLComposer.h" +#include "../common/AutomatonNormalize.h" namespace automaton { @@ -196,6 +197,30 @@ public: void composeTransitions ( std::deque < sax::Token > & out ) const; virtual alib::ObjectBase * inc ( ) &&; + + virtual AutomatonBase * normalize ( ) && { + std::set < DefaultSymbolType > alphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < InputAlphabet > ( ).get ( ) ) ); + std::set < DefaultSymbolType > pushdownAlphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < PushdownStoreAlphabet > ( ).get ( ) ) ); + DefaultSymbolType bottomSymbol = AutomatonNormalize::normalizeSymbol ( std::move ( this->template accessElement < InitialSymbol > ( ).get ( ) ) ); + std::set < DefaultStateType > states = AutomatonNormalize::normalizeStates ( std::move ( this->template accessComponent < States > ( ).get ( ) ) ); + DefaultStateType initialState = AutomatonNormalize::normalizeState ( std::move ( this->template accessElement < InitialState > ( ).get ( ) ) ); + std::set < DefaultStateType > finalStates = AutomatonNormalize::normalizeStates ( std::move ( this->template accessComponent < FinalStates > ( ).get ( ) ) ); + + std::map < std::tuple < DefaultStateType, std::variant < DefaultEpsilonType, DefaultSymbolType >, DefaultSymbolType >, std::pair < DefaultStateType, std::vector < DefaultSymbolType > > > new_transitions; + for ( std::pair < std::tuple < StateType, std::variant < EpsilonType, InputSymbolType >, PushdownStoreSymbolType >, std::pair < StateType, std::vector < PushdownStoreSymbolType > > > && transition : std::make_moveable_map ( transitions ) ) { + std::pair < DefaultStateType, std::vector < DefaultSymbolType > > target = std::make_pair ( AutomatonNormalize::normalizeState ( std::move ( transition.second.first ) ), AutomatonNormalize::normalizeSymbols ( std::move ( transition.second.second ) ) ); + + DefaultSymbolType pop = AutomatonNormalize::normalizeSymbol ( std::move ( std::get < 2 > ( transition.first ) ) ); + auto key = std::make_tuple ( AutomatonNormalize::normalizeState ( std::move ( std::get < 0 > ( transition.first ) ) ), AutomatonNormalize::normalizeSymbolEpsilon ( std::move ( std::get < 1 > ( transition.first ) ) ), std::move ( pop ) ); + + new_transitions.insert ( std::make_pair ( std::move ( key ), std::move ( target ) ) ); + } + + SinglePopDPDA < > * res = new SinglePopDPDA < > ( std::move ( states ), std::move ( alphabet ), std::move ( pushdownAlphabet ), std::move ( initialState ), std::move ( bottomSymbol ), std::move ( finalStates ) ); + res->transitions = std::move ( new_transitions ); + + return res; + } }; template < class InputSymbolType, class EpsilonType, class PushdownStoreSymbolType, class StateType > diff --git a/alib2data/src/automaton/PDA/SinglePopNPDA.h b/alib2data/src/automaton/PDA/SinglePopNPDA.h index 396de828306c701a29096a0afe15c070808d0f5a..27cbec3b47d8f80530109d0baed9c560b060d005 100644 --- a/alib2data/src/automaton/PDA/SinglePopNPDA.h +++ b/alib2data/src/automaton/PDA/SinglePopNPDA.h @@ -24,6 +24,7 @@ #include "../AutomatonException.h" #include "../common/AutomatonFromXMLParser.h" #include "../common/AutomatonToXMLComposer.h" +#include "../common/AutomatonNormalize.h" namespace automaton { @@ -203,6 +204,32 @@ public: void composeTransitions ( std::deque < sax::Token > & out ) const; virtual alib::ObjectBase * inc ( ) &&; + + virtual AutomatonBase * normalize ( ) && { + std::set < DefaultSymbolType > alphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < InputAlphabet > ( ).get ( ) ) ); + std::set < DefaultSymbolType > pushdownAlphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < PushdownStoreAlphabet > ( ).get ( ) ) ); + DefaultSymbolType bottomSymbol = AutomatonNormalize::normalizeSymbol ( std::move ( this->template accessElement < InitialSymbol > ( ).get ( ) ) ); + std::set < DefaultStateType > states = AutomatonNormalize::normalizeStates ( std::move ( this->template accessComponent < States > ( ).get ( ) ) ); + DefaultStateType initialState = AutomatonNormalize::normalizeState ( std::move ( this->template accessElement < InitialState > ( ).get ( ) ) ); + std::set < DefaultStateType > finalStates = AutomatonNormalize::normalizeStates ( std::move ( this->template accessComponent < FinalStates > ( ).get ( ) ) ); + + std::map < std::tuple < DefaultStateType, std::variant < DefaultEpsilonType, DefaultSymbolType >, DefaultSymbolType >, std::set < std::pair < DefaultStateType, std::vector < DefaultSymbolType > > > > new_transitions; + for ( std::pair < std::tuple < StateType, std::variant < EpsilonType, InputSymbolType >, PushdownStoreSymbolType >, std::set < std::pair < StateType, std::vector < PushdownStoreSymbolType > > > > && transition : std::make_moveable_map ( transitions ) ) { + std::set < std::pair < DefaultStateType, std::vector < DefaultSymbolType > > > targets; + for ( std::pair < StateType, std::vector < PushdownStoreSymbolType > > && target : std::make_moveable_set ( transition.second ) ) + targets.insert ( std::make_pair ( AutomatonNormalize::normalizeState ( std::move ( target.first ) ), AutomatonNormalize::normalizeSymbols ( std::move ( target.second ) ) ) ); + + DefaultSymbolType pop = AutomatonNormalize::normalizeSymbol ( std::move ( std::get < 2 > ( transition.first ) ) ); + auto key = std::make_tuple ( AutomatonNormalize::normalizeState ( std::move ( std::get < 0 > ( transition.first ) ) ), AutomatonNormalize::normalizeSymbolEpsilon ( std::move ( std::get < 1 > ( transition.first ) ) ), std::move ( pop ) ); + + new_transitions.insert ( std::make_pair ( std::move ( key ), std::move ( targets ) ) ); + } + + SinglePopNPDA < > * res = new SinglePopNPDA < > ( std::move ( states ), std::move ( alphabet ), std::move ( pushdownAlphabet ), std::move ( initialState ), std::move ( bottomSymbol ), std::move ( finalStates ) ); + res->transitions = std::move ( new_transitions ); + + return res; + } }; template < class InputSymbolType, class EpsilonType, class PushdownStoreSymbolType, class StateType > diff --git a/alib2data/src/automaton/PDA/VisiblyPushdownDPDA.h b/alib2data/src/automaton/PDA/VisiblyPushdownDPDA.h index 432f2b731702c103be59a9ccd0c62efb9580e6da..59aada779b65b072b48450fb1829bb30724622ca 100644 --- a/alib2data/src/automaton/PDA/VisiblyPushdownDPDA.h +++ b/alib2data/src/automaton/PDA/VisiblyPushdownDPDA.h @@ -22,6 +22,7 @@ #include "../AutomatonException.h" #include "../common/AutomatonFromXMLParser.h" #include "../common/AutomatonToXMLComposer.h" +#include "../common/AutomatonNormalize.h" namespace automaton { @@ -264,6 +265,58 @@ public: void composeTransitions ( std::deque < sax::Token > & out ) const; virtual alib::ObjectBase * inc ( ) &&; + + virtual AutomatonBase * normalize ( ) && { + std::set < DefaultSymbolType > call_alphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < CallAlphabet > ( ).get ( ) ) ); + std::set < DefaultSymbolType > return_alphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < ReturnAlphabet > ( ).get ( ) ) ); + std::set < DefaultSymbolType > local_alphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < LocalAlphabet > ( ).get ( ) ) ); + std::set < DefaultSymbolType > pushdownAlphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < PushdownStoreAlphabet > ( ).get ( ) ) ); + DefaultSymbolType bottomSymbol = AutomatonNormalize::normalizeSymbol ( std::move ( this->template accessElement < BottomOfTheStackSymbol > ( ).get ( ) ) ); + std::set < DefaultStateType > states = AutomatonNormalize::normalizeStates ( std::move ( this->template accessComponent < States > ( ).get ( ) ) ); + DefaultStateType initialState = AutomatonNormalize::normalizeState ( std::move ( this->template accessElement < InitialState > ( ).get ( ) ) ); + std::set < DefaultStateType > finalStates = AutomatonNormalize::normalizeStates ( std::move ( this->template accessComponent < FinalStates > ( ).get ( ) ) ); + + std::map < std::pair < DefaultStateType, DefaultSymbolType >, std::pair < DefaultStateType, DefaultSymbolType > > new_call_transitions; + for ( std::pair < std::pair < StateType, InputSymbolType >, std::pair < StateType, PushdownStoreSymbolType > > && transition : std::make_moveable_map ( callTransitions ) ) { + std::pair < DefaultStateType, DefaultSymbolType > target = std::make_pair ( AutomatonNormalize::normalizeState ( std::move ( transition.second.first ) ), AutomatonNormalize::normalizeSymbol ( std::move ( transition.second.second ) ) ); + + DefaultStateType fromState = AutomatonNormalize::normalizeState ( std::move ( transition.first.first ) ); + DefaultSymbolType inputSymbol = AutomatonNormalize::normalizeSymbol ( std::move ( transition.first.second ) ); + + auto key = std::make_pair ( std::move ( fromState ), std::move ( inputSymbol ) ); + new_call_transitions.insert ( std::make_pair ( std::move ( key ), std::move ( target ) ) ); + } + + std::map < std::tuple < DefaultStateType, DefaultSymbolType, DefaultSymbolType >, DefaultStateType > new_return_transitions; + for ( std::pair < std::tuple < StateType, InputSymbolType, PushdownStoreSymbolType >, StateType > && transition : std::make_moveable_map ( returnTransitions ) ) { + DefaultStateType target = AutomatonNormalize::normalizeState ( std::move ( transition.second ) ); + + DefaultStateType fromState = AutomatonNormalize::normalizeState ( std::move ( std::get < 0 > ( transition.first ) ) ); + DefaultSymbolType inputSymbol = AutomatonNormalize::normalizeSymbol ( std::move ( std::get < 1 > ( transition.first ) ) ); + DefaultSymbolType popSymbol = AutomatonNormalize::normalizeSymbol ( std::move ( std::get < 2 > ( transition.first ) ) ); + + auto key = std::make_tuple ( std::move ( fromState ), std::move ( inputSymbol ), std::move ( popSymbol ) ); + new_return_transitions.insert ( std::make_pair ( std::move ( key ), std::move ( target ) ) ); + } + + std::map < std::pair < DefaultStateType, DefaultSymbolType >, DefaultStateType > new_local_transitions; + for ( std::pair < std::pair < StateType, InputSymbolType >, StateType > && transition : std::make_moveable_map ( localTransitions ) ) { + DefaultStateType target = AutomatonNormalize::normalizeState ( std::move ( transition.second ) ); + + DefaultStateType fromState = AutomatonNormalize::normalizeState ( std::move ( transition.first.first ) ); + DefaultSymbolType inputSymbol = AutomatonNormalize::normalizeSymbol ( std::move ( transition.first.second ) ); + + auto key = std::make_pair ( std::move ( fromState ), std::move ( inputSymbol ) ); + new_local_transitions.insert ( std::make_pair ( std::move ( key ), std::move ( target ) ) ); + } + + VisiblyPushdownDPDA < > * res = new VisiblyPushdownDPDA < > ( std::move ( states ), std::move ( call_alphabet ), std::move ( return_alphabet ), std::move ( local_alphabet ), std::move ( pushdownAlphabet ), std::move ( initialState ), std::move ( bottomSymbol ), std::move ( finalStates ) ); + res->callTransitions = std::move ( new_call_transitions ); + res->returnTransitions = std::move ( new_return_transitions ); + res->localTransitions = std::move ( new_local_transitions ); + + return res; + } }; template < class InputSymbolType, class PushdownStoreSymbolType, class StateType > diff --git a/alib2data/src/automaton/PDA/VisiblyPushdownNPDA.h b/alib2data/src/automaton/PDA/VisiblyPushdownNPDA.h index 41ef1c8b53a1ba62320d88157bb9f2961e2d6bcf..34eb428298ba521c0a3010ccbd0447dfdfca46f0 100644 --- a/alib2data/src/automaton/PDA/VisiblyPushdownNPDA.h +++ b/alib2data/src/automaton/PDA/VisiblyPushdownNPDA.h @@ -22,6 +22,7 @@ #include "../AutomatonException.h" #include "../common/AutomatonFromXMLParser.h" #include "../common/AutomatonToXMLComposer.h" +#include "../common/AutomatonNormalize.h" namespace automaton { @@ -299,6 +300,60 @@ public: void composeTransitions ( std::deque < sax::Token > & out ) const; virtual alib::ObjectBase * inc ( ) &&; + + virtual AutomatonBase * normalize ( ) && { + std::set < DefaultSymbolType > call_alphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < CallAlphabet > ( ).get ( ) ) ); + std::set < DefaultSymbolType > return_alphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < ReturnAlphabet > ( ).get ( ) ) ); + std::set < DefaultSymbolType > local_alphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < LocalAlphabet > ( ).get ( ) ) ); + std::set < DefaultSymbolType > pushdownAlphabet = AutomatonNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < PushdownStoreAlphabet > ( ).get ( ) ) ); + DefaultSymbolType bottomSymbol = AutomatonNormalize::normalizeSymbol ( std::move ( this->template accessElement < BottomOfTheStackSymbol > ( ).get ( ) ) ); + std::set < DefaultStateType > states = AutomatonNormalize::normalizeStates ( std::move ( this->template accessComponent < States > ( ).get ( ) ) ); + std::set < DefaultStateType > initialStates = AutomatonNormalize::normalizeStates ( std::move ( this->template accessComponent < InitialStates > ( ).get ( ) ) ); + std::set < DefaultStateType > finalStates = AutomatonNormalize::normalizeStates ( std::move ( this->template accessComponent < FinalStates > ( ).get ( ) ) ); + + std::map < std::pair < DefaultStateType, DefaultSymbolType >, std::set < std::pair < DefaultStateType, DefaultSymbolType > > > new_call_transitions; + for ( std::pair < std::pair < StateType, InputSymbolType >, std::set < std::pair < StateType, PushdownStoreSymbolType > > > && transition : std::make_moveable_map ( callTransitions ) ) { + std::set < std::pair < DefaultStateType, DefaultSymbolType > > targets; + for ( std::pair < StateType, PushdownStoreSymbolType > && target : std::make_moveable_set ( transition.second ) ) + targets.insert ( std::make_pair ( AutomatonNormalize::normalizeState ( std::move ( target.first ) ), AutomatonNormalize::normalizeSymbol ( std::move ( target.second ) ) ) ); + + DefaultStateType fromState = AutomatonNormalize::normalizeState ( std::move ( transition.first.first ) ); + DefaultSymbolType inputSymbol = AutomatonNormalize::normalizeSymbol ( std::move ( transition.first.second ) ); + + auto key = std::make_pair ( std::move ( fromState ), std::move ( inputSymbol ) ); + new_call_transitions.insert ( std::make_pair ( std::move ( key ), std::move ( targets ) ) ); + } + + std::map < std::tuple < DefaultStateType, DefaultSymbolType, DefaultSymbolType >, std::set < DefaultStateType > > new_return_transitions; + for ( std::pair < std::tuple < StateType, InputSymbolType, PushdownStoreSymbolType >, std::set < StateType > > && transition : std::make_moveable_map ( returnTransitions ) ) { + std::set < DefaultStateType > targets = AutomatonNormalize::normalizeStates ( std::move ( transition.second ) ); + + DefaultStateType fromState = AutomatonNormalize::normalizeState ( std::move ( std::get < 0 > ( transition.first ) ) ); + DefaultSymbolType inputSymbol = AutomatonNormalize::normalizeSymbol ( std::move ( std::get < 1 > ( transition.first ) ) ); + DefaultSymbolType popSymbol = AutomatonNormalize::normalizeSymbol ( std::move ( std::get < 2 > ( transition.first ) ) ); + + auto key = std::make_tuple ( std::move ( fromState ), std::move ( inputSymbol ), std::move ( popSymbol ) ); + new_return_transitions.insert ( std::make_pair ( std::move ( key ), std::move ( targets ) ) ); + } + + std::map < std::pair < DefaultStateType, DefaultSymbolType >, std::set < DefaultStateType > > new_local_transitions; + for ( std::pair < std::pair < StateType, InputSymbolType >, std::set < StateType > > && transition : std::make_moveable_map ( localTransitions ) ) { + std::set < DefaultStateType > targets = AutomatonNormalize::normalizeStates ( std::move ( transition.second ) ); + + DefaultStateType fromState = AutomatonNormalize::normalizeState ( std::move ( transition.first.first ) ); + DefaultSymbolType inputSymbol = AutomatonNormalize::normalizeSymbol ( std::move ( transition.first.second ) ); + + auto key = std::make_pair ( std::move ( fromState ), std::move ( inputSymbol ) ); + new_local_transitions.insert ( std::make_pair ( std::move ( key ), std::move ( targets ) ) ); + } + + VisiblyPushdownNPDA < > * res = new VisiblyPushdownNPDA < > ( std::move ( states ), std::move ( call_alphabet ), std::move ( return_alphabet ), std::move ( local_alphabet ), std::move ( pushdownAlphabet ), std::move ( initialStates ), std::move ( bottomSymbol ), std::move ( finalStates ) ); + res->callTransitions = std::move ( new_call_transitions ); + res->returnTransitions = std::move ( new_return_transitions ); + res->localTransitions = std::move ( new_local_transitions ); + + return res; + } }; template < class InputSymbolType, class PushdownStoreSymbolType, class StateType >