Package org.biojavax.bio.phylo.io.nexus
Interface NexusBlockParser
- All Known Implementing Classes:
CharactersBlockParser
,DataBlockParser
,DistancesBlockParser
,NexusBlockParser.Abstract
,TaxaBlockParser
,TreesBlockParser
public interface NexusBlockParser
Parses Nexus blocks. Each instance should parse tokens into events that can
be fired at some kind of NexusBlockListener. An Abstract parser is provided
from which all implementations should derive.
- Since:
- 1.6
- Author:
- Richard Holland, Tobias Thierer, Jim Balhoff
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic class
All block parsers should derive from this abstract parser. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoid
Opening a comment tag.void
commentText
(String comment) Receiving free text inside a comment tag.void
endBlock()
Notifies the parser that a block is ending.void
Closing a comment tag.void
Closing a line (semi-colon encountered).Obtain the listener for this parser.void
parseToken
(String token) Notifies the parser of the next token.void
startBlock
(String blockName) Notifies the parser that a new block is starting.boolean
Does the listener want to know about brackets and braces as separate tokens?
-
Field Details
-
UNKNOWN_BLOCK
The name for an unknown block parser.- See Also:
-
-
Method Details
-
startBlock
Notifies the parser that a new block is starting.- Parameters:
blockName
- the name of the block.
-
endBlock
void endBlock()Notifies the parser that a block is ending. -
parseToken
Notifies the parser of the next token. Comment tokens will already have been parsed out and sent separately to the text() method of the listener. Quoted strings will have been parsed and underscores converted. What this token contains is the full string, after removal of quotes if necessary. The token will never be only whitespace.- Parameters:
token
- the token to parse.- Throws:
ParseException
- if the token is unparseable.
-
beginComment
void beginComment()Opening a comment tag. -
endComment
void endComment()Closing a comment tag. -
endTokenGroup
void endTokenGroup()Closing a line (semi-colon encountered). This indicates that anything received after it is on the next logical line of the block. -
commentText
Receiving free text inside a comment tag.- Parameters:
comment
- the text of the comment.- Throws:
ParseException
-
getBlockListener
Obtain the listener for this parser.- Returns:
- the listener.
-
wantsBracketsAndBraces
boolean wantsBracketsAndBraces()Does the listener want to know about brackets and braces as separate tokens?- Returns:
- true if it does.
-