org.biojava.bio.symbol
Interface FiniteAlphabet
- All Known Implementing Classes:
- AbstractAlphabet, Alphabet.EmptyAlphabet, SingletonAlphabet, AllTokensAlphabet
- public interface FiniteAlphabet
- extends Alphabet
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.
- Author:
- Matthew Pocock
Method Summary |
java.util.Iterator |
iterator()
Retrieve an Iterator over the Symbols in this FiniteAlphabet. |
int |
size()
The number of symbols in the alphabet. |
SymbolList |
symbols()
A list of symbols that make up this alphabet. |
size
public int size()
- The number of symbols in the alphabet.
- Returns:
- the size of the alphabet
iterator
public java.util.Iterator iterator()
- Retrieve an Iterator over the Symbols in this FiniteAlphabet.
Each AtomicSymbol as for which this.contains(as) is true will be returned
exactly once by this iterator in no specified order.
- Returns:
- an Iterator over the contained AtomicSymbol objects
symbols
public SymbolList symbols()
- A list of symbols that make up this alphabet.
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.
- Returns:
- a SymbolList containing one AtomicSymbol for each AtomicSymbol in
this alphabet