Class SimpleManyToOneTranslationTable

    • Constructor Detail

      • SimpleManyToOneTranslationTable

        public SimpleManyToOneTranslationTable​(FiniteAlphabet source,
                                               FiniteAlphabet target)
        Construct a new translation table.
        Parameters:
        source - the source FiniteAlphabet
        target - the target FiniteAlphabet
    • Method Detail

      • doTranslate

        protected 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.

      • doUntranslate

        protected java.util.Set doUntranslate​(Symbol sym)
        Description copied from class: AbstractManyToOneTranslationTable
        this method is expected to reverse-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.

        Specified by:
        doUntranslate in class AbstractManyToOneTranslationTable
      • setTranslation

        public void setTranslation​(AtomicSymbol from,
                                   AtomicSymbol to)
                            throws IllegalSymbolException
        Alter the translation mapping.
        Parameters:
        from - source AtomicSymbol
        to - target AtomicSymbol to be returned by translate(from)
        Throws:
        IllegalSymbolException - if either from is not in the source alphabet or to is not in the target alphabet