41 #include <Bpp/Text/TextTools.h> 53 nocaseAlphabet_(nocaseAlphabet)
56 for (
size_t i = 0; i < chars.size(); ++i) {
59 char c = *chars[i].c_str();
71 if (!isIntInAlphabet(state))
72 throw BadIntException(state,
"CaseMaskedAlphabet::getMaskedEquivalentState. Unsupported state code.");
73 if (state >= 100)
return state;
76 if (!isIntInAlphabet(state))
77 throw BadIntException(state,
"CaseMaskedAlphabet::getMaskedEquivalentState. State has masked equivalent.");
85 if (!isCharInAlphabet(state))
86 throw BadCharException(state,
"CaseMaskedAlphabet::getMaskedEquivalentState. Unsupported state code.");
87 int code = charToInt(state);
88 if (code >= 100)
return state;
91 if (!isIntInAlphabet(code))
92 throw BadIntException(code,
"CaseMaskedAlphabet::getMaskedEquivalentState. State has masked equivalent.");
93 return intToChar(code);
This is the base class to describe states in an Alphabet.
An alphabet exception thrown when trying to specify a bad char to the alphabet.
int getNum() const
Get the state's number.
This alphabet is used to deal NumericAlphabet.
const std::vector< std::string > & getSupportedChars() const
AlphabetState * clone() const
Specialized partial implementation of Alphabet using single letters.
const AlphabetState & getState(const std::string &letter) const
Get a state by its letter.
const std::string & getName() const
Get the name of the state.
void registerState(AlphabetState *st)
Add a state to the Alphabet.
int getMaskedEquivalentState(int state) const
Get the masked state equivalent to the input one.
const std::string & getLetter() const
Get the letter(s) corresponding to the state.
An alphabet exception thrown when trying to specify a bad int to the alphabet.
const LetterAlphabet * nocaseAlphabet_
CaseMaskedAlphabet(const LetterAlphabet *nocaseAlphabet)