Implements an infinite size alphabet. More...
#include <Alphabet.h>
Public Member Functions | |
InfiniteAlphabet (string pref=string("x")) | |
Constructor. | |
int | getNum (const string &letter) const |
Implements the conversion from a letter name into its corresponding index. | |
string | getLetter (int index) const |
Returns the name of the letter with a given index. | |
Static Public Attributes | |
static InfiniteAlphabet | defaultAlphabet |
Static instance of the default alphabet x_1, x_2, ... | |
Private Attributes | |
string | thePrefix |
Friends | |
ostream & | operator<< (ostream &out, const InfiniteAlphabet &a) |
Output the alphabet into a stream. |
Implements an infinite size alphabet.
Definition at line 153 of file Alphabet.h.
InfiniteAlphabet::InfiniteAlphabet | ( | string | pref = string("x") |
) | [inline] |
Constructor.
pref | - prefix to be used for letter names. By defalut the letter 'x' is used. In general letter names defined by appending the corresponding index to the prefix, i.e. <prefix><index>. |
Definition at line 162 of file Alphabet.h.
string InfiniteAlphabet::getLetter | ( | int | index | ) | const [virtual] |
Returns the name of the letter with a given index.
index | - the index of a letter from the alphabet |
index
Implements Alphabet.
int InfiniteAlphabet::getNum | ( | const string & | letter | ) | const [virtual] |
Implements the conversion from a letter name into its corresponding index.
letter | - the name of a letter |
Implements Alphabet.
ostream& operator<< | ( | ostream & | out, | |
const InfiniteAlphabet & | a | |||
) | [friend] |
Output the alphabet into a stream.
Definition at line 183 of file Alphabet.h.
Static instance of the default alphabet x_1, x_2, ...
Definition at line 180 of file Alphabet.h.
Referenced by Word::printOn().
string InfiniteAlphabet::thePrefix [private] |
Definition at line 193 of file Alphabet.h.