mkwan       2003/02/26 07:48:09

  Modified:    java/src/org/apache/xml/dtm/ref/sax2dtm Tag: XSLTC_DTM
                        SAX2DTM2.java
  Log:
  XSLTC_DTM performance work
  Improvement to DescendantIterator. If _startNode is the root node, do
  not need to do the isDescendant() check.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.18  +25 -10    
xml-xalan/java/src/org/apache/xml/dtm/ref/sax2dtm/Attic/SAX2DTM2.java
  
  Index: SAX2DTM2.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xml/dtm/ref/sax2dtm/Attic/SAX2DTM2.java,v
  retrieving revision 1.1.2.17
  retrieving revision 1.1.2.18
  diff -u -r1.1.2.17 -r1.1.2.18
  --- SAX2DTM2.java     21 Feb 2003 22:20:28 -0000      1.1.2.17
  +++ SAX2DTM2.java     26 Feb 2003 15:48:08 -0000      1.1.2.18
  @@ -1524,26 +1524,41 @@
        */
       public int next()
       {
  -      if (_startNode == NULL) {
  +      final int startNode = _startNode;
  +      if (startNode == NULL) {
           return NULL;
         }
   
  -      if (_includeSelf && (_currentNode + 1) == _startNode)
  +      if (_includeSelf && (_currentNode + 1) == startNode)
             return returnNode(makeNodeHandle(++_currentNode)); // | 
m_dtmIdent);
   
         int node = _currentNode;
         int type;
   
  -      do {
  -        node++;
  -        type = _type2(node);
  +      if (startNode == ROOTNODE) {
  +        do {
  +          node++;
  +          type = _type2(node);
   
  -        if (NULL == type ||!isDescendant(node)) {
  -          _currentNode = NULL;
  -          return END;
  -        }
  -      } while(ATTRIBUTE_NODE == type || TEXT_NODE == type
  +          if (NULL == type) {
  +            _currentNode = NULL;
  +            return END;
  +          }
  +        } while(ATTRIBUTE_NODE == type || TEXT_NODE == type
                    || NAMESPACE_NODE == type);
  +      }
  +      else {
  +        do {
  +          node++;
  +          type = _type2(node);
  +
  +          if (NULL == type ||!isDescendant(node)) {
  +            _currentNode = NULL;
  +            return END;
  +          }
  +        } while(ATTRIBUTE_NODE == type || TEXT_NODE == type
  +                 || NAMESPACE_NODE == type);      
  +      }
   
         _currentNode = node;
         return returnNode(makeNodeHandle(node));  // make handle.
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to