org.biojava.bio.symbol
Interface SymbolParser

All Known Implementing Classes:
CrossProductSymbolNameParser, FixedWidthParser, TokenParser, NameParser

public interface SymbolParser

These objects are responsible for converting strings into Symbols and SymbolLists.


Method Summary
 Alphabet getAlphabet()
          The alphabet that all Symbols produced will belong to.
 SymbolList parse(java.lang.String seq)
          Parse an entire string into a SymbolList.
 Symbol parseToken(java.lang.String token)
          Returns the symbol for a single token.
 

Method Detail

getAlphabet

public Alphabet getAlphabet()
The alphabet that all Symbols produced will belong to.
Returns:
the Alphabet

parse

public SymbolList parse(java.lang.String seq)
                 throws IllegalSymbolException
Parse an entire string into a SymbolList.

The SymbolList produced will have the same Alphabet as this SymbolParser.

Parameters:
seq - the String to parse
Returns:
the SymbolList containing the parsed value of the String
Throws:
IllegalSymbolException - if any part of the String can not be parsed

parseToken

public Symbol parseToken(java.lang.String token)
                  throws IllegalSymbolException
Returns the symbol for a single token.

The Symbol will be a member of the alphabet. If the token is not recognized as mapping to a symbol, an exception will be thrown.

Parameters:
token - the token to retrieve a Symbol for
Returns:
the Symbol for that token
Throws:
IllegalSymbolException - if there is no Symbol for the token