org.biojava.bio.program.tagvalue
Class MultiTagger

java.lang.Object
  extended by org.biojava.bio.program.tagvalue.SimpleTagValueWrapper
      extended by 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
MultiTagger(TagValueListener listener, BoundaryFinder observer)
           
 
Method Summary
 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 interface TagValueListener
Overrides:
startTag in class SimpleTagValueWrapper
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 interface TagValueListener
Overrides:
value in class SimpleTagValueWrapper
Parameters:
ctxt - a TagValueContext that could be used to push a sub-document
value - 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 interface TagValueListener
Overrides:
endTag in class SimpleTagValueWrapper
Throws:
ParserException - if the tag could not be ended