org.biojava.bio.symbol
Class AbstractAlphabet
java.lang.Object
|
+--org.biojava.bio.symbol.AbstractAlphabet
- Direct Known Subclasses:
- SimpleAlphabet
- public abstract class AbstractAlphabet
- extends java.lang.Object
- implements FiniteAlphabet
An abstract implementation of Alphabet.
This provides the frame-work for maintaining the SymbolParser <-> name
mappings.
This class is for developers to derive from, not for use directly.
- Author:
- Matthew Pocock
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
AbstractAlphabet
protected AbstractAlphabet()
putParser
public void putParser(java.lang.String name,
SymbolParser parser)
- Assigns a symbol parser to a string object. Afterwards, the parser can be retrieved using the getParser method.
- Parameters:
name
- Name of the string to associate with a parser.parser
- The parser to associate your string with.
getParser
public SymbolParser getParser(java.lang.String name)
throws java.util.NoSuchElementException
- Description copied from interface: Alphabet
- Get a parser by name.
The parser returned is guaranteed to return Symbols and SymbolLists that
conform to this alphabet.
Every alphabet should have a SymbolParser under the name 'token' that
uses the symbol token characters to translate a string into a
SymbolList. Likewise, there should be a SymbolParser under the name
'name' that uses symbol names to identify symbols. Any other names may
also be defined, but the behaviour of that parser is not defined here.
- Tags copied from interface: Alphabet
- Parameters:
name
- the name of the parser- Returns:
- a parser for that name
- Throws:
- java.util.NoSuchElementException - if the name is unknown
- BioException - if for any reason the parser could not be built