Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## de.jstacs.data.alphabets
Class DiscreteAlphabet

    java.lang.Object
      de.jstacs.data.Alphabet
          de.jstacs.data.alphabets.DiscreteAlphabet

All Implemented Interfaces:
  InstantiableFromParameterSet, Storable, Comparable<Alphabet>

Direct Known Subclasses:
  ComplementableDiscreteAlphabet

    public class DiscreteAlphabet

extends Alphabet

Class for an alphabet that consists of arbitrary Strings. For DNA-alphabets, the class `DNAAlphabet` should be used;

Author:
  Jan Grau, Jens Keilwagen

Nested Class Summary
`static class` | `DiscreteAlphabet.DiscreteAlphabetParameterSet` Class for the `ParameterSet` of a `DiscreteAlphabet`.

Nested classes/interfaces inherited from class de.jstacs.data.Alphabet
`Alphabet.AlphabetParameterSet`

Field Summary
`protected Alphabet.AlphabetParameterSet` | `parameters` The `ParameterSet` describing this `DiscreteAlphabet`

Constructor Summary
`DiscreteAlphabet(DiscreteAlphabet.DiscreteAlphabetParameterSet parameters)` The constructor for the `InstantiableFromParameterSet` interface.
`DiscreteAlphabet(int min, int max)` Constructor for a discrete alphabet `[min,max]`.
`DiscreteAlphabet(String[] alphabet, boolean caseInsensitive)` Constructor for an discrete alphabet.
`DiscreteAlphabet(StringBuffer representation)` Extracts the alphabet from the StringBuffer.

Method Summary
`int` | `compareTo(Alphabet b)`
`int` | `getCode(String symbol)`
`Alphabet.AlphabetParameterSet` | `getCurrentParameterSet()` Returns the `ParameterSet` that has been used to instantiate the current instance of the implementing class.
`int` | `getMaximalSymbolLength()`
`double` | `getMin()` Returns the minimal value.
`String` | `getSymbolAt(int i)` Returns the symbol at Position `i` in the alphabet
`boolean` | `ignoresCase()` If this method returns `true` the alphabet ignores the case.
`boolean` | `isEncodedSymbol(int candidate)` Returns `true` if `candidate` is an element of the internal interval.
`boolean` | `isSymbol(String candidat)`
`double` | `length()` Returns the number of Symbols in the calling alphabet
`String` | `toString()`
`StringBuffer` | `toXML()` This method returns an XML-representation of an instance of the implementing class.

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`

Field Detail

### parameters

    protected Alphabet.AlphabetParameterSet parameters

  The `ParameterSet` describing this `DiscreteAlphabet`

Constructor Detail

### DiscreteAlphabet

    public DiscreteAlphabet(StringBuffer representation)
                     throws NonParsableException

  Extracts the alphabet from the StringBuffer.

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

### DiscreteAlphabet

    public DiscreteAlphabet(DiscreteAlphabet.DiscreteAlphabetParameterSet parameters)
                     throws IllegalArgumentException,
                            DoubleSymbolException

  The constructor for the `InstantiableFromParameterSet` interface.

  Parameters:
    `parameters` - the ParameterSet
  Throws:
    `IllegalArgumentException` - is thrown if space or tab will be used as symbols
    `DoubleSymbolException` - is thrown if one of the symbols occurred more than once

### DiscreteAlphabet

    public DiscreteAlphabet(int min,
                            int max)
                     throws IllegalArgumentException

  Constructor for a discrete alphabet `[min,max]`.

  Parameters:
    `min` - the minimal value (inclusive)
    `max` - the maximal value (inclusive)
  Throws:
    `IllegalArgumentException` - is thrown if `min`>`max`

### DiscreteAlphabet

    public DiscreteAlphabet(String[] alphabet,
                            boolean caseInsensitive)
                     throws DoubleSymbolException,
                            IllegalArgumentException

  Constructor for an discrete alphabet. The `String` array is cloned internally

  Parameters:
    `alphabet` - the alphabet as `String` array
    `caseInsensitive` -
  Throws:
    `DoubleSymbolException` - is thrown if one of the symbols occurred more than once
    `IllegalArgumentException` - is thrown if one of the symbols is either empty or a white-space character

Method Detail

### getCurrentParameterSet

    public 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.

  Returns:
    the current `ParameterSet`
  Throws:
    `Exception` - is thrown if the `ParameterSet` could not be returned

### toXML

    public StringBuffer toXML()

  Description copied from interface: `Storable`
  This method returns an XML-representation of an instance of the implementing class.

  Returns:
    the XML-representation

### compareTo

    public int compareTo(Alphabet b)

### getCode

    public final int getCode(String symbol)
                      throws WrongAlphabetException

  Parameters:
    `symbol` - the symbol
  Returns:
    the code
  Throws:
    `WrongAlphabetException` - if the symbol can not be encoded

### getMaximalSymbolLength

    public final int getMaximalSymbolLength()

  Returns:
    the length of the longest "symbol"

### getMin

    public double getMin()

  Description copied from class: `Alphabet`
  Returns the minimal value.

  Specified by:
    `getMin` in class `Alphabet`
  Returns:
    the minimal value

### getSymbolAt

    public final String getSymbolAt(int i)

  Returns the symbol at Position `i` in the alphabet

  Parameters:
    `i` - the position
  Returns:
    the symbol

### ignoresCase

    public final boolean ignoresCase()

  If this method returns `true` the alphabet ignores the case.

  Returns:
    `true` if the alphabet ignores the case

### isEncodedSymbol

    public final boolean isEncodedSymbol(int candidate)

  Returns `true` if `candidate` is an element of the internal interval.

  Parameters:
    `candidate` - the value to be tested
  Returns:
    `true` if `candidate` is an element of the internal interval

### isSymbol

    public final boolean isSymbol(String candidat)

  Parameters:
    `candidat` - the candidat symbol
  Returns:
    `true` if the `candidat` is a symbol of the alphabet

### length

    public final double length()

  Returns the number of Symbols in the calling alphabet

  Specified by:
    `length` in class `Alphabet`
  Returns:
    the number of symbols

### toString

    public String toString()

  Specified by:
    `toString` in class `Alphabet`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD