garyp 00/11/02 14:43:00
Modified: java/src/org/apache/xpath/axes AxesWalker.java
LocPathIterator.java RootWalker.java
UnionPathIterator.java
Log:
Fix cloning to ensure that a fresh copy is returned.
Revision Changes Path
1.7 +3 -17 xml-xalan/java/src/org/apache/xpath/axes/AxesWalker.java
Index: AxesWalker.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/AxesWalker.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- AxesWalker.java 2000/10/30 18:58:44 1.6
+++ AxesWalker.java 2000/11/02 22:42:59 1.7
@@ -195,20 +195,11 @@
this.m_proximityPositions.length);
}
- m_testedForNTF = false;
+ clone.setCurrentNode(clone.m_root);
- return clone;
- }
-
- /**
- * Reset the Walker.
- */
- public void reset()
- {
+ clone.m_isFresh = true;
- setCurrentNode(m_root);
-
- m_isFresh = true;
+ return clone;
}
/**
@@ -1333,11 +1324,6 @@
/** NEEDSDOC Field m_isDone */
boolean m_isDone = false;
-
- // See note where this is used about this variable.
-
- /** NEEDSDOC Field m_testedForNTF */
- protected boolean m_testedForNTF = false;
/**
* Get the next node in document order on the axes.
1.7 +1 -0
xml-xalan/java/src/org/apache/xpath/axes/LocPathIterator.java
Index: LocPathIterator.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xpath/axes/LocPathIterator.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- LocPathIterator.java 2000/10/30 18:58:50 1.6
+++ LocPathIterator.java 2000/11/02 22:42:59 1.7
@@ -542,6 +542,7 @@
// super.reset();
m_foundLast = false;
m_lastFetched = null;
+ m_next = 0;
if (null != m_firstWalker)
{
1.3 +17 -0 xml-xalan/java/src/org/apache/xpath/axes/RootWalker.java
Index: RootWalker.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/RootWalker.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- RootWalker.java 2000/10/30 18:58:55 1.2
+++ RootWalker.java 2000/11/02 22:42:59 1.3
@@ -85,6 +85,23 @@
}
/**
+ * Get a cloned RootWalker.
+ *
+ * @return a new RootWalker ready to be used.
+ *
+ * @throws CloneNotSupportedException
+ */
+ public Object clone() throws CloneNotSupportedException
+ {
+
+ RootWalker clone = (RootWalker) super.clone();
+
+ clone.m_processedRoot = false;
+
+ return clone;
+ }
+
+ /**
* Moves the <code>TreeWalker</code> to the first visible child of the
* current node, and returns the new node. If the current node has no
* visible children, returns <code>null</code> , and retains the current
1.6 +1 -0
xml-xalan/java/src/org/apache/xpath/axes/UnionPathIterator.java
Index: UnionPathIterator.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xpath/axes/UnionPathIterator.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- UnionPathIterator.java 2000/10/30 18:58:57 1.5
+++ UnionPathIterator.java 2000/11/02 22:42:59 1.6
@@ -412,6 +412,7 @@
// super.reset();
m_foundLast = false;
+ m_next = 0;
int n = m_iterators.length;