de.jstacs.data.alphabets
Class GenericComplementableDiscreteAlphabet
java.lang.Object
de.jstacs.data.alphabets.Alphabet
de.jstacs.data.alphabets.DiscreteAlphabet
de.jstacs.data.alphabets.ComplementableDiscreteAlphabet
de.jstacs.data.alphabets.GenericComplementableDiscreteAlphabet
- All Implemented Interfaces:
- InstantiableFromParameterSet, Storable, Comparable<Alphabet>
public class GenericComplementableDiscreteAlphabet
- extends ComplementableDiscreteAlphabet
This class implements an generic complementable discrete alphabet. The complement is determined in the constructor, where the user has to specify for each symbol the index of the complement symbol.
- Author:
- Jens Keilwagen
Methods inherited from class de.jstacs.data.alphabets.DiscreteAlphabet |
compareTo, getCode, getMaximalSymbolLength, getMin, getSymbolAt, ignoresCase, isEncodedSymbol, isSymbol, length, toString, toXML |
GenericComplementableDiscreteAlphabet
public GenericComplementableDiscreteAlphabet(StringBuffer representation)
throws NonParsableException
- The standard constructor for the interface
Storable
.
Creates a new GenericComplementableDiscreteAlphabet
out of its XML
representation.
- Parameters:
representation
- the XML representation as StringBuffer
- Throws:
NonParsableException
- if the GenericComplementableDiscreteAlphabet
could not be
reconstructed out of the XML representation (the
StringBuffer
representation
could
not be parsed)- See Also:
Storable
GenericComplementableDiscreteAlphabet
public GenericComplementableDiscreteAlphabet(GenericComplementableDiscreteAlphabet.GenericComplementableDiscreteAlphabetParameterSet parameters)
throws IllegalArgumentException,
DoubleSymbolException
- This constructor creates a
GenericComplementableDiscreteAlphabet
from a parameter set.
- Parameters:
parameters
- the set of parameters needed to create a GenericComplementableDiscreteAlphabet
- Throws:
IllegalArgumentException
- if space or tab will be used as symbols
DoubleSymbolException
- if one of the symbols occurred more than once
GenericComplementableDiscreteAlphabet
public GenericComplementableDiscreteAlphabet(boolean caseInsensitive,
String[] alphabet,
int[] revComp)
throws DoubleSymbolException,
IllegalArgumentException
- The main constructor.
- Parameters:
alphabet
- the array of symbolscaseInsensitive
- indicates if there will be no difference between lowercase and
uppercase letters/symbols in the alphabet (no case sensitivity)revComp
- the array is used to provide the complementarity, revComp[i]
contains the index of the complement of the i-th symbol
- Throws:
IllegalArgumentException
- if space or tab will be used as symbols
DoubleSymbolException
- if one of the symbols occurred more than once
getComplementaryCode
public int getComplementaryCode(int code)
- Description copied from class:
ComplementableDiscreteAlphabet
- This method returns the code of the symbol that is the complement of the
symbol encoded by
code
.
- Specified by:
getComplementaryCode
in class ComplementableDiscreteAlphabet
- Parameters:
code
- the encoded symbol
- Returns:
- the code of the complement
getCurrentParameterSet
public Alphabet.AlphabetParameterSet getCurrentParameterSet()
throws Exception
- Description copied from interface:
InstantiableFromParameterSet
- Returns the
InstanceParameterSet
that has been used to
instantiate the current instance of the implementing class. If the
current instance was not created using an InstanceParameterSet
,
an equivalent InstanceParameterSet
should be returned, so that an
instance created using this InstanceParameterSet
would be in
principle equal to the current instance.
- Specified by:
getCurrentParameterSet
in interface InstantiableFromParameterSet
- Overrides:
getCurrentParameterSet
in class DiscreteAlphabet
- Returns:
- the current
InstanceParameterSet
- Throws:
Exception
- if the InstanceParameterSet
could not be returned