org.gicentre.treemappa
Class TreeMapBreadthFirstIterator

java.lang.Object
  extended by org.gicentre.treemappa.TreeMapBreadthFirstIterator
All Implemented Interfaces:
java.util.Iterator<TreeMapNode>

public class TreeMapBreadthFirstIterator
extends java.lang.Object
implements java.util.Iterator<TreeMapNode>

Iterates over part of a tree map hierarchy using a breadth-first traversal.

Version:
3.0, 23rd February 2011.
Author:
Jo Wood, giCentre.

Constructor Summary
TreeMapBreadthFirstIterator(TreeMapNode startNode)
          Initialises the iterator with the tree map node at the start of the traversal.
 
Method Summary
 boolean hasNext()
          Reports whether or not there are any more elements in the tree that have yet to be iterated over.
 TreeMapNode next()
          Provides the next tree map node in the breadth-first traversal of the hierarchy or throws a NoSuchElementException if there are no more nodes to iterate over.
 void remove()
          Would remove the last returned node from the hierarchy, but does nothing in this case.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TreeMapBreadthFirstIterator

public TreeMapBreadthFirstIterator(TreeMapNode startNode)
Initialises the iterator with the tree map node at the start of the traversal. The first item to be returned by this iterator will be the first child of the node provided to this constructor (assuming hasNext is true).

Parameters:
startNode - Parent node from which to iterate over the tree.
Method Detail

hasNext

public boolean hasNext()
Reports whether or not there are any more elements in the tree that have yet to be iterated over.

Specified by:
hasNext in interface java.util.Iterator<TreeMapNode>
Returns:
True if there are more elements to iterate over.

next

public TreeMapNode next()
Provides the next tree map node in the breadth-first traversal of the hierarchy or throws a NoSuchElementException if there are no more nodes to iterate over.

Specified by:
next in interface java.util.Iterator<TreeMapNode>
Returns:
Provides the next tree map node in the breadth-first traversal.

remove

public void remove()
Would remove the last returned node from the hierarchy, but does nothing in this case.

Specified by:
remove in interface java.util.Iterator<TreeMapNode>


treeMappa V.3.0.1, API documentation generated 4th April, 2011