de.jstacs.data.alphabets
Class ComplementableDiscreteAlphabet

java.lang.Object
  extended by de.jstacs.data.Alphabet
      extended by de.jstacs.data.alphabets.DiscreteAlphabet
          extended by de.jstacs.data.alphabets.ComplementableDiscreteAlphabet
All Implemented Interfaces:
InstantiableFromParameterSet, Storable, Comparable<Alphabet>
Direct Known Subclasses:
DNAAlphabet

public abstract class ComplementableDiscreteAlphabet
extends DiscreteAlphabet

This abstract class indicates that an alphabet can be used for to compute the complement. The most important method is getComplementaryCode(int).

Author:
Jan Grau, Jens Keilwagen

Nested Class Summary
 
Nested classes/interfaces inherited from class de.jstacs.data.alphabets.DiscreteAlphabet
DiscreteAlphabet.DiscreteAlphabetParameterSet
 
Nested classes/interfaces inherited from class de.jstacs.data.Alphabet
Alphabet.AlphabetParameterSet
 
Field Summary
 
Fields inherited from class de.jstacs.data.alphabets.DiscreteAlphabet
parameters
 
Constructor Summary
protected ComplementableDiscreteAlphabet(String[] alphabet, boolean caseInsensitive)
          The main constructor.
protected ComplementableDiscreteAlphabet(StringBuffer representation)
          The constructor for the Storable interface.
 
Method Summary
abstract  int getComplementaryCode(int code)
          This method returns the code of the symbol the is the complement of the symbol encoded by code
abstract  Alphabet.AlphabetParameterSet getCurrentParameterSet()
          Returns the ParameterSet that has been used to instantiate the current instance of the implementing class.
 
Methods inherited from class de.jstacs.data.alphabets.DiscreteAlphabet
compareTo, getCode, getMaximalSymbolLength, getMin, getSymbolAt, ignoresCase, isEncodedSymbol, isSymbol, length, toString, toXML
 
Methods inherited from class de.jstacs.data.Alphabet
checkConsistency
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ComplementableDiscreteAlphabet

protected ComplementableDiscreteAlphabet(StringBuffer representation)
                                  throws NonParsableException
The constructor for the Storable interface.

Parameters:
representation - the xml representation
Throws:
NonParsableException - if the stream is not parsable

ComplementableDiscreteAlphabet

protected ComplementableDiscreteAlphabet(String[] alphabet,
                                         boolean caseInsensitive)
                                  throws DoubleSymbolException,
                                         IllegalArgumentException
The main constructor.

Parameters:
alphabet - the array of symbols
caseInsensitive -
Throws:
DoubleSymbolException
IllegalArgumentException
Method Detail

getCurrentParameterSet

public abstract Alphabet.AlphabetParameterSet getCurrentParameterSet()
                                                              throws Exception
Description copied from interface: InstantiableFromParameterSet
Returns the ParameterSet that has been used to instantiate the current instance of the implementing class. If the current instance was not created using a ParameterSet, an equivalent ParameterSet should be returned, such that an instance created using this ParameterSet would be in principle equal to the current instance.

Specified by:
getCurrentParameterSet in interface InstantiableFromParameterSet
Overrides:
getCurrentParameterSet in class DiscreteAlphabet
Returns:
the current ParameterSet
Throws:
Exception - is thrown if the ParameterSet could not be returned

getComplementaryCode

public abstract int getComplementaryCode(int code)
This method returns the code of the symbol the is the complement of the symbol encoded by code

Parameters:
code - the encoded symbol
Returns:
the code of the complement