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 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 void
beginComment()
Opening a comment tag.protected abstract void
beginFileComment()
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
endComment()
Closing a comment tag.protected abstract void
endFileComment()
This method will get called when a comment is ended on the file, and not any block within it.void
endTokenGroup()
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.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.boolean
wantsBracketsAndBraces()
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:NexusFileListener
Opening a comment tag.- Specified by:
beginComment
in 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(String comment) throws ParseException
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
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.- Parameters:
comment
- the comment text.
-
endComment
public void endComment()
Description copied from interface:NexusFileListener
Closing a comment tag.- Specified by:
endComment
in 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:NexusFileListener
Finished reading a block.- Specified by:
endBlock
in 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: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
public void 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
public NexusBlockParser getBlockParser(String blockName)
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
public void 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
public void parseToken(String token) throws ParseException
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
public void setBlockParser(String blockName, NexusBlockParser parser)
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
public void startBlock(String blockName)
Description copied from interface:NexusFileListener
About to start a new block.- Specified by:
startBlock
in interfaceNexusFileListener
- Parameters:
blockName
- the name of the new block.
-
-