zongaro 2002/10/22 07:50:40 Modified: java/src/org/apache/xml/dtm/ref Tag: XSLTC_DTM DTMDefaultBaseIterators.java Log: Override setMark() and gotoMark() in PrecedingIterator and AncestorIterator classes so that they operate correctly when called by the getLast() method. Revision Changes Path No revision No revision 1.12.2.6 +32 -0 xml-xalan/java/src/org/apache/xml/dtm/ref/DTMDefaultBaseIterators.java Index: DTMDefaultBaseIterators.java =================================================================== RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/dtm/ref/DTMDefaultBaseIterators.java,v retrieving revision 1.12.2.5 retrieving revision 1.12.2.6 diff -u -r1.12.2.5 -r1.12.2.6 --- DTMDefaultBaseIterators.java 17 Sep 2002 21:10:14 -0000 1.12.2.5 +++ DTMDefaultBaseIterators.java 22 Oct 2002 14:50:40 -0000 1.12.2.6 @@ -1157,6 +1157,8 @@ /** (not sure yet... -sb) */ protected int _sp, _oldsp; + protected int _markedsp, _markedNode, _markedDescendant; + /* _currentNode precedes candidates. This is the identity, not the handle! */ /** @@ -1288,6 +1290,24 @@ return resetPosition(); } + + public void setMark() { + _markedsp = _sp; + _markedNode = _currentNode; + _markedDescendant = _stack[0]; + } + + public void gotoMark() { + _sp = _markedsp; + _currentNode = _markedNode; + _stack[0] = _markedDescendant; + int parent = _parent(_currentNode); + for (int index = 1; index < _sp-1; index++) { + _stack[index] = parent; + parent = _parent(parent); + } + _stack[_sp] = _currentNode; + } } // end of PrecedingIterator /** @@ -1454,6 +1474,8 @@ new org.apache.xml.utils.NodeVector(); int m_ancestorsPos; + + int m_markedPos; /** The real start node for this axes, since _startNode will be adjusted. */ int m_realStartNode; @@ -1576,6 +1598,16 @@ : DTM.NULL; return returnNode(next); + } + + public void setMark() { + m_markedPos = m_ancestorsPos; + } + + public void gotoMark() { + m_ancestorsPos = m_markedPos; + _currentNode = m_ancestorsPos>=0 ? m_ancestors.elementAt(m_ancestorsPos) + : DTM.NULL; } } // end of AncestorIterator
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]