Class SimpleTranslationTable

    • Constructor Detail

      • SimpleTranslationTable

        public SimpleTranslationTable​(FiniteAlphabet source,
                                      Alphabet target)
        Create a new translation table that will translate symbols from source to target.

        The source alphabet must be finite, as a Map object is used to associate a source Symbol with a target Symbol. The target alphabet need not be finite.

        Parameters:
        source - the FiniteAlphabet to translate from
        target - the Alphabet to translate into
      • SimpleTranslationTable

        public SimpleTranslationTable​(FiniteAlphabet source,
                                      Alphabet target,
                                      Map transMap)
        Create a new translation table that will translate symbols from source to target.

        The Map transMap should contain keys in the source alphabet with values in the target alphabet. However, this is not currently checked.

        The source alphabet must be finite, as a Map object is used to associate a source Symbol with a target Symbol. The target alphabet need not be finite.

        Parameters:
        source - the FiniteAlphabet to translate from
        target - the Alphabet to translate into
    • Method Detail

      • doTranslate

        public Symbol doTranslate​(Symbol sym)
        this method is expected to translate any symbol in the source alphabet. Failure can be indicated by returning a null if, for example, your method only handles AtomicSymbols and you want BasisSymbols to be taken apart. If you are sure the symbol is illegal, you can throw the IllegalSymbolException immediately to bypass further processing.

        As an optimisation, if your method is capable of immediately translating an ambiguity Symbol, just return it and the alternate route of establishing the translation through doing an ambiguity lookup will be avoided.