prefuse.data.util
Class TreeNodeIterator

java.lang.Object
  extended by prefuse.data.util.TreeNodeIterator
All Implemented Interfaces:
java.util.Iterator

public class TreeNodeIterator
extends java.lang.Object
implements java.util.Iterator

A depth-first iterator over the subtree rooted at given node.

Author:
jeffrey heer

Constructor Summary
TreeNodeIterator(Node root)
          Create a new TreeNodeIterator over the given subtree.
TreeNodeIterator(Node root, boolean preorder)
          Create a new TreeNodeIterator over the given subtree.
 
Method Summary
 boolean hasNext()
           
 java.lang.Object next()
           
 void remove()
          Throws an UnsupportedOperationException
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TreeNodeIterator

public TreeNodeIterator(Node root)
Create a new TreeNodeIterator over the given subtree.

Parameters:
root - the root of the subtree to traverse

TreeNodeIterator

public TreeNodeIterator(Node root,
                        boolean preorder)
Create a new TreeNodeIterator over the given subtree.

Parameters:
root - the root of the subtree to traverse
preorder - true to use a pre-order traversal, false for a post-order traversal
Method Detail

hasNext

public boolean hasNext()
Specified by:
hasNext in interface java.util.Iterator
See Also:
Iterator.hasNext()

next

public java.lang.Object next()
Specified by:
next in interface java.util.Iterator
See Also:
Iterator.next()

remove

public void remove()
Throws an UnsupportedOperationException

Specified by:
remove in interface java.util.Iterator
See Also:
Iterator.remove()


Copyright © 2007 Regents of the University of California