## org.biojava.bio.symbol
Class NameParser

    java.lang.Object
      |
      +--org.biojava.bio.symbol.NameParser

public class NameParser
extends java.lang.Object
implements SymbolParser, java.io.Serializable

This uses Symbol names to parse characters into symbols.

Author:
  Matthew Pocock
See Also:
  Serialized Form

Constructor Summary
`NameParser(FiniteAlphabet alpha)`
`NameParser(java.util.Map nameToSymbol)`

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.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### NameParser

    public NameParser(FiniteAlphabet alpha)

### NameParser

    public NameParser(java.util.Map nameToSymbol)

Method Detail

### getAlphabet

    public Alphabet getAlphabet()

  Description copied from interface: SymbolParser
  The alphabet that all Symbols produced will belong to.
  Specified by:
    getAlphabet in interface SymbolParser
  Tags copied from interface: SymbolParser
  Returns:
    the Alphabet

### parse

    public SymbolList parse(java.lang.String seq)
                     throws IllegalSymbolException

  Description copied from interface: SymbolParser
  Parse an entire string into a SymbolList.

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

  Specified by:
    parse in interface SymbolParser
  Tags copied from interface: 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

  Description copied from interface: SymbolParser
  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.

  Specified by:
    parseToken in interface SymbolParser
  Tags copied from interface: SymbolParser
  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