de.jstacs.data.alphabets
Class DiscreteAlphabetMapping

java.lang.Object
  extended by de.jstacs.data.alphabets.DiscreteAlphabetMapping
All Implemented Interfaces:
Storable

public class DiscreteAlphabetMapping
extends Object
implements Storable

This class implements the transformation of discrete values to other discrete values which define a DiscreteAlphabet.

Author:
Jens Keilwagen

Constructor Summary
DiscreteAlphabetMapping(int[] newValues, DiscreteAlphabet newAlphabet)
          The main constructor creating a DiscreteAlphabetMapping.
DiscreteAlphabetMapping(StringBuffer xml)
          The standard constructor for the interface Storable.
 
Method Summary
 double getLogNumberOfSimilarSymbols(int oldValue)
          This method returns the logarithm of the number of old values that yield the same new value.
 DiscreteAlphabet getNewAlphabet()
          Returns the new Alphabet that is used for mapping.
 int getNewDiscreteValue(int oldValue)
          This method implements the main transformation of the values.
 StringBuffer toXML()
          This method returns an XML representation as StringBuffer of an instance of the implementing class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DiscreteAlphabetMapping

public DiscreteAlphabetMapping(int[] newValues,
                               DiscreteAlphabet newAlphabet)
The main constructor creating a DiscreteAlphabetMapping.

Parameters:
newValues - the assignment of the old value (index) to the new value (entry of the array)
newAlphabet - the new Alphabet

DiscreteAlphabetMapping

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

Parameters:
xml - the XML representation as StringBuffer
Throws:
NonParsableException - if the DiscreteAlphabetMapping could not be reconstructed out of the XML representation (the StringBuffer could not be parsed)
See Also:
Storable
Method Detail

toXML

public StringBuffer toXML()
Description copied from interface: Storable
This method returns an XML representation as StringBuffer of an instance of the implementing class.

Specified by:
toXML in interface Storable
Returns:
the XML representation

getNewAlphabet

public DiscreteAlphabet getNewAlphabet()
Returns the new Alphabet that is used for mapping.

Returns:
the new Alphabet that is used for mapping.

getNewDiscreteValue

public int getNewDiscreteValue(int oldValue)
This method implements the main transformation of the values.

Parameters:
oldValue - the old value
Returns:
the new value

getLogNumberOfSimilarSymbols

public double getLogNumberOfSimilarSymbols(int oldValue)
This method returns the logarithm of the number of old values that yield the same new value.

Parameters:
oldValue - the old value
Returns:
the logarithm of the number of old values that yield the same new value
See Also:
MappedDiscreteSequence.getLogNumberOfPossibleOriginalSequences()