org.forester.phylogeny.iterators
Class LevelOrderTreeIterator

java.lang.Object
  extended by org.forester.phylogeny.iterators.LevelOrderTreeIterator
All Implemented Interfaces:
Iterator<PhylogenyNode>, PhylogenyNodeIterator

public class LevelOrderTreeIterator
extends Object
implements PhylogenyNodeIterator


Constructor Summary
LevelOrderTreeIterator(Phylogeny phylogeny)
          Creates a new LevelOrderTreeIterator for iterating over all the nodes of Phylogeny phylogeny
LevelOrderTreeIterator(PhylogenyNode node)
          Creates a new LevelOrderTreeIterator for iterating over all the child nodes of PhylogenyNode node (including node itself).
 
Method Summary
 boolean hasNext()
          Returns true is this iterator has at least one more element, false otherwise.
 PhylogenyNode next()
          Returns the next PhylogenyNode.
 void remove()
          Not supported.
 void reset()
          Resets the iterator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LevelOrderTreeIterator

public LevelOrderTreeIterator(Phylogeny phylogeny)
                       throws IllegalArgumentException
Creates a new LevelOrderTreeIterator for iterating over all the nodes of Phylogeny phylogeny

Parameters:
phylogeny - the Phylogeny to iterate over
Throws:
IllegalArgumentException - if phylogeny is empty

LevelOrderTreeIterator

public LevelOrderTreeIterator(PhylogenyNode node)
Creates a new LevelOrderTreeIterator for iterating over all the child nodes of PhylogenyNode node (including node itself).

Parameters:
node - the parent of the nodes to iterate over
Method Detail

hasNext

public boolean hasNext()
Returns true is this iterator has at least one more element, false otherwise.

Specified by:
hasNext in interface Iterator<PhylogenyNode>
Specified by:
hasNext in interface PhylogenyNodeIterator
Returns:
true is this iterator has at least one more element, false otherwise

next

public PhylogenyNode next()
                   throws NoSuchElementException
Returns the next PhylogenyNode.

Specified by:
next in interface Iterator<PhylogenyNode>
Specified by:
next in interface PhylogenyNodeIterator
Returns:
the next PhylogenyNode
Throws:
NoSuchElementException - if iteration is complete

remove

public void remove()
Not supported.

Specified by:
remove in interface Iterator<PhylogenyNode>

reset

public void reset()
Resets the iterator.

Specified by:
reset in interface PhylogenyNodeIterator