Class mata::AlphabetΒΆ

class Alphabet

The abstract interface for NFA alphabets.

Subclassed by EnumAlphabet, IntAlphabet, OnTheFlyAlphabet

Public Functions

virtual Symbol translate_symb(const std::string &symb) = 0

translates a string into a symbol

inline virtual Word translate_word(const WordName &word_name) const

Translate sequence of symbol names to sequence of their respective values.

virtual std::string reverse_translate_symbol(Symbol symbol) const = 0

Translate internal symbol representation back to its original string name.

Throws an exception when the symbol is missing in the alphabet.

Parameters:

symbol – [in] Symbol to translate.

Returns:

symbol original name.

inline Symbol operator[](const std::string &symb)

also translates strings to symbols

inline virtual utils::OrdVector<Symbol> get_alphabet_symbols() const

Get a set of all symbols in the alphabet.

The result does not have to equal the list of symbols in the automaton using this alphabet.

inline virtual utils::OrdVector<Symbol> get_complement(const utils::OrdVector<Symbol> &symbols) const

complement of a set of symbols wrt the alphabet

inline virtual bool is_equal(const Alphabet &other_alphabet) const

Check whether two alphabets are equal.

In general, two alphabets are equal if and only if they are of the same class instance.

Parameters:

other_alphabet – The other alphabet to compare with for equality.

Returns:

True if equal, false otherwise.

inline virtual bool is_equal(const Alphabet *const other_alphabet) const

Check whether two alphabets are equal.

In general, two alphabets are equal if and only if they are of the same class instance.

Parameters:

other_alphabet – The other alphabet to compare with for equality.

Returns:

True if equal, false otherwise.

virtual bool empty() const = 0

Checks whether the alphabet has any symbols.