|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.jstacs.data.alphabets.Alphabet
de.jstacs.data.alphabets.DiscreteAlphabet
public class DiscreteAlphabet
Class for an alphabet that consists of arbitrary Strings. For DNA
alphabets, the class DNAAlphabet should be used.
| Nested Class Summary | |
|---|---|
static class |
DiscreteAlphabet.DiscreteAlphabetParameterSet
Class for the ParameterSet of a
DiscreteAlphabet. |
| Nested classes/interfaces inherited from class de.jstacs.data.alphabets.Alphabet |
|---|
Alphabet.AlphabetParameterSet<T extends Alphabet> |
| 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. |
|
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.alphabets.Alphabet |
|---|
checkConsistency |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected String[] alphabet
String array.
protected boolean caseInsensitive
protected Alphabet.AlphabetParameterSet parameters
DiscreteAlphabet .
| Constructor Detail |
|---|
public DiscreteAlphabet(StringBuffer representation)
throws NonParsableException
Storable.
Creates a new DiscreteAlphabet out of its XML representation.
representation - the XML representation as StringBuffer
NonParsableException - if the DiscreteAlphabet could not be reconstructed
out of the XML representation (the StringBuffer
representation could not be parsed)Storable
public DiscreteAlphabet(DiscreteAlphabet.DiscreteAlphabetParameterSet parameters)
throws IllegalArgumentException,
DoubleSymbolException
InstantiableFromParameterSet
interface. Creates a new DiscreteAlphabet from a given set of
parameters.
parameters - the parameter set for the DiscreteAlphabet
IllegalArgumentException - if space or tab will be used as symbols
DoubleSymbolException - if one of the symbols occurred more than onceInstantiableFromParameterSet
public DiscreteAlphabet(int min,
int max)
throws IllegalArgumentException
DiscreteAlphabet from a minimal and a maximal
value, i.e. in [min,max].
min - the minimal value (inclusive)max - the maximal value (inclusive)
IllegalArgumentException - if min > max
public DiscreteAlphabet(boolean caseInsensitive,
String... alphabet)
throws DoubleSymbolException,
IllegalArgumentException
DiscreteAlphabet from a given alphabet as a
String array. This String array is cloned internally.
alphabet - the alphabet as String arraycaseInsensitive - indicates if there will be no difference between lowercase and
uppercase letters/symbols in the alphabet (no case sensitivity)
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 |
|---|
public Alphabet.AlphabetParameterSet getCurrentParameterSet()
throws Exception
InstantiableFromParameterSetInstanceParameterSet 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.
getCurrentParameterSet in interface InstantiableFromParameterSetgetCurrentParameterSet in class AlphabetInstanceParameterSet
Exception - if the InstanceParameterSet could not be returnedpublic StringBuffer toXML()
StorableStringBuffer of an
instance of the implementing class.
public int compareTo(Alphabet b)
public int getCode(String symbol)
throws WrongAlphabetException
symbol - the given symbol
WrongAlphabetException - if the symbol is not defined in the alphabetpublic final int getMaximalSymbolLength()
public double getMin()
AlphabetAlphabet.
getMin in class AlphabetAlphabetpublic final String getSymbolAt(int i)
i in the alphabet.
i - the position in the alphabet
ipublic final boolean ignoresCase()
true if the alphabet ignores the case,
false otherwisepublic final boolean isEncodedSymbol(int candidate)
candidate is an element of the internal
interval.
candidate - the value to be tested
true if candidate is an element of the
internal interval, false otherwisepublic final boolean isSymbol(String candidat)
candidat - the candidat symbol
true if the candidat is a symbol of the
alphabet, false otherwisepublic final double length()
length in class Alphabetpublic String toString()
toString in class Alphabet
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||