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
public abstract static class NexusFileListener.Abstract extends java.lang.Object implements 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 Constructor Description Abstract()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidbeginComment()Opening a comment tag.protected abstract voidbeginFileComment()This method will get called when a comment is started on the file, and not any block within it.protected abstract voidblockEnded(NexusBlockParser blockParser)This method gets called when the block parser is expected to have finished parsing a block.voidcommentText(java.lang.String comment)Receiving free text inside a comment tag.voidendBlock()Finished reading a block.voidendComment()Closing a comment tag.protected abstract voidendFileComment()This method will get called when a comment is ended on the file, and not any block within it.voidendTokenGroup()Closing a line (semi-colon encountered).protected abstract voidfileCommentText(java.lang.String comment)This method will get called when comment text is found on the file, and not any block within it.NexusBlockParsergetBlockParser(java.lang.String blockName)Gets the parser to use for a given block.voidparseToken(java.lang.String token)Encountered a token.voidsetBlockParser(java.lang.String blockName, NexusBlockParser parser)Sets the parser to use for a given block.voidsetDefaultBlockParsers()Causes the default block parsers to be assigned.voidstartBlock(java.lang.String blockName)About to start a new block.booleanwantsBracketsAndBraces()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 Detail
-
Abstract
public Abstract()
-
-
Method Detail
-
beginComment
public void beginComment()
Description copied from interface:NexusFileListenerOpening a comment tag.- Specified by:
beginCommentin interfaceNexusFileListener
-
beginFileComment
protected abstract void beginFileComment()
This method will get called when a comment is started on the file, and not any block within it.
-
commentText
public void commentText(java.lang.String comment) throws ParseException
Description copied from interface:NexusFileListenerReceiving free text inside a comment tag.- Specified by:
commentTextin interfaceNexusFileListener- Parameters:
comment- the text of the comment.- Throws:
ParseException
-
fileCommentText
protected abstract void fileCommentText(java.lang.String comment)
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
public void endComment()
Description copied from interface:NexusFileListenerClosing a comment tag.- Specified by:
endCommentin interfaceNexusFileListener
-
endFileComment
protected abstract void endFileComment()
This method will get called when a comment is ended on the file, and not any block within it.
-
endBlock
public void endBlock()
Description copied from interface:NexusFileListenerFinished reading a block.- Specified by:
endBlockin interfaceNexusFileListener
-
blockEnded
protected abstract void blockEnded(NexusBlockParser blockParser)
This method gets called when the block parser is expected to have finished parsing a block.- Parameters:
blockParser- the parser that has finished.
-
wantsBracketsAndBraces
public boolean wantsBracketsAndBraces()
Description copied from interface:NexusFileListenerDoes the listener want to know about brackets and braces as separate tokens?- Specified by:
wantsBracketsAndBracesin interfaceNexusFileListener- Returns:
- true if it does.
-
setDefaultBlockParsers
public void setDefaultBlockParsers()
Description copied from interface:NexusFileListenerCauses 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:
setDefaultBlockParsersin interfaceNexusFileListener
-
getBlockParser
public NexusBlockParser getBlockParser(java.lang.String blockName)
Description copied from interface:NexusFileListenerGets the parser to use for a given block.- Specified by:
getBlockParserin interfaceNexusFileListener- Parameters:
blockName- the name of the block. return parser the parser to use. Is never null.
-
endTokenGroup
public void endTokenGroup()
Description copied from interface:NexusFileListenerClosing a line (semi-colon encountered). This indicates that anything received after it is on the next logical line of the file.- Specified by:
endTokenGroupin interfaceNexusFileListener
-
parseToken
public void parseToken(java.lang.String token) throws ParseException
Description copied from interface:NexusFileListenerEncountered a token.- Specified by:
parseTokenin interfaceNexusFileListener- Parameters:
token- the token.- Throws:
ParseException- if the token is invalid.
-
setBlockParser
public void setBlockParser(java.lang.String blockName, NexusBlockParser parser)
Description copied from interface:NexusFileListenerSets the parser to use for a given block.- Specified by:
setBlockParserin 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
public void startBlock(java.lang.String blockName)
Description copied from interface:NexusFileListenerAbout to start a new block.- Specified by:
startBlockin interfaceNexusFileListener- Parameters:
blockName- the name of the new block.
-
-