Class ReverseDescendantIterator
- java.lang.Object
-
- com.puppycrawl.tools.checkstyle.xpath.iterators.ReverseDescendantIterator
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,net.sf.saxon.om.SequenceIterator,net.sf.saxon.tree.iter.AxisIterator,net.sf.saxon.tree.iter.UnfailingIterator
public class ReverseDescendantIterator extends java.lang.Object implements net.sf.saxon.tree.iter.AxisIterator
Recursive-free implementation of the descendant axis iterator. Difference between this iterator andDescendantIteratorin traversal order of the child nodes. In some cases it is useful to iterate from last child backwards to the first one, for example inPrecedingIterator.
-
-
Constructor Summary
Constructors Constructor Description ReverseDescendantIterator(net.sf.saxon.om.NodeInfo start)Create an iterator over the "descendant" axis in reverse order.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description net.sf.saxon.om.NodeInfonext()Get the next item in the sequence.private voidpushToStack(net.sf.saxon.tree.iter.AxisIterator iterateAxis)Pushes all children to the stack.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
-
-
Constructor Detail
-
ReverseDescendantIterator
public ReverseDescendantIterator(net.sf.saxon.om.NodeInfo start)
Create an iterator over the "descendant" axis in reverse order.- Parameters:
start- the initial context node.
-
-
Method Detail
-
pushToStack
private void pushToStack(net.sf.saxon.tree.iter.AxisIterator iterateAxis)
Pushes all children to the stack.- Parameters:
iterateAxis-AxisInfo.CHILDaxis iterator.
-
next
public net.sf.saxon.om.NodeInfo next()
Get the next item in the sequence.- Specified by:
nextin interfacenet.sf.saxon.tree.iter.AxisIterator- Specified by:
nextin interfacenet.sf.saxon.om.SequenceIterator- Specified by:
nextin interfacenet.sf.saxon.tree.iter.UnfailingIterator- Returns:
- the next Item. If there are no more nodes, return null.
-
-