diff --git a/alib2/src/automaton/UnknownAutomaton.cpp b/alib2/src/automaton/UnknownAutomaton.cpp index 696118f88b28ba213c03efb82e9a9ecc7c0c4cb5..bde550712ba833e30b7673abf28d08a9eaf71afe 100644 --- a/alib2/src/automaton/UnknownAutomaton.cpp +++ b/alib2/src/automaton/UnknownAutomaton.cpp @@ -24,60 +24,60 @@ void UnknownAutomaton::removeState(const State& state) { throw AutomatonException("State \"" + state.getName() + "\" doesn't exist."); } -void UnknownAutomaton::removeInputSymbol(const Symbol& symbol) { +void UnknownAutomaton::removeInputSymbol(const alphabet::Symbol& symbol) { if (!inputAlphabet.erase(symbol)) throw AutomatonException("Input symbol \"" + symbol.getSymbol() + "\" doesn't exist."); } -const set<Symbol>& UnknownAutomaton::getStackAlphabet() const { +const std::set<alphabet::Symbol>& UnknownAutomaton::getStackAlphabet() const { return stackAlphabet; } -void UnknownAutomaton::addStackSymbol(const Symbol& symbol) { +void UnknownAutomaton::addStackSymbol(const alphabet::Symbol& symbol) { if (!stackAlphabet.insert(symbol).second) { throw AutomatonException("Stack symbol \"" + symbol.getSymbol() + "\" already exists."); } } -void UnknownAutomaton::removeStackSymbol(const Symbol& symbol) { +void UnknownAutomaton::removeStackSymbol(const alphabet::Symbol& symbol) { if (!stackAlphabet.erase(symbol)) throw AutomatonException("Stack symbol \"" + symbol.getSymbol() + "\" doesn't exist."); } -const list<Symbol>& UnknownAutomaton::getStartSymbols() const { - return startSymbols; +const std::set<alphabet::Symbol>& UnknownAutomaton::getInitialSymbols() const { + return initialSymbols; } -void UnknownAutomaton::setStartSymbols(const list<Symbol>& newSymbols) { - this->startSymbols = newSymbols; +void UnknownAutomaton::setInitialSymbols(const std::set<alphabet::Symbol>& symbols) { + this->initialSymbols = symbols; } -const set<Symbol>& UnknownAutomaton::getTapeAlphabet() const { +const std::set<alphabet::Symbol>& UnknownAutomaton::getTapeAlphabet() const { return tapeAlphabet; } -void UnknownAutomaton::addTapeSymbol(const Symbol& symbol) { +void UnknownAutomaton::addTapeSymbol(const alphabet::Symbol& symbol) { if (!tapeAlphabet.insert(symbol).second) { throw AutomatonException("Tape symbol \"" + symbol.getSymbol() + "\" already exists."); } } -void UnknownAutomaton::removeTapeSymbol(const Symbol& symbol) { +void UnknownAutomaton::removeTapeSymbol(const alphabet::Symbol& symbol) { int removed = tapeAlphabet.erase(symbol); if (!removed) { throw AutomatonException("Tape symbol \"" + symbol.getSymbol() + "\" doesn't exist."); } } -const Symbol& UnknownAutomaton::getBlankSymbol() const { +const alphabet::Symbol& UnknownAutomaton::getBlankSymbol() const { return blankSymbol; } -void UnknownAutomaton::setBlankSymbol(const Symbol& symbol) { +void UnknownAutomaton::setBlankSymbol(const alphabet::Symbol& symbol) { blankSymbol = symbol; } -const set<UnknownTransition>& UnknownAutomaton::getTransitions() const { +const std::set<UnknownTransition>& UnknownAutomaton::getTransitions() const { return transitions; } diff --git a/alib2/src/automaton/UnknownAutomaton.h b/alib2/src/automaton/UnknownAutomaton.h index 711dfed69ecc6cca98936abf3f2c9b13ac255cca..eaaee87f873d22f1c2b3b176b4beec21c3ead4d5 100644 --- a/alib2/src/automaton/UnknownAutomaton.h +++ b/alib2/src/automaton/UnknownAutomaton.h @@ -18,20 +18,17 @@ namespace automaton { -using namespace std; -using namespace alphabet; - /** * Class representing unknown automaton parsed from XML. */ class UnknownAutomaton: public Automaton { protected: - set<Symbol> stackAlphabet; - list<Symbol> startSymbols; - set<Symbol> tapeAlphabet; - Symbol blankSymbol; + std::set<alphabet::Symbol> stackAlphabet; + std::set<alphabet::Symbol> initialSymbols; + std::set<alphabet::Symbol> tapeAlphabet; + alphabet::Symbol blankSymbol; - set<UnknownTransition> transitions; + std::set<UnknownTransition> transitions; public: UnknownAutomaton(); virtual ~UnknownAutomaton(); @@ -48,72 +45,72 @@ public: * @param symbol Symbol to remove * @throws AutomatonException when symbol is not present in input alphabet */ - void removeInputSymbol(const Symbol& symbol); + void removeInputSymbol(const alphabet::Symbol& symbol); /** * @return the stack alphabet */ - const set<Symbol>& getStackAlphabet() const; + const std::set<alphabet::Symbol>& getStackAlphabet() const; /** * Adds symbol to the stack alphabet. * @param symbol Symbol to add * @throw AutomatonException when Symbol is already present in stack alphabet */ - void addStackSymbol(const Symbol& symbol); + void addStackSymbol(const alphabet::Symbol& symbol); /** * Removes symbol from the stack alphabet. * @param symbol Symbol to remove * @throw AutomatonException when Symbol is not present in input alphabet */ - void removeStackSymbol(const Symbol& symbol); + void removeStackSymbol(const alphabet::Symbol& symbol); /** - * @return list of start symbols + * @return list of initial symbols */ - const list<Symbol>& getStartSymbols() const; + const std::set<alphabet::Symbol>& getInitialSymbols() const; /** - * Set the start symbol list. - * @param newSymbols symbols to set + * Set the initial symbol list. + * @param symbols symbols to set */ - void setStartSymbols(const list<Symbol>& newSymbols); + void setInitialSymbols(const std::set<alphabet::Symbol>& symbols); /** * @return the tape alphabet */ - const set<Symbol>& getTapeAlphabet() const; + const std::set<alphabet::Symbol>& getTapeAlphabet() const; /** * Adds symbol to the tape alphabet. * @param symbol Symbol to add * @throw AutomatonException when Symbol is already present in tape alphabet */ - void addTapeSymbol(const Symbol& symbol); + void addTapeSymbol(const alphabet::Symbol& symbol); /** * Removes symbol from the tape alphabet. * @param symbol Symbol to remove * @throw AutomatonException when Symbol is not present in tape alphabet */ - void removeTapeSymbol(const Symbol& symbol); + void removeTapeSymbol(const alphabet::Symbol& symbol); /** * @return the blank symbol */ - const Symbol& getBlankSymbol() const; + const alphabet::Symbol& getBlankSymbol() const; /** * Sets the blank symbol. * @param symbol the Symbol to set */ - void setBlankSymbol(const Symbol& symbol); + void setBlankSymbol(const alphabet::Symbol& symbol); /** * @return transitions of the automaton */ - const set<UnknownTransition>& getTransitions() const; + const std::set<UnknownTransition>& getTransitions() const; /** * Adds new transition to the automaton.