Class DescendantIterator
java.lang.Object
DescendantIterator
- All Implemented Interfaces:
- java.util.Iterator
class DescendantIterator
- extends java.lang.Object
- implements java.util.Iterator
Traverse all a parent's descendants (all children at any level below the parent).
Method Summary |
---|
boolean | hasNext() Returns true> if the iteration has more Content descendants. |
java.lang.Object | next() Returns the next Content descendant. |
private java.util.Iterator | pop() |
private void | push(java.util.Iterator itr) |
void | remove() Detaches the last Content returned by the last call to next from it's parent. |
private boolean | stackHasAnyNext() |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
iterator
private java.util.Iterator iterator
nextIterator
private java.util.Iterator nextIterator
stack
private java.util.List stack
CVS_ID
private static final java.lang.String CVS_ID
- See Also:
- Constant Field Values
DescendantIterator
DescendantIterator(Parent parent)
- Iterator for the descendants of the supplied object.
- Parameters:
parent
- document or element whose descendants will be iterated
hasNext
public boolean hasNext()
- Returns true> if the iteration has more
Content
descendants. - Specified by:
hasNext
in interface java.util.Iterator
- Returns:
- true is the iterator has more descendants
next
public java.lang.Object next()
- Returns the next
Content
descendant. - Specified by:
next
in interface java.util.Iterator
- Returns:
- the next descendant
remove
public void remove()
- Detaches the last
Content
returned by the last call to next from it's parent. Note: this does not affect iteration and all children, siblings, and any node following the removed node (in document order) will be visited. - Specified by:
remove
in interface java.util.Iterator
pop
private java.util.Iterator pop()
push
private void push(java.util.Iterator itr)
stackHasAnyNext
private boolean stackHasAnyNext()