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 `String`s. 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 String[]` | `alphabet` The alphabet as `String` array.
`protected boolean` | `caseInsensitive` Switch to decide whether the input should be treated case sensitive or insensitive.
`protected Alphabet.AlphabetParameterSet` | `parameters` The parameter set describing this `DiscreteAlphabet` .

Constructor Summary
`DiscreteAlphabet(boolean caseInsensitive, String... alphabet)` Creates a new `DiscreteAlphabet` from a given alphabet as a `String` array.
`DiscreteAlphabet(DiscreteAlphabet.DiscreteAlphabetParameterSet parameters)` The constructor for the `InstantiableFromParameterSet` interface.
`DiscreteAlphabet(int min, int max)` Creates a new `DiscreteAlphabet` from a minimal and a maximal value, i.e. in `[min,max]`.
`DiscreteAlphabet(StringBuffer representation)` The standard constructor for the interface `Storable`.

Method Summary
`int` | `compareTo(Alphabet b)`
`int` | `getCode(String symbol)` Returns the code of a given symbol.
`Alphabet.AlphabetParameterSet` | `getCurrentParameterSet()` Returns the `InstanceParameterSet` that has been used to instantiate the current instance of the implementing class.
`int` | `getMaximalSymbolLength()` Returns the length of the longest "symbol" in the alphabet.
`double` | `getMin()` Returns the minimal value of the`Alphabet`.
`String` | `getSymbolAt(int i)` Returns the symbol at position `i` in the alphabet.
`boolean` | `ignoresCase()` Indicates if the alphabet ignores the case.
`boolean` | `isEncodedSymbol(int candidate)` Indicates if `candidate` is an element of the internal interval.
`boolean` | `isSymbol(String candidat)` Tests if a given symbol is contained in the alphabet.
`double` | `length()` Returns the number of symbols in the calling alphabet.
`String` | `toString()`
`StringBuffer` | `toXML()` This method returns an XML representation as `StringBuffer` 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

### alphabet

    protected String[] alphabet

  The alphabet as `String` array.

### caseInsensitive

    protected boolean caseInsensitive

  Switch to decide whether the input should be treated case sensitive or insensitive.

### parameters

    protected Alphabet.AlphabetParameterSet parameters

  The parameter set describing this `DiscreteAlphabet` .

Constructor Detail

### DiscreteAlphabet

    public DiscreteAlphabet(StringBuffer representation)
                     throws NonParsableException

  The standard constructor for the interface `Storable`. Creates a new `DiscreteAlphabet` out of its XML representation.

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

### DiscreteAlphabet

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

  The constructor for the `InstantiableFromParameterSet` interface. Creates a new `DiscreteAlphabet` from a given set of parameters.

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

### DiscreteAlphabet

    public DiscreteAlphabet(int min,
                            int max)
                     throws IllegalArgumentException

  Creates a new `DiscreteAlphabet` from a minimal and a maximal value, i.e. in `[min,max]`.

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

### DiscreteAlphabet

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

  Creates a new `DiscreteAlphabet` from a given alphabet as a `String` array. This `String` array is cloned internally.

  Parameters:
    `alphabet` - the alphabet as `String` array
    `caseInsensitive` - indicates if there will be no difference between lowercase and uppercase letters/symbols in the alphabet (no case sensitivity)
  Throws:
    `DoubleSymbolException` - if one of the symbols occurred more than once
    `IllegalArgumentException` - 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 `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.

  Returns:
    the current `InstanceParameterSet`
  Throws:
    `Exception` - if the `InstanceParameterSet` could not be returned

### toXML

    public StringBuffer toXML()

  Description copied from interface: `Storable`
  This method returns an XML representation as `StringBuffer` 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

  Returns the code of a given symbol.

  Parameters:
    `symbol` - the given symbol
  Returns:
    the code of a given symbol
  Throws:
    `WrongAlphabetException` - if the symbol is not defined in the alphabet

### getMaximalSymbolLength

    public final int getMaximalSymbolLength()

  Returns the length of the longest "symbol" in the alphabet.

  Returns:
    the length of the longest "symbol"

### getMin

    public double getMin()

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

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

### getSymbolAt

    public final String getSymbolAt(int i)

  Returns the symbol at position `i` in the alphabet.

  Parameters:
    `i` - the position in the alphabet
  Returns:
    the symbol at position `i`

### ignoresCase

    public final boolean ignoresCase()

  Indicates if the alphabet ignores the case.

  Returns:
    `true` if the alphabet ignores the case, `false` otherwise

### isEncodedSymbol

    public final boolean isEncodedSymbol(int candidate)

  Indicates 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, `false` otherwise

### isSymbol

    public final boolean isSymbol(String candidat)

  Tests if a given symbol is contained in the alphabet.

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

### 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 in the alphabet

### 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