Class MultiTagger
- java.lang.Object
-
- org.biojava.bio.program.tagvalue.SimpleTagValueWrapper
-
- org.biojava.bio.program.tagvalue.MultiTagger
-
- All Implemented Interfaces:
TagValueListener
,TagValueWrapper
public class MultiTagger extends SimpleTagValueWrapper
Partician multiple values for a tag into their own tag groups.With tag-value files, it is not uncommon for information about logical blocks of data to be encoded in the values as well as tags of the document. For example, in swissprot entries, the comment block may be punctuated by lines that clearly seperate one logical comment from another, but there may be no change in the pattern of tags to indicate this. Some fields, such as alternate names in Enzyme, are a ist of values but some of the values are longer than a single line. Each value is terminated with a period ".", but again there is no way from the tags to know the logical grouping.
This class provides callbacks to allow event streams to be re-written so that they contain this information. A single CC tag with multiple values can be re-written as multiple CC tags with values for each logical comment. This is done by presenting each value to an instance of Agregator.Observer that indicates if the current value signals the end of a logcal block.
- Since:
- 1.4
- Author:
- Matthew Pocock
-
-
Constructor Summary
Constructors Constructor Description MultiTagger(TagValueListener listener, BoundaryFinder observer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
endTag()
End the current tag.BoundaryFinder
getBoundaryFinder()
void
startTag(Object tag)
Start a new tag.void
value(TagValueContext ctxt, Object value)
A value has been seen.-
Methods inherited from class org.biojava.bio.program.tagvalue.SimpleTagValueWrapper
endRecord, getDelegate, setDelegate, startRecord
-
-
-
-
Constructor Detail
-
MultiTagger
public MultiTagger(TagValueListener listener, BoundaryFinder observer)
-
-
Method Detail
-
getBoundaryFinder
public BoundaryFinder getBoundaryFinder()
-
startTag
public void startTag(Object tag) throws ParserException
Description copied from interface:TagValueListener
Start a new tag.- Specified by:
startTag
in interfaceTagValueListener
- Overrides:
startTag
in classSimpleTagValueWrapper
- Parameters:
tag
- the Object representing the new tag- Throws:
ParserException
- if the tag could not be started
-
value
public void value(TagValueContext ctxt, Object value) throws ParserException
Description copied from interface:TagValueListener
A value has been seen.- Specified by:
value
in interfaceTagValueListener
- Overrides:
value
in 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
-
endTag
public void endTag() throws ParserException
Description copied from interface:TagValueListener
End the current tag.- Specified by:
endTag
in interfaceTagValueListener
- Overrides:
endTag
in classSimpleTagValueWrapper
- Throws:
ParserException
- if the tag could not be ended
-
-