Package org.biojava.bio.program.tagvalue
Class TagDropper
java.lang.Object
org.biojava.bio.program.tagvalue.SimpleTagValueWrapper
org.biojava.bio.program.tagvalue.TagDropper
- All Implemented Interfaces:
TagValueListener,TagValueWrapper
Silently drop all tags except those specified, and pass the rest onto a
delegate.
- Since:
- 1.2
- Author:
- Matthew Pocock
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a new TagDropper that will pass on all retained tags and values to tvl. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a tag to retain.booleandoRetain()Find out if known tags are retained or dropped.voidendTag()End the current tag.getTags()Get the complete set of tags that are currently recognized.voidRemove a tag so that it will not be retained.voidsetRetain(boolean retain) Set wether known tags are to be retained or dropped.voidStart a new tag.voidvalue(TagValueContext ctxt, Object value) A value has been seen.Methods inherited from class org.biojava.bio.program.tagvalue.SimpleTagValueWrapper
endRecord, getDelegate, setDelegate, startRecord
-
Constructor Details
-
TagDropper
public TagDropper() -
TagDropper
Create a new TagDropper that will pass on all retained tags and values to tvl. Initially, no tags will be retained.- Parameters:
tvl- the TagValueListener to inform of all surviving events
-
-
Method Details
-
addTag
Add a tag to retain.- Parameters:
tag- a tag that will be forwarded to the delegate
-
removeTag
Remove a tag so that it will not be retained.- Parameters:
tag- a tag that will not be forwarded to the delegate
-
getTags
Get the complete set of tags that are currently recognized.- Returns:
- the Set of known tags
-
setRetain
Set wether known tags are to be retained or dropped.If retain is true, then all known tags will be passed on and all other tags will be discarded. If retain is true, then all known tags will be dropped and all others passed on.
- Parameters:
retain- true if the tags are to be retained
-
doRetain
Find out if known tags are retained or dropped.- Returns:
- true if values are retained
-
startTag
Description copied from interface:TagValueListenerStart a new tag.- Specified by:
startTagin interfaceTagValueListener- Overrides:
startTagin classSimpleTagValueWrapper- Parameters:
tag- the Object representing the new tag- Throws:
ParserException- if the tag could not be started
-
endTag
Description copied from interface:TagValueListenerEnd the current tag.- Specified by:
endTagin interfaceTagValueListener- Overrides:
endTagin classSimpleTagValueWrapper- Throws:
ParserException- if the tag could not be ended
-
value
Description copied from interface:TagValueListenerA value has been seen.- Specified by:
valuein interfaceTagValueListener- Overrides:
valuein classSimpleTagValueWrapper- Parameters:
ctxt- a TagValueContext that could be used to push a sub-documentvalue- the value Object observed- Throws:
ParserException- if the value could not be processed
-