Class NGCCInterleaveFilter

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int _cookie
      Cookie given by the parent.
      private NGCCHandler _parent
      Parent handler.
      protected NGCCEventReceiver[] _receivers
      event receiverse.
      private boolean isJoining
      Set to true when this handler is in the process of joining all branches.
      private int lockCount
      Nest level.
      private int lockedReceiver
      Receiver that is being locked and therefore receives all the events.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void enterAttribute​(java.lang.String uri, java.lang.String localName, java.lang.String qname)  
      void enterElement​(java.lang.String uri, java.lang.String localName, java.lang.String qname, org.xml.sax.Attributes atts)  
      protected abstract int findReceiverOfAttribute​(java.lang.String uri, java.lang.String local)
      Returns the handler that can receive the given attribute, or null.
      protected abstract int findReceiverOfElement​(java.lang.String uri, java.lang.String local)
      Implemented by the generated code to determine the handler that can receive the given element.
      protected abstract int findReceiverOfText()
      Returns the handler that can receive text events, or null.
      void joinByEnterAttribute​(NGCCEventReceiver source, java.lang.String uri, java.lang.String local, java.lang.String qname)  
      void joinByEnterElement​(NGCCEventReceiver source, java.lang.String uri, java.lang.String local, java.lang.String qname, org.xml.sax.Attributes atts)
      Joins all the child receivers.
      void joinByLeaveAttribute​(NGCCEventReceiver source, java.lang.String uri, java.lang.String local, java.lang.String qname)  
      void joinByLeaveElement​(NGCCEventReceiver source, java.lang.String uri, java.lang.String local, java.lang.String qname)  
      void joinByText​(NGCCEventReceiver source, java.lang.String value)  
      void leaveAttribute​(java.lang.String uri, java.lang.String localName, java.lang.String qname)  
      void leaveElement​(java.lang.String uri, java.lang.String localName, java.lang.String qname)  
      int replace​(NGCCEventReceiver oldHandler, NGCCEventReceiver newHandler)
      Replaces an old handler with a new handler, and returns ID of the EventReceiver thread.
      void sendEnterAttribute​(int threadId, java.lang.String uri, java.lang.String local, java.lang.String qname)  
      void sendEnterElement​(int threadId, java.lang.String uri, java.lang.String local, java.lang.String qname, org.xml.sax.Attributes atts)
      Sends an enter element event to the specified EventReceiver thread.
      void sendLeaveAttribute​(int threadId, java.lang.String uri, java.lang.String local, java.lang.String qname)  
      void sendLeaveElement​(int threadId, java.lang.String uri, java.lang.String local, java.lang.String qname)  
      void sendText​(int threadId, java.lang.String value)  
      protected void setHandlers​(NGCCEventReceiver[] receivers)  
      void text​(java.lang.String value)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • _parent

        private final NGCCHandler _parent
        Parent handler.
      • _cookie

        private final int _cookie
        Cookie given by the parent.
      • lockedReceiver

        private int lockedReceiver
        Receiver that is being locked and therefore receives all the events.
        
         <interleave>
           <element name="foo"/>
           <element name="bar">
             <element name="foo"/>
           </element>
         </interlaeve>
         
        When processing inside the bar element, this receiver is "locked" so that it can correctly receive its child foo element.
      • lockCount

        private int lockCount
        Nest level. Lock will be release when the lockCount becomes 0.
      • isJoining

        private boolean isJoining
        Set to true when this handler is in the process of joining all branches.
    • Constructor Detail

      • NGCCInterleaveFilter

        protected NGCCInterleaveFilter​(NGCCHandler parent,
                                       int cookie)
    • Method Detail

      • enterElement

        public void enterElement​(java.lang.String uri,
                                 java.lang.String localName,
                                 java.lang.String qname,
                                 org.xml.sax.Attributes atts)
                          throws org.xml.sax.SAXException
        Specified by:
        enterElement in interface NGCCEventReceiver
        Throws:
        org.xml.sax.SAXException
      • leaveElement

        public void leaveElement​(java.lang.String uri,
                                 java.lang.String localName,
                                 java.lang.String qname)
                          throws org.xml.sax.SAXException
        Specified by:
        leaveElement in interface NGCCEventReceiver
        Throws:
        org.xml.sax.SAXException
      • enterAttribute

        public void enterAttribute​(java.lang.String uri,
                                   java.lang.String localName,
                                   java.lang.String qname)
                            throws org.xml.sax.SAXException
        Specified by:
        enterAttribute in interface NGCCEventReceiver
        Throws:
        org.xml.sax.SAXException
      • leaveAttribute

        public void leaveAttribute​(java.lang.String uri,
                                   java.lang.String localName,
                                   java.lang.String qname)
                            throws org.xml.sax.SAXException
        Specified by:
        leaveAttribute in interface NGCCEventReceiver
        Throws:
        org.xml.sax.SAXException
      • text

        public void text​(java.lang.String value)
                  throws org.xml.sax.SAXException
        Specified by:
        text in interface NGCCEventReceiver
        Throws:
        org.xml.sax.SAXException
      • findReceiverOfElement

        protected abstract int findReceiverOfElement​(java.lang.String uri,
                                                     java.lang.String local)
        Implemented by the generated code to determine the handler that can receive the given element.
        Returns:
        Thread ID of the receiver that can handle this event, or -1 if none.
      • findReceiverOfAttribute

        protected abstract int findReceiverOfAttribute​(java.lang.String uri,
                                                       java.lang.String local)
        Returns the handler that can receive the given attribute, or null.
      • findReceiverOfText

        protected abstract int findReceiverOfText()
        Returns the handler that can receive text events, or null.
      • joinByEnterElement

        public void joinByEnterElement​(NGCCEventReceiver source,
                                       java.lang.String uri,
                                       java.lang.String local,
                                       java.lang.String qname,
                                       org.xml.sax.Attributes atts)
                                throws org.xml.sax.SAXException
        Joins all the child receivers.

        This method is called by a child receiver when it sees something that it cannot handle, or by this object itself when it sees an event that it can't process.

        This method forces children to move to its final state, then revert to the parent.

        Parameters:
        source - If this method is called by one of the child receivers, the receiver object. If this method is called by itself, null.
        Throws:
        org.xml.sax.SAXException
      • joinByLeaveElement

        public void joinByLeaveElement​(NGCCEventReceiver source,
                                       java.lang.String uri,
                                       java.lang.String local,
                                       java.lang.String qname)
                                throws org.xml.sax.SAXException
        Throws:
        org.xml.sax.SAXException
      • joinByEnterAttribute

        public void joinByEnterAttribute​(NGCCEventReceiver source,
                                         java.lang.String uri,
                                         java.lang.String local,
                                         java.lang.String qname)
                                  throws org.xml.sax.SAXException
        Throws:
        org.xml.sax.SAXException
      • joinByLeaveAttribute

        public void joinByLeaveAttribute​(NGCCEventReceiver source,
                                         java.lang.String uri,
                                         java.lang.String local,
                                         java.lang.String qname)
                                  throws org.xml.sax.SAXException
        Throws:
        org.xml.sax.SAXException
      • joinByText

        public void joinByText​(NGCCEventReceiver source,
                               java.lang.String value)
                        throws org.xml.sax.SAXException
        Throws:
        org.xml.sax.SAXException
      • sendEnterAttribute

        public void sendEnterAttribute​(int threadId,
                                       java.lang.String uri,
                                       java.lang.String local,
                                       java.lang.String qname)
                                throws org.xml.sax.SAXException
        Specified by:
        sendEnterAttribute in interface NGCCEventSource
        Throws:
        org.xml.sax.SAXException
      • sendEnterElement

        public void sendEnterElement​(int threadId,
                                     java.lang.String uri,
                                     java.lang.String local,
                                     java.lang.String qname,
                                     org.xml.sax.Attributes atts)
                              throws org.xml.sax.SAXException
        Description copied from interface: NGCCEventSource
        Sends an enter element event to the specified EventReceiver thread.
        Specified by:
        sendEnterElement in interface NGCCEventSource
        Throws:
        org.xml.sax.SAXException
      • sendLeaveAttribute

        public void sendLeaveAttribute​(int threadId,
                                       java.lang.String uri,
                                       java.lang.String local,
                                       java.lang.String qname)
                                throws org.xml.sax.SAXException
        Specified by:
        sendLeaveAttribute in interface NGCCEventSource
        Throws:
        org.xml.sax.SAXException
      • sendLeaveElement

        public void sendLeaveElement​(int threadId,
                                     java.lang.String uri,
                                     java.lang.String local,
                                     java.lang.String qname)
                              throws org.xml.sax.SAXException
        Specified by:
        sendLeaveElement in interface NGCCEventSource
        Throws:
        org.xml.sax.SAXException
      • sendText

        public void sendText​(int threadId,
                             java.lang.String value)
                      throws org.xml.sax.SAXException
        Specified by:
        sendText in interface NGCCEventSource
        Throws:
        org.xml.sax.SAXException