Top Description Fields Constructors Methods
org.jdom2

pack-priv final Class DescendantIterator

extends Object
implements IteratorIterable<Content>
Class Inheritance
All Implemented Interfaces
org.jdom2.util.IteratorIterable, java.util.Iterator, java.lang.Iterable
Imports
java.util.*, org.jdom2.Content, .Parent, org.jdom2.internal.ArrayCopy, org.jdom2.util.IteratorIterable

Traverse all a parent's descendants (all children at any level below the parent - excludes the parent itself).
Authors
Bradley S. Huffman, Jason Hunter, Rolf Lear

Field Summary

Modifier and TypeField and Description
private Iterator<Content>
ascending

The iterator going up the tree, null unless next() returned dead-end

private Iterator<Content>
current

The iterator that supplied to most recent next()

private Iterator<Content>
descending

The iterator going down the tree, null unless next() returned Parent

private boolean
hasnext

what it says...

private final Parent
parent

Needed to be Iterable!

private int
private Object[]

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 DescendantIterator
iterator()

Implements java.lang.Iterable.iterator.

Returns an iterator over elements of type T.
public Content

Returns:

the next descendant
next
()

Implements java.util.Iterator.next.

Returns the next Content descendant.
public void
remove()

Overrides default java.util.Iterator.remove.

Detaches the last org.jdom2.Content returned by the last call to next from its parent

Note

this does not affect iteration and all children, siblings, and any node following the removed node (in document order) will be visited.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ascendingback to summary
private Iterator<Content> ascending

The iterator going up the tree, null unless next() returned dead-end

currentback to summary
private Iterator<Content> current

The iterator that supplied to most recent next()

descendingback to summary
private Iterator<Content> descending

The iterator going down the tree, null unless next() returned Parent

hasnextback to summary
private boolean hasnext

what it says...

parentback to summary
private final Parent parent

Needed to be Iterable!

ssizeback to summary
private int ssize
stackback to summary
private Object[] 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

Annotations
@Override
iteratorback to summary
public DescendantIterator iterator()

Implements java.lang.Iterable.iterator.

Doc from java.lang.Iterable.iterator.

Returns an iterator over elements of type T.

Returns:DescendantIterator

an Iterator.

Annotations
@Override
nextback to summary
public Content next()

Implements java.util.Iterator.next.

Returns the next Content descendant.

Returns:Content

the next descendant

Annotations
@Override
removeback to summary
public void remove()

Overrides default java.util.Iterator.remove.

Detaches the last org.jdom2.Content returned by the last call to next from its parent

Note

this does not affect iteration and all children, siblings, and any node following the removed node (in document order) will be visited.

Annotations
@Override