Package org.biojavax.bio.phylo.io.nexus
Interface NexusFileListener
- All Known Implementing Classes:
NexusFileBuilder,NexusFileListener.Abstract
public interface NexusFileListener
Listens to events fired by the Nexus parser. Use these events to handle data
directly or construct objects.
- Since:
- 1.6
- Author:
- Richard Holland, Tobias Thierer, Jim Balhoff
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classExample abstract implementation which all others should extend. -
Method Summary
Modifier and TypeMethodDescriptionvoidOpening a comment tag.voidcommentText(String comment) Receiving free text inside a comment tag.voidendBlock()Finished reading a block.voidClosing a comment tag.voidendFile()Finished reading a file.voidClosing a line (semi-colon encountered).getBlockParser(String blockName) Gets the parser to use for a given block.voidparseToken(String token) Encountered a token.voidsetBlockParser(String blockName, NexusBlockParser parser) Sets the parser to use for a given block.voidCauses the default block parsers to be assigned.voidstartBlock(String blockName) About to start a new block.voidAbout to start a new file.booleanDoes the listener want to know about brackets and braces as separate tokens?
-
Method Details
-
startFile
void startFile()About to start a new file. -
endFile
void endFile()Finished reading a file. -
beginComment
void beginComment()Opening a comment tag. -
commentText
Receiving free text inside a comment tag.- Parameters:
comment- the text of the comment.- Throws:
ParseException
-
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 file. -
setDefaultBlockParsers
void setDefaultBlockParsers()Causes the default block parsers to be assigned. This is called by the constructor of the abstract implementation. If it is not called, then at least the unknown block parser must be set by other means. -
setBlockParser
Sets the parser to use for a given block.- Parameters:
blockName- the name of the block.parser- the parser to use. Use null to unset an existing one and use the default one for that block instead.
-
getBlockParser
Gets the parser to use for a given block.- Parameters:
blockName- the name of the block. return parser the parser to use. Is never null.
-
startBlock
About to start a new block.- Parameters:
blockName- the name of the new block.
-
endBlock
void endBlock()Finished reading a block. -
parseToken
Encountered a token.- Parameters:
token- the token.- Throws:
ParseException- if the token is invalid.
-
wantsBracketsAndBraces
boolean wantsBracketsAndBraces()Does the listener want to know about brackets and braces as separate tokens?- Returns:
- true if it does.
-