Package org.forester.phylogeny.iterators
Class LevelOrderTreeIterator
java.lang.Object
org.forester.phylogeny.iterators.LevelOrderTreeIterator
- All Implemented Interfaces:
Iterator<PhylogenyNode>
,PhylogenyNodeIterator
-
Constructor Summary
ConstructorDescriptionLevelOrderTreeIterator
(Phylogeny phylogeny) Creates a new LevelOrderTreeIterator for iterating over all the nodes of Phylogeny phylogenyCreates a new LevelOrderTreeIterator for iterating over all the child nodes of PhylogenyNode node (including node itself). -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
LevelOrderTreeIterator
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
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 Details
-
hasNext
public boolean hasNext()Returns true is this iterator has at least one more element, false otherwise.- Specified by:
hasNext
in interfaceIterator<PhylogenyNode>
- Specified by:
hasNext
in interfacePhylogenyNodeIterator
- Returns:
- true is this iterator has at least one more element, false otherwise
-
next
Returns the next PhylogenyNode.- Specified by:
next
in interfaceIterator<PhylogenyNode>
- Specified by:
next
in interfacePhylogenyNodeIterator
- Returns:
- the next PhylogenyNode
- Throws:
NoSuchElementException
- if iteration is complete
-
remove
public void remove()Not supported.- Specified by:
remove
in interfaceIterator<PhylogenyNode>
-
reset
public void reset()Resets the iterator.- Specified by:
reset
in interfacePhylogenyNodeIterator
-