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 Classes Modifier and Type Interface Description static class
NexusFileListener.Abstract
Example abstract implementation which all others should extend.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
beginComment()
Opening a comment tag.void
commentText(String comment)
Receiving free text inside a comment tag.void
endBlock()
Finished reading a block.void
endComment()
Closing a comment tag.void
endFile()
Finished reading a file.void
endTokenGroup()
Closing a line (semi-colon encountered).NexusBlockParser
getBlockParser(String blockName)
Gets the parser to use for a given block.void
parseToken(String token)
Encountered a token.void
setBlockParser(String blockName, NexusBlockParser parser)
Sets the parser to use for a given block.void
setDefaultBlockParsers()
Causes the default block parsers to be assigned.void
startBlock(String blockName)
About to start a new block.void
startFile()
About to start a new file.boolean
wantsBracketsAndBraces()
Does the listener want to know about brackets and braces as separate tokens?
-
-
-
Method Detail
-
startFile
void startFile()
About to start a new file.
-
endFile
void endFile()
Finished reading a file.
-
beginComment
void beginComment()
Opening a comment tag.
-
commentText
void commentText(String comment) throws ParseException
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
void setBlockParser(String blockName, NexusBlockParser parser)
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
NexusBlockParser getBlockParser(String blockName)
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
void startBlock(String blockName)
About to start a new block.- Parameters:
blockName
- the name of the new block.
-
endBlock
void endBlock()
Finished reading a block.
-
parseToken
void parseToken(String token) throws ParseException
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.
-
-