57 if (letters_.find(st.
getLetter()) == letters_.end())
59 if (nums_.find(st.
getNum()) == nums_.end())
67 alphabet_.push_back(st.
clone());
69 updateMaps_(alphabet_.size(), st);
76 if (pos > alphabet_.size())
79 if (alphabet_[pos] != 0)
80 delete alphabet_[pos];
82 alphabet_[pos] = st.clone();
90 map<string, size_t>::const_iterator it = letters_.find(letter);
91 if (it == letters_.end())
92 throw BadCharException(letter,
"AbstractAlphabet::getState(string): Specified base unknown",
this);
93 return * (alphabet_[it->second]);
99 map<int, size_t>::const_iterator it = nums_.find(num);
100 if (it == nums_.end())
101 throw BadIntException(num,
"AbstractAlphabet::getState(int): Specified base unknown",
this);
102 return * (alphabet_[it->second]);
108 if (pos > alphabet_.size())
110 return * (alphabet_[pos]);
116 if (pos > alphabet_.size())
118 return * (alphabet_[pos]);
125 return (getState(state)).getName();
132 return (getState(state)).getName();
139 return getState(state).getNum();
146 return (getState(state)).getLetter();
153 map<int, size_t>::const_iterator it = nums_.find(state);
154 if (it != nums_.end())
163 map<string, size_t>::const_iterator it = letters_.find(state);
164 if (it != letters_.end())
173 if (!isIntInAlphabet(state))
throw BadIntException(state,
"AbstractAlphabet::getAlias(int): Specified base unknown.");
183 if (!isCharInAlphabet(state))
throw BadCharException(state,
"AbstractAlphabet::getAlias(char): Specified base unknown.");
193 for (
unsigned int i = 0 ; i < states.size() ; ++i) {
194 vector<int> tmp_s = this->getAlias(states[i]);
195 for (
unsigned int j = 0 ; j < tmp_s.size() ; ++j) {
202 for (
unsigned int i = 0 ; i < ve.size() ; ++i) {
203 if (!isIntInAlphabet(ve[i]))
throw BadIntException(ve[i],
"AbstractAlphabet::getGeneric(const vector<int>): Specified base unknown.");
207 if (ve.size() == 1) {
210 v = this->getUnknownCharacterCode();
219 for (
unsigned int i = 0 ; i < states.size() ; ++i) {
220 vector<string> tmp_s = this->getAlias(states[i]);
221 for (
unsigned int j = 0 ; j < tmp_s.size() ; ++j) {
228 for (
unsigned int i = 0 ; i < ve.size() ; ++i) {
229 if (!isCharInAlphabet(ve[i]))
throw BadCharException(ve[i],
"AbstractAlphabet::getAlias(const vector<string>): Specified base unknown.");
233 if (ve.size() == 1) {
245 if(intList_.size() == 0)
247 intList_.resize(alphabet_.size());
248 charList_.resize(alphabet_.size());
249 for(
unsigned int i = 0; i < alphabet_.size(); i++)
251 intList_[i] = alphabet_[i]->getNum();
252 charList_[i] = alphabet_[i]->getLetter();
262 if(charList_.size() == 0)
264 intList_.resize(alphabet_.size());
265 charList_.resize(alphabet_.size());
266 for(
unsigned int i = 0; i < alphabet_.size(); i++)
268 intList_[i] = alphabet_[i]->getNum();
269 charList_[i] = alphabet_[i]->getLetter();