Class AbstractManyToOneTranslationTable

    • Method Detail

      • doUntranslate

        protected abstract java.util.Set doUntranslate​(Symbol sym)
                                                throws IllegalSymbolException
        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.

        Throws:
        IllegalSymbolException
      • untranslate

        public java.util.Set untranslate​(Symbol sym)
                                  throws IllegalSymbolException
        returns a Set of Atomic Symbols that are the reverse translation of the specified Symbol in the target alphabet.
        Specified by:
        untranslate in interface ManyToOneTranslationTable
        Parameters:
        sym - the Symbol to reverse-translate (member of target alphabet)
        Returns:
        a Set containing symbols that translate to the specified Symbol.
        Throws:
        IllegalSymbolException - if sym is not a member of the target alphabet
      • doTranslate

        protected abstract Symbol doTranslate​(Symbol sym)
                                       throws IllegalSymbolException
        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.

        Throws:
        IllegalSymbolException