org.biojava.bio.symbol
Class SimpleReversibleTranslationTable

java.lang.Object
  extended byorg.biojava.bio.symbol.SimpleTranslationTable
      extended byorg.biojava.bio.symbol.SimpleReversibleTranslationTable
All Implemented Interfaces:
ReversibleTranslationTable, java.io.Serializable, TranslationTable

public class SimpleReversibleTranslationTable
extends SimpleTranslationTable
implements ReversibleTranslationTable, java.io.Serializable

A no-frills implementation of ReversibleTranslationTable that uses two Maps to map between symbols in a finite source alphabet into a finite target alphabet.

Author:
Matthew Pocock
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.biojava.bio.symbol.TranslationTable
ALT_YEAST_NUC, ASCID_MITO, BLEPH_MNUC, CILIATE_NUC, ECHIN_MITO, EUPL_NUC, FWORM_MITO, INVERT_MITO, MOLD_MITO, UNIVERSAL, VERT_MITO, YEAST_MITO
 
Constructor Summary
SimpleReversibleTranslationTable(FiniteAlphabet source, FiniteAlphabet target)
          Construct a new translation table.
 
Method Summary
 void setTranslation(AtomicSymbol from, AtomicSymbol to)
          Alter the translation mapping.
 Symbol untranslate(Symbol sym)
          Translate a single symbol from target alphabet to the source alphabet.
 
Methods inherited from class org.biojava.bio.symbol.SimpleTranslationTable
getSourceAlphabet, getTargetAlphabet, translate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.biojava.bio.symbol.TranslationTable
getSourceAlphabet, getTargetAlphabet, translate
 

Constructor Detail

SimpleReversibleTranslationTable

public SimpleReversibleTranslationTable(FiniteAlphabet source,
                                        FiniteAlphabet target)
                                 throws IllegalAlphabetException
Construct a new translation table.

Parameters:
source - the source FiniteAlphabet
target - the target FiniteAlphabet
Throws:
IllegalAlphabetException - if the alphabets are of different sizes
Method Detail

setTranslation

public void setTranslation(AtomicSymbol from,
                           AtomicSymbol to)
                    throws IllegalSymbolException
Description copied from class: SimpleTranslationTable
Alter the translation mapping.

Overrides:
setTranslation in class SimpleTranslationTable
Parameters:
from - source AtomicSymbol
to - target AtomicSymbol to be returned by translate(from)
Throws:
IllegalSymbolException

untranslate

public Symbol untranslate(Symbol sym)
                   throws IllegalSymbolException
Description copied from interface: ReversibleTranslationTable
Translate a single symbol from target alphabet to the source alphabet.

Specified by:
untranslate in interface ReversibleTranslationTable
Parameters:
sym - the Symbol to translate (member of target alphabet)
Returns:
the translated version of sym (member of source alphabet)
Throws:
IllegalSymbolException - if sym is not a member of the target alphabet