You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by mm...@apache.org on 2002/05/16 00:04:03 UTC
cvs commit: xml-xalan/java/src/org/apache/xml/dtm/ref DTMDefaultBaseTraversers.java
mmidy 02/05/15 15:04:02
Modified: java/src/org/apache/xml/dtm/ref
DTMDefaultBaseTraversers.java
Log:
Bugzilla 8894: DescendantForRoot traversers needed to implement their own version of first(int, int) so that their context would be from the root.
Revision Changes Path
1.10 +57 -0 xml-xalan/java/src/org/apache/xml/dtm/ref/DTMDefaultBaseTraversers.java
Index: DTMDefaultBaseTraversers.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/dtm/ref/DTMDefaultBaseTraversers.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- DTMDefaultBaseTraversers.java 10 Apr 2002 20:33:16 -0000 1.9
+++ DTMDefaultBaseTraversers.java 15 May 2002 22:04:02 -0000 1.10
@@ -1633,6 +1633,34 @@
{
return getDocument();
}
+
+ /**
+ * By the nature of the stateless traversal, the context node can not be
+ * returned or the iteration will go into an infinate loop. So to traverse
+ * an axis, the first function must be used to get the first node.
+ *
+ * <p>This method needs to be overloaded only by those axis that process
+ * the self node. <\p>
+ *
+ * @param context The context node of this traversal. This is the point
+ * of origin for the traversal -- its "root node" or starting point.
+ * @param expandedTypeID The expanded type ID that must match.
+ *
+ * @return the first node in the traversal.
+ */
+ public int first(int context, int expandedTypeID)
+ {
+ if (isIndexed(expandedTypeID))
+ {
+ int identity = 0;
+ int firstPotential = getFirstPotential(identity);
+
+ return makeNodeHandle(getNextIndexed(identity, firstPotential, expandedTypeID));
+ }
+
+ int root = first(context);
+ return next(root, root, expandedTypeID);
+ }
}
/**
@@ -1676,6 +1704,35 @@
{
return makeNodeHandle(_firstch(0));
}
+
+ /**
+ * By the nature of the stateless traversal, the context node can not be
+ * returned or the iteration will go into an infinate loop. So to traverse
+ * an axis, the first function must be used to get the first node.
+ *
+ * <p>This method needs to be overloaded only by those axis that process
+ * the self node. <\p>
+ *
+ * @param context The context node of this traversal. This is the point
+ * of origin for the traversal -- its "root node" or starting point.
+ * @param expandedTypeID The expanded type ID that must match.
+ *
+ * @return the first node in the traversal.
+ */
+ public int first(int context, int expandedTypeID)
+ {
+ if (isIndexed(expandedTypeID))
+ {
+ int identity = 0;
+ int firstPotential = getFirstPotential(identity);
+
+ return makeNodeHandle(getNextIndexed(identity, firstPotential, expandedTypeID));
+ }
+
+ int root = getDocument();
+ return next(root, root, expandedTypeID);
+ }
+
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org