|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.biojava.bio.symbol.AbstractAlphabet | +--org.biojava.bio.symbol.SimpleAlphabet
A simple no-frills implementation of the FiniteAlphabet interface.
Constructor Summary | |
SimpleAlphabet()
|
|
SimpleAlphabet(java.util.Set symbols)
|
Method Summary | |
void |
addAmbiguity(Symbol aSym)
Add a commonly recognized ambiguiy symbol to this alphabet. |
void |
addSymbol(Symbol s)
Adds a symbol to this alphabet. |
java.util.Iterator |
ambiguities()
|
boolean |
contains(Symbol r)
Returns whether or not this Alphabet contains the symbol. |
Annotation |
getAnnotation()
Should return the associated annotation object. |
java.lang.String |
getName()
Get the name of the alphabet. |
java.util.Iterator |
iterator()
Retrieve an Iterator over the Symbols in this FiniteAlphabet. |
void |
removeSymbol(Symbol s)
Remove a symbol from this alphabet. |
void |
setName(java.lang.String name)
Assign a name to the alphabet |
int |
size()
The number of symbols in the alphabet. |
SymbolList |
symbols()
A list of symbols that make up this alphabet. |
void |
validate(Symbol s)
Throws a precanned IllegalSymbolException if the symbol is not contained within this Alphabet. |
Methods inherited from class org.biojava.bio.symbol.AbstractAlphabet |
getParser,
putParser |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public SimpleAlphabet()
public SimpleAlphabet(java.util.Set symbols)
Method Detail |
public java.util.Iterator iterator()
Each AtomicSymbol as for which this.contains(as) is true will be returned exactly once by this iterator in no specified order.
public java.util.Iterator ambiguities()
public java.lang.String getName()
public void setName(java.lang.String name)
name
- the name you wish to give this alphabetpublic Annotation getAnnotation()
public int size()
public SymbolList symbols()
Subsequent calls to this method are not required to return either the same symbol list, or even a symbol list with the symbols in the same order.
public boolean contains(Symbol r)
An alphabet contains an ambiguity symbol iff the ambiguity symbol's getMemberAlphabet() returns an alphabe that is a propper sub-set of this alphabet. That means that every one of the symbols that could mach the ambiguity symbol is also a member of this alphabet.
r
- the Symbol to checkpublic void addSymbol(Symbol s) throws IllegalSymbolException
If the symbol matches more than one AtomicSymbol, then each symbol matching it will be added.
s
- the Symbol to addpublic void addAmbiguity(Symbol aSym) throws IllegalSymbolException
This effectively forges an alias between aSym and the symbols in its 'matches' alphabet for all derived parsers.
as
- the ambiguity symbol to addpublic void removeSymbol(Symbol s) throws IllegalSymbolException
If the symbol matches multiple AtomicSymbols, then each matching symbol it will be removed.
s
- the Symbol to removepublic void validate(Symbol s) throws IllegalSymbolException
This function is used all over the code to validate symbols as they enter a method. Also, the code is littered with catches for IllegalSymbolException. There is a preferred style of handling this, which should be covererd in the package documentation.
r
- the Symbol to validate
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |