Package org.biojava.bio.seq.io.agave
Class StAXFeatureHandler
java.lang.Object
org.biojava.bio.seq.io.agave.StAXContentHandlerBase
org.biojava.bio.seq.io.agave.StAXFeatureHandler
- All Implemented Interfaces:
StAXContentHandler
- Direct Known Subclasses:
AGAVEAssemblyHandler,AGAVEBioSeqHandler,AGAVEBioSequenceHandler,AGAVECdsHandler,AGAVEChromosomeHandler,AGAVEClassificationHandler,AGAVECompResultHandler,AGAVEComputationHandler,AGAVEContigHandler,AGAVEEvidenceHandler,AGAVEFragmentOrderHandler,AGAVEFragmentOrientationHandler,AGAVEGeneHandler,AGAVEHandler,AGAVEMrnaHandler,AGAVEPredictedProteinHandler,AGAVEQueryRegionPropHandler,AGAVEResultGroupHandler,AGAVESeqFeatureHandler,AGAVESeqMapHandler,AGAVETranscriptHandler,AGAVEUnorderedFragmentsHandler
StAX handler shamelessly ripped off from Thomas Down's
XFFFeatureSetHandler. It was modified for greater
generality.
NOTE This class is not thread-safe -- it
must only be used for one parse at any time.
Because AGAVE has nested feature and each feature must attached to some parent feature-holder in biojava, which means we need to generate parents first, so we have to keep the tree structure of features in memory, which is really bad. anyway, we still saved a lot of memory compared with DOM tree . Hanning Ni)
- Author:
- copied from Thomas Down, copied from David Huen, Hanning Ni Doubletwist Inc
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected SimpleAnnotationprotected Listthis is the stack of handler objects for the current feature.protected intprotected SeqIOListenerprotected Feature.Templateprotected Stringprotected intprotected intprotected StAXFeatureHandlerprotected List -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected voidaddHandler(ElementRecognizer rec, StAXHandlerFactory handler) protected Feature.Templategenerates a very basic Template for the feature with SmallAnnotation in the annotation field.voidendElement(String nsURI, String localName, String qName, StAXContentHandler handler) Handles basic exit processing.voidendElementHandler(String nsURI, String localName, String qName, StAXContentHandler handler) Element specific exit handler Subclass to do anything useful.Return current feature listenerprotected ListIteratorgetHandlerStackIterator(int level) return iterator to callbackStackprotected intgetLevel()return current stack level.protected voidpop()pop a StAXContentHandler off the stack.protected voidpush(StAXContentHandler handler) Push StAXContentHandler object onto stackprotected voidrealizeSubFeatures(Feature feature) recursively attach children features to parentvoidvoidsetHandlerCharacteristics(String localName, boolean hasCallback) Sets the element name that the class responds to.protected voidsetProperty(String name, String value, boolean forFeature) voidstartElement(String nsURI, String localName, String qName, Attributes attrs, DelegationManager dm) Handles basic entry processing for all feature handlers.voidstartElementHandler(String nsURI, String localName, String qName, Attributes attrs) Element-specific handler.Methods inherited from class org.biojava.bio.seq.io.agave.StAXContentHandlerBase
characters, endPrefixMapping, endTree, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startPrefixMapping, startTree
-
Field Details
-
myLocalName
-
featureTemplate
-
staxenv
-
featureListener
-
startLoc
-
endLoc
-
callbackStack
this is the stack of handler objects for the current feature. The base value is the FeatureHandler itself. your feature and property handlers place and remove themselves from this stack. the purpose of all this is to implement context sensitivty for property handlers translucently. Property handlers can pop the stack for other handlers that implement interfaces that process that element. This way the context code is within the object that defines that context rather than in a child property handler. -
stackLevel
-
subFeatures
-
annot
-
-
Method Details
-
setHandlerCharacteristics
Sets the element name that the class responds to. -
setFeatureListener
-
addHandler
-
createTemplate
generates a very basic Template for the feature with SmallAnnotation in the annotation field.Override if you wish a more specialised Template.
-
realizeSubFeatures
recursively attach children features to parent -
addFeatureToSequence
- Throws:
Exception
-
getLevel
return current stack level. Remember that the stack level is incremented/decremented AFTER the push()/pop() calls and superclass startElement()/StopElement calls. -
getHandlerStackIterator
return iterator to callbackStack -
push
Push StAXContentHandler object onto stack -
pop
pop a StAXContentHandler off the stack. -
getFeatureListener
Return current feature listener -
setProperty
-
startElementHandler
public void startElementHandler(String nsURI, String localName, String qName, Attributes attrs) throws SAXException Element-specific handler. Subclass this to do something useful!- Throws:
SAXException
-
startElement
public void startElement(String nsURI, String localName, String qName, Attributes attrs, DelegationManager dm) throws SAXException Handles basic entry processing for all feature handlers.- Specified by:
startElementin interfaceStAXContentHandler- Overrides:
startElementin classStAXContentHandlerBase- Throws:
SAXException
-
endElementHandler
public void endElementHandler(String nsURI, String localName, String qName, StAXContentHandler handler) throws SAXException Element specific exit handler Subclass to do anything useful.- Throws:
SAXException
-
endElement
public void endElement(String nsURI, String localName, String qName, StAXContentHandler handler) throws SAXException Handles basic exit processing.- Specified by:
endElementin interfaceStAXContentHandler- Overrides:
endElementin classStAXContentHandlerBase- Throws:
SAXException
-