Joda System API

org.joda.util
Class ArrayTreeNode.DepthFirstTreeIterator

java.lang.Object
  |
  +--org.joda.util.ArrayTreeNode.DepthFirstTreeIterator
All Implemented Interfaces:
java.util.Iterator, TreeIterator
Enclosing class:
ArrayTreeNode

public static class ArrayTreeNode.DepthFirstTreeIterator
extends java.lang.Object
implements TreeIterator

Implementation of TreeIterator that navigates through the nodes in a depth first order. The tree is traversed when the iterator is constructed, so concurrent modification is possible.


Nested Class Summary
protected static class ArrayTreeNode.DepthFirstTreeIterator.Entry
           
 
Constructor Summary
ArrayTreeNode.DepthFirstTreeIterator(TreeNode node)
          Constructor
 
Method Summary
protected  void addEntries(TreeNode node, java.util.List list)
          Recursive method to populate list
 TreeNode getParent()
          Get the parent of the last retrieved node
 boolean hasNext()
          Is there another node in the list
 java.lang.Object next()
          Get the next node
 TreeNode nextNode()
          Get the next node typecast
 void remove()
          Remove the last node
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayTreeNode.DepthFirstTreeIterator

public ArrayTreeNode.DepthFirstTreeIterator(TreeNode node)
Constructor

Method Detail

addEntries

protected void addEntries(TreeNode node,
                          java.util.List list)
Recursive method to populate list


hasNext

public boolean hasNext()
Is there another node in the list

Specified by:
hasNext in interface java.util.Iterator

next

public java.lang.Object next()
Get the next node

Specified by:
next in interface java.util.Iterator

remove

public void remove()
Remove the last node

Specified by:
remove in interface java.util.Iterator

nextNode

public TreeNode nextNode()
Get the next node typecast

Specified by:
nextNode in interface TreeIterator
Returns:
as per next() but typecast

getParent

public TreeNode getParent()
Get the parent of the last retrieved node

Specified by:
getParent in interface TreeIterator
Returns:
the object that is the parent of the last retrned node

Joda System API

Copyright © 2001-2003 Stephen Colebourne. All Rights Reserved.