3232/** This class implements the traversers for DTMDefaultBase. */
3333public abstract class DTMDefaultBaseIterators extends DTMDefaultBaseTraversers {
3434
35+ /**
36+ * Current iteration location. Usually this is the last location returned (starting point for
37+ * the next() search); for single-node iterators it may instead be initialized to point to that
38+ * single node.
39+ */
40+ protected int _currentNode ;
41+
3542 /**
3643 * Construct a DTMDefaultBaseTraversers object from a DOM node.
3744 *
@@ -100,33 +107,8 @@ public DTMAxisIterator getAxisIterator(final int axis) {
100107 return iterator ;
101108 }
102109
103- /**
104- * Abstract superclass defining behaviors shared by all DTMDefault's internal implementations of
105- * DTMAxisIterator. Subclass this (and override, if necessary) to implement the specifics of an
106- * individual axis iterator.
107- *
108- * <p>Currently there isn't a lot here
109- */
110- public abstract static class InternalAxisIteratorBase extends DTMAxisIteratorBase {
111-
112- // %REVIEW% We could opt to share _nodeType and setNodeType() as
113- // well, and simply ignore them in iterators which don't use them.
114- // But Scott's worried about the overhead involved in cloning
115- // these, and wants them to have as few fields as possible. Note
116- // that we can't create a TypedInternalAxisIteratorBase because
117- // those are often based on the untyped versions and Java doesn't
118- // support multiple inheritance. <sigh/>
119-
120- /**
121- * Current iteration location. Usually this is the last location returned (starting point for
122- * the next() search); for single-node iterators it may instead be initialized to point to that
123- * single node.
124- */
125- protected int _currentNode ;
126- } // end of InternalAxisIteratorBase
127-
128110 /** Iterator that returns all immediate children of a given node */
129- public final class ChildrenIterator extends InternalAxisIteratorBase {
111+ public final class ChildrenIterator extends DTMAxisIteratorBase {
130112
131113 /** {@inheritDoc} */
132114 @ Override
@@ -160,7 +142,7 @@ public int next() {
160142 * Iterator that returns the parent of a given node. Note that this delivers only a single node;
161143 * if you want all the ancestors, see AncestorIterator.
162144 */
163- public final class ParentIterator extends InternalAxisIteratorBase {
145+ public final class ParentIterator extends DTMAxisIteratorBase {
164146
165147 /** {@inheritDoc} */
166148 @ Override
@@ -193,7 +175,7 @@ public int next() {
193175 /**
194176 * Iterator that returns the namespace nodes as defined by the XPath data model for a given node.
195177 */
196- public class NamespaceIterator extends InternalAxisIteratorBase {
178+ public class NamespaceIterator extends DTMAxisIteratorBase {
197179
198180 /** Constructor NamespaceAttributeIterator */
199181 public NamespaceIterator () {
@@ -231,7 +213,7 @@ public int next() {
231213 } // end of NamespaceIterator
232214
233215 /** Iterator that returns the root node as defined by the XPath data model for a given node. */
234- public class RootIterator extends InternalAxisIteratorBase {
216+ public class RootIterator extends DTMAxisIteratorBase {
235217
236218 /** Constructor RootIterator */
237219 public RootIterator () {
@@ -265,7 +247,7 @@ public int next() {
265247 } // end of RootIterator
266248
267249 /** Iterator that returns all siblings of a given node. */
268- public class FollowingSiblingIterator extends InternalAxisIteratorBase {
250+ public class FollowingSiblingIterator extends DTMAxisIteratorBase {
269251
270252 /** {@inheritDoc} */
271253 @ Override
@@ -291,7 +273,7 @@ public int next() {
291273 } // end of FollowingSiblingIterator
292274
293275 /** Iterator that returns attribute nodes (of what nodes?) */
294- public final class AttributeIterator extends InternalAxisIteratorBase {
276+ public final class AttributeIterator extends DTMAxisIteratorBase {
295277
296278 // assumes caller will pass element nodes
297279
@@ -326,7 +308,7 @@ public int next() {
326308 } // end of AttributeIterator
327309
328310 /** Iterator that returns preceding siblings of a given node */
329- public class PrecedingSiblingIterator extends InternalAxisIteratorBase {
311+ public class PrecedingSiblingIterator extends DTMAxisIteratorBase {
330312
331313 /** The node identity of _startNode for this iterator */
332314 protected int _startNodeID ;
@@ -391,7 +373,7 @@ public int next() {
391373 * Iterator that returns preceding nodes of a given node. This includes the node set {root+1,
392374 * start-1}, but excludes all ancestors, attributes, and namespace nodes.
393375 */
394- public class PrecedingIterator extends InternalAxisIteratorBase {
376+ public class PrecedingIterator extends DTMAxisIteratorBase {
395377
396378 /** The max ancestors, but it can grow... */
397379 private final int _maxAncestors = 8 ;
@@ -504,7 +486,7 @@ public void reset() {
504486 } // end of PrecedingIterator
505487
506488 /** Iterator that returns following nodes of for a given node. */
507- public class FollowingIterator extends InternalAxisIteratorBase {
489+ public class FollowingIterator extends DTMAxisIteratorBase {
508490 final DTMAxisTraverser m_traverser ; // easier for now
509491
510492 public FollowingIterator () {
@@ -543,7 +525,7 @@ public int next() {
543525 * Iterator that returns the ancestors of a given node in document order. (NOTE! This was changed
544526 * from the XSLTC code!)
545527 */
546- public class AncestorIterator extends InternalAxisIteratorBase {
528+ public class AncestorIterator extends DTMAxisIteratorBase {
547529 final ArrayList <Integer > m_ancestors = new ArrayList <>();
548530
549531 int m_ancestorsPos ;
@@ -631,7 +613,7 @@ public int next() {
631613 } // end of AncestorIterator
632614
633615 /** Iterator that returns the descendants of a given node. */
634- public class DescendantIterator extends InternalAxisIteratorBase {
616+ public class DescendantIterator extends DTMAxisIteratorBase {
635617
636618 /** {@inheritDoc} */
637619 @ Override
@@ -714,7 +696,7 @@ public void reset() {
714696 } // end of DescendantIterator
715697
716698 /** Class SingletonIterator. */
717- public class SingletonIterator extends InternalAxisIteratorBase {
699+ public class SingletonIterator extends DTMAxisIteratorBase {
718700
719701 /** (not sure yet what this is. -sb) (sc & sb remove final to compile in JDK 1.1.8) */
720702 private final boolean _isConstant ;
0 commit comments