diff --git a/alib2algo/src/determinize/vpa/VPADeterminizer.cpp b/alib2algo/src/determinize/vpa/VPADeterminizer.cpp index 49c38d7e07f229fe7c409f31ffc248ea97e54bd4..52a196b8089593984b8f57ac97d0771f4f22f0ba 100644 --- a/alib2algo/src/determinize/vpa/VPADeterminizer.cpp +++ b/alib2algo/src/determinize/vpa/VPADeterminizer.cpp @@ -223,7 +223,7 @@ void localClosure(std::set<label::Label>& states, const std::set<label::Label>& for(const label::Label& state : oldStates) { for(const auto& transition : d.getLocalTransitions()) { - if(!transition.second.count(automaton::State(state))) continue; + if(transition.second.begin()->getName() != state) continue; if(!states.count(transition.first.first.getName())) { states.insert(transition.first.first.getName()); @@ -232,7 +232,7 @@ void localClosure(std::set<label::Label>& states, const std::set<label::Label>& } for(const auto& transition : d.getReturnTransitions()) { - if(!transition.second.count(automaton::State(state))) continue; + if(transition.second.begin()->getName() != state) continue; const alphabet::Symbol& popSymbol = std::get<2>(transition.first); if(popSymbol == d.getBottomOfTheStackSymbol()) continue; @@ -250,7 +250,7 @@ void localClosure(std::set<label::Label>& states, const std::set<label::Label>& localClosure(states, newStates, d); } -std::pair<label::Label, alphabet::Symbol>* existsDirtyStateSymbol(const automaton::VisiblyPushdownNPDA& d) { +std::pair<automaton::State, alphabet::Symbol>* existsDirtyStateSymbol(const automaton::VisiblyPushdownNPDA& d) { for(const automaton::State& state : d.getStates()) { const label::Label& stateLabel = state.getName(); @@ -267,7 +267,7 @@ std::pair<label::Label, alphabet::Symbol>* existsDirtyStateSymbol(const automato } } - if(d.getInitialStates().count(localState)) { + if(d.getInitialStates().begin()->getName() == localState) { topSymbols.insert(d.getBottomOfTheStackSymbol()); } } @@ -278,7 +278,7 @@ std::pair<label::Label, alphabet::Symbol>* existsDirtyStateSymbol(const automato topSymbols.erase(std::get<2>(transition.first)); } - if(!topSymbols.empty()) return new std::pair<label::Label, alphabet::Symbol>(stateLabel, *topSymbols.begin()); + if(!topSymbols.empty()) return new std::pair<automaton::State, alphabet::Symbol>(automaton::State(stateLabel), *topSymbols.begin()); } return NULL; } @@ -302,7 +302,7 @@ automaton::VisiblyPushdownNPDA VPADeterminizer::determinize(const automaton::Vis d.addInitialState(automaton::State(initialLabel)); for(;;) { - std::pair<label::Label, alphabet::Symbol>* stateSymbol = existsDirtyStateSymbol(d); + std::pair<automaton::State, alphabet::Symbol>* stateSymbol = existsDirtyStateSymbol(d); const automaton::State* state = existsDirtyState(d); if(stateSymbol != NULL) { for(const alphabet::Symbol& symbol : n.getReturnInputAlphabet()) { diff --git a/alib2data/src/automaton/common/State.h b/alib2data/src/automaton/common/State.h index b534c9a06a36bb11b0c1c31e97183b15238e59f5..9455390f99c4abaf8dfaff02c9756364083a553e 100644 --- a/alib2data/src/automaton/common/State.h +++ b/alib2data/src/automaton/common/State.h @@ -22,11 +22,11 @@ class State { private: label::Label name; public: - State(const label::Label& name); - State(label::Label&& name); - State(int number); - State(char character); - State(const std::string& name); + explicit State(const label::Label& name); + explicit State(label::Label&& name); + explicit State(int number); + explicit State(char character); + explicit State(const std::string& name); const label::Label& getName() const;