public interface FiniteAlphabet extends Alphabet
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.
Annotatable.AnnotationForwarder
EMPTY_ALPHABET, PARSERS, SYMBOLS
ANNOTATION
Modifier and Type | Method and Description |
---|---|
void |
addSymbol(Symbol s)
Adds a symbol to this alphabet.
|
Iterator<Symbol> |
iterator()
Retrieve an Iterator over the AtomicSymbols in this FiniteAlphabet.
|
void |
removeSymbol(Symbol s)
Remove a symbol from this alphabet.
|
int |
size()
The number of symbols in the alphabet.
|
contains, getAlphabets, getAmbiguity, getGapSymbol, getName, getSymbol, getTokenization, validate
getAnnotation
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener
int size()
Iterator<Symbol> iterator()
Each AtomicSymbol as for which this.contains(as) is true will be returned exactly once by this iterator in no specified order.
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 addIllegalSymbolException
- if the symbol is null, or if for any reason
it can't be addedChangeVetoException
- if either the alphabet doesn't allow symbols
to be added, or the change was vetoedvoid removeSymbol(Symbol s) throws IllegalSymbolException, ChangeVetoException
If the symbol matches multiple AtomicSymbols, then each matching symbol it will be removed.
s
- the Symbol to removeintGotIllegalSymbolException
- if the symbol is null, or if for any reason
it can't be removedChangeVetoException
- if either the alphabet doesn't allow symbols
to be added, or the change was vetoedCopyright © 2014 BioJava. All rights reserved.