morten      01/09/12 08:16:48

  Modified:    java/src/org/apache/xalan/xsltc/dom NodeIteratorBase.java
                        UnionIterator.java
  Log:
  Fix for the count() function and union iterators. Union iterators would not
  reset all the iterators it contained, and it needed a reset() method.
  PR:           bugzilla 3504
  Obtained from:        n/a
  Submitted by: [EMAIL PROTECTED]
  Reviewed by:  [EMAIL PROTECTED]
  
  Revision  Changes    Path
  1.2       +2 -1      
xml-xalan/java/src/org/apache/xalan/xsltc/dom/NodeIteratorBase.java
  
  Index: NodeIteratorBase.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/dom/NodeIteratorBase.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- NodeIteratorBase.java     2001/04/17 18:52:33     1.1
  +++ NodeIteratorBase.java     2001/09/12 15:16:48     1.2
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: NodeIteratorBase.java,v 1.1 2001/04/17 18:52:33 sboag Exp $
  + * @(#)$Id: NodeIteratorBase.java,v 1.2 2001/09/12 15:16:48 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -99,6 +99,7 @@
            gotoMark();
            _position = temp;
        }
  +     System.err.println("getLast() returning "+_last);
        return _last;
       }
   
  
  
  
  1.6       +14 -5     
xml-xalan/java/src/org/apache/xalan/xsltc/dom/UnionIterator.java
  
  Index: UnionIterator.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/dom/UnionIterator.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- UnionIterator.java        2001/08/16 12:06:45     1.5
  +++ UnionIterator.java        2001/09/12 15:16:48     1.6
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: UnionIterator.java,v 1.5 2001/08/16 12:06:45 morten Exp $
  + * @(#)$Id: UnionIterator.java,v 1.6 2001/09/12 15:16:48 morten Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -113,7 +113,7 @@
     
       // last node returned by this UnionIterator to the caller of next
       // used to prune duplicates
  -    private int _last;
  +    private int _returnedLast;
   
       public UnionIterator(DOM dom) {
        _dom = dom;
  @@ -158,13 +158,13 @@
                    return END;
                }
            }
  -         else if (smallest == _last) {       // duplicate
  +         else if (smallest == _returnedLast) {       // duplicate
                _heap[0].step(); // value consumed
            }
            else {
                _heap[0].step(); // value consumed
                heapify(0);
  -             return returnNode(_last = smallest);
  +             return returnNode(_returnedLast = smallest);
            }
            // fallthrough if not returned above
            heapify(0);
  @@ -183,7 +183,7 @@
            for (int i = (_heapSize = _free)/2; i >= 0; i--) {
                heapify(i);
            }
  -         _last = END;
  +         _returnedLast = END;
            return resetPosition();
        }
        return this;
  @@ -220,4 +220,13 @@
            _heap[i].gotoMark();
        }
       }
  +
  +    public NodeIterator reset() {
  +     super.reset();
  +     for (int i = 0; i < _free; i++) {
  +         _heap[i].iterator.reset();
  +     }
  +     return(this);
  +    }
  +
   }
  
  
  

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

Reply via email to