de.jstacs.data.alphabets
Class ComplementableDiscreteAlphabet

java.lang.Object
  extended by de.jstacs.data.alphabets.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, GenericComplementableDiscreteAlphabet

public abstract class ComplementableDiscreteAlphabet
extends DiscreteAlphabet

This abstract class indicates that an alphabet can be used 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.alphabets.Alphabet
Alphabet.AlphabetParameterSet<T extends Alphabet>
 
Field Summary
 
Fields inherited from class de.jstacs.data.alphabets.DiscreteAlphabet
alphabet, caseInsensitive, parameters
 
Constructor Summary
protected ComplementableDiscreteAlphabet(boolean caseInsensitive, String... alphabet)
          Creates a new ComplementableDiscreteAlphabet from a given array of symbols.
protected ComplementableDiscreteAlphabet(DiscreteAlphabet.DiscreteAlphabetParameterSet parameters)
          The constructor for the InstantiableFromParameterSet interface.
protected ComplementableDiscreteAlphabet(StringBuffer representation)
          The standard constructor for the interface Storable.
 
Method Summary
abstract  int getComplementaryCode(int code)
          This method returns the code of the symbol that is the complement of the symbol encoded by code.
 
Methods inherited from class de.jstacs.data.alphabets.DiscreteAlphabet
compareTo, getCode, getCurrentParameterSet, getMaximalSymbolLength, getMin, getSymbolAt, ignoresCase, isEncodedSymbol, isSymbol, length, toString, toXML
 
Methods inherited from class de.jstacs.data.alphabets.Alphabet
checkConsistency
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ComplementableDiscreteAlphabet

protected ComplementableDiscreteAlphabet(DiscreteAlphabet.DiscreteAlphabetParameterSet parameters)
                                  throws IllegalArgumentException,
                                         DoubleSymbolException
The constructor for the InstantiableFromParameterSet interface. Creates a new ComplementableDiscreteAlphabet from a given set of parameters.

Parameters:
parameters - the parameter set for the ComplementableDiscreteAlphabet
Throws:
IllegalArgumentException - if space or tab will be used as symbols
DoubleSymbolException - if one of the symbols occurred more than once
See Also:
InstantiableFromParameterSet

ComplementableDiscreteAlphabet

protected ComplementableDiscreteAlphabet(StringBuffer representation)
                                  throws NonParsableException
The standard constructor for the interface Storable. Creates a new ComplementableDiscreteAlphabet out of its XML representation.

Parameters:
representation - the XML representation as StringBuffer
Throws:
NonParsableException - if the ComplementableDiscreteAlphabet could not be reconstructed out of the XML representation (the StringBuffer representation could not be parsed)
See Also:
DiscreteAlphabet.DiscreteAlphabet(StringBuffer), Storable

ComplementableDiscreteAlphabet

protected ComplementableDiscreteAlphabet(boolean caseInsensitive,
                                         String... alphabet)
                                  throws DoubleSymbolException,
                                         IllegalArgumentException
Creates a new ComplementableDiscreteAlphabet from a given array of symbols.

Parameters:
alphabet - the array of symbols
caseInsensitive - indicates if there will be no difference between lowercase and uppercase letters/symbols in the alphabet (no case sensitivity)
Throws:
DoubleSymbolException - if a symbol occurs more than once in the alphabet
IllegalArgumentException - if one of the symbols is either empty or a white-space character
See Also:
DiscreteAlphabet.DiscreteAlphabet(boolean, String...)
Method Detail

getComplementaryCode

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

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