Package org.biojavax.bio.phylo.io.nexus
Class NexusFileListener.Abstract
java.lang.Object
org.biojavax.bio.phylo.io.nexus.NexusFileListener.Abstract
- All Implemented Interfaces:
NexusFileListener
- Direct Known Subclasses:
NexusFileBuilder
- Enclosing interface:
NexusFileListener
Example abstract implementation which all others should extend.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.biojavax.bio.phylo.io.nexus.NexusFileListener
NexusFileListener.Abstract
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Opening a comment tag.protected abstract void
This method will get called when a comment is started on the file, and not any block within it.protected abstract void
blockEnded
(NexusBlockParser blockParser) This method gets called when the block parser is expected to have finished parsing a block.void
commentText
(String comment) Receiving free text inside a comment tag.void
endBlock()
Finished reading a block.void
Closing a comment tag.protected abstract void
This method will get called when a comment is ended on the file, and not any block within it.void
Closing a line (semi-colon encountered).protected abstract void
fileCommentText
(String comment) This method will get called when comment text is found on the file, and not any block within it.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
Causes the default block parsers to be assigned.void
startBlock
(String blockName) About to start a new block.boolean
Does the listener want to know about brackets and braces as separate tokens?Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.biojavax.bio.phylo.io.nexus.NexusFileListener
endFile, startFile
-
Constructor Details
-
Abstract
public Abstract()
-
-
Method Details
-
beginComment
Description copied from interface:NexusFileListener
Opening a comment tag.- Specified by:
beginComment
in interfaceNexusFileListener
-
beginFileComment
This method will get called when a comment is started on the file, and not any block within it. -
commentText
Description copied from interface:NexusFileListener
Receiving free text inside a comment tag.- Specified by:
commentText
in interfaceNexusFileListener
- Parameters:
comment
- the text of the comment.- Throws:
ParseException
-
fileCommentText
This method will get called when comment text is found on the file, and not any block within it.- Parameters:
comment
- the comment text.
-
endComment
Description copied from interface:NexusFileListener
Closing a comment tag.- Specified by:
endComment
in interfaceNexusFileListener
-
endFileComment
This method will get called when a comment is ended on the file, and not any block within it. -
endBlock
Description copied from interface:NexusFileListener
Finished reading a block.- Specified by:
endBlock
in interfaceNexusFileListener
-
blockEnded
This method gets called when the block parser is expected to have finished parsing a block.- Parameters:
blockParser
- the parser that has finished.
-
wantsBracketsAndBraces
Description copied from interface:NexusFileListener
Does the listener want to know about brackets and braces as separate tokens?- Specified by:
wantsBracketsAndBraces
in interfaceNexusFileListener
- Returns:
- true if it does.
-
setDefaultBlockParsers
Description copied from interface:NexusFileListener
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.- Specified by:
setDefaultBlockParsers
in interfaceNexusFileListener
-
getBlockParser
Description copied from interface:NexusFileListener
Gets the parser to use for a given block.- Specified by:
getBlockParser
in interfaceNexusFileListener
- Parameters:
blockName
- the name of the block. return parser the parser to use. Is never null.
-
endTokenGroup
Description copied from interface:NexusFileListener
Closing a line (semi-colon encountered). This indicates that anything received after it is on the next logical line of the file.- Specified by:
endTokenGroup
in interfaceNexusFileListener
-
parseToken
Description copied from interface:NexusFileListener
Encountered a token.- Specified by:
parseToken
in interfaceNexusFileListener
- Parameters:
token
- the token.- Throws:
ParseException
- if the token is invalid.
-
setBlockParser
Description copied from interface:NexusFileListener
Sets the parser to use for a given block.- Specified by:
setBlockParser
in interfaceNexusFileListener
- 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.
-
startBlock
Description copied from interface:NexusFileListener
About to start a new block.- Specified by:
startBlock
in interfaceNexusFileListener
- Parameters:
blockName
- the name of the new block.
-