Top Description Fields Constructors Methods
org.jdom

pack-priv Class DescendantIterator

extends Object
implements Iterator
Class Inheritance
All Implemented Interfaces
java.util.Iterator
Imports
java.util.*, org.jdom.Content, .Element, .Parent

Traverse all a parent's descendants (all children at any level below the parent).
Authors
Bradley S. Huffman, Jason Hunter
Version
$Revision: 1.6 $, $Date: 2007/11/10 05:28:58 $

Field Summary

Modifier and TypeField and Description
private static final String
private Iterator<E>
private Iterator<E>
private List<E>

Constructor Summary

AccessConstructor and Description
pack-priv
DescendantIterator(Parent
document or element whose descendants will be iterated
parent
)

Iterator for the descendants of the supplied object.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true is the iterator has more descendants
hasNext
()

Implements java.util.Iterator.hasNext.

Returns true> if the iteration has more Content descendants.
public Object

Returns:

the next descendant
next
()

Implements java.util.Iterator.next.

Returns the next Content descendant.
private Iterator<E>
pop()

private void
push(Iterator<E> itr)

public void
remove()

Overrides default java.util.Iterator.remove.

Detaches the last org.jdom.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.

private boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CVS_IDback to summary
private static final String CVS_ID
iteratorback to summary
private Iterator<E> iterator
nextIteratorback to summary
private Iterator<E> nextIterator
stackback to summary
private List<E> stack

Constructor Detail

DescendantIteratorback to summary
pack-priv DescendantIterator(Parent parent)

Iterator for the descendants of the supplied object.

Parameters
parent:Parent

document or element whose descendants will be iterated

Method Detail

hasNextback to summary
public boolean hasNext()

Implements java.util.Iterator.hasNext.

Returns true> if the iteration has more Content descendants.

Returns:boolean

true is the iterator has more descendants

nextback to summary
public Object next()

Implements java.util.Iterator.next.

Returns the next Content descendant.

Returns:Object

the next descendant

popback to summary
private Iterator<E> pop()
pushback to summary
private void push(Iterator<E> itr)
removeback to summary
public void remove()

Overrides default java.util.Iterator.remove.

Detaches the last org.jdom.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.

stackHasAnyNextback to summary
private boolean stackHasAnyNext()