diff --git a/alib2data/src/alphabet/Symbol.cpp b/alib2data/src/alphabet/Symbol.cpp index 5ef6949175cd1dec3f151aefacb34e48bef2a9f2..4d8dae2132394bb6f5cc39f24c4ac9ba3a6b6190 100644 --- a/alib2data/src/alphabet/Symbol.cpp +++ b/alib2data/src/alphabet/Symbol.cpp @@ -6,7 +6,7 @@ */ #include "Symbol.h" -#include "../label/NextLabel.h" +#include "NextSymbol.h" #include "LabeledSymbol.h" #include <climits> #include "../exception/AlibException.h" @@ -14,17 +14,13 @@ namespace alphabet { alphabet::Symbol createUniqueSymbol(const alphabet::Symbol& base, const std::set<alphabet::Symbol>& terminalAlphabet, const std::set<alphabet::Symbol>& nonterminalAlphabet) { - label::NextLabel nextLabelCreator; + NextSymbol nextSymbolCreator; - if(alib::ObjectBase::typeId<LabeledSymbol>() != base.getData().selfTypeId()) - throw exception::AlibException("Could not create unique symbol with nonlabeled base symbol " + (std::string) base + "." ); - - label::Label nextLabel = static_cast<const alphabet::LabeledSymbol&>(base.getData()).getLabel(); + Symbol attempt = base; int i = 0; do { - nextLabel = nextLabelCreator.nextLabel(nextLabel); - alphabet::Symbol attempt = alphabet::Symbol(alphabet::LabeledSymbol(nextLabel)); + attempt = nextSymbolCreator.nextSymbol(attempt); if(terminalAlphabet.count(attempt) == 0 && nonterminalAlphabet.count(attempt) == 0) return attempt; } while(++i < INT_MAX);