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 Classes Modifier and Type Interface Description static classNexusBlockParser.AbstractAll block parsers should derive from this abstract parser.
-
Field Summary
Fields Modifier and Type Field Description static StringUNKNOWN_BLOCKThe name for an unknown block parser.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidbeginComment()Opening a comment tag.voidcommentText(String comment)Receiving free text inside a comment tag.voidendBlock()Notifies the parser that a block is ending.voidendComment()Closing a comment tag.voidendTokenGroup()Closing a line (semi-colon encountered).NexusBlockListenergetBlockListener()Obtain the listener for this parser.voidparseToken(String token)Notifies the parser of the next token.voidstartBlock(String blockName)Notifies the parser that a new block is starting.booleanwantsBracketsAndBraces()Does the listener want to know about brackets and braces as separate tokens?
-
-
-
Field Detail
-
UNKNOWN_BLOCK
static final String UNKNOWN_BLOCK
The name for an unknown block parser.- See Also:
- Constant Field Values
-
-
Method Detail
-
startBlock
void startBlock(String blockName)
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
void parseToken(String token) throws ParseException
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
void commentText(String comment) throws ParseException
Receiving free text inside a comment tag.- Parameters:
comment- the text of the comment.- Throws:
ParseException
-
getBlockListener
NexusBlockListener 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.
-
-