|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
An alphabet over a finite set of Symbols.
This interface makes the distinction between an alphabet over a finite (and possibly small) number of symbols and an Alphabet over an infinite (or extremely large) set of symbols. Within a FiniteAlphabet, the == operator should be sufficient to decide upon equality for all AtomicSymbol instances.
The alphabet functions as the repository of objects in the fly-weight design pattern. Only symbols within an alphabet should appear in object that claim to use the alphabet - otherwise something is in error.
Nested Class Summary |
Nested classes inherited from class org.biojava.bio.Annotatable |
Annotatable.AnnotationForwarder |
Field Summary |
Fields inherited from interface org.biojava.bio.symbol.Alphabet |
EMPTY_ALPHABET, PARSERS, SYMBOLS |
Fields inherited from interface org.biojava.bio.Annotatable |
ANNOTATION |
Method Summary | |
void |
addSymbol(Symbol s)
Adds a symbol to this alphabet. |
java.util.Iterator |
iterator()
Retrieve an Iterator over the Symbols in this FiniteAlphabet. |
void |
removeSymbol(Symbol s)
Remove a symbol from this alphabet. |
int |
size()
The number of symbols in the alphabet. |
Methods inherited from interface org.biojava.bio.symbol.Alphabet |
contains, getAlphabets, getAmbiguity, getGapSymbol, getName, getSymbol, getTokenization, validate |
Methods inherited from interface org.biojava.bio.Annotatable |
getAnnotation |
Methods inherited from interface org.biojava.utils.Changeable |
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener |
Method Detail |
public int size()
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 void addSymbol(Symbol s) throws IllegalSymbolException, ChangeVetoException
If the symbol matches more than one AtomicSymbol, then each symbol matching it will be added.
s
- the Symbol to add
IllegalSymbolException
- if the symbol is null, or if for any reason
it can't be added
ChangeVetoException
- if either the alphabet doesn't allow symbols
to be added, or the change was vetoedpublic void removeSymbol(Symbol s) throws IllegalSymbolException, ChangeVetoException
If the symbol matches multiple AtomicSymbols, then each matching symbol it will be removed.
s
- the Symbol to removeintGot
IllegalSymbolException
- if the symbol is null, or if for any reason
it can't be removed
ChangeVetoException
- if either the alphabet doesn't allow symbols
to be added, or the change was vetoed
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |