Package org.forester.phylogeny.iterators
Class LevelOrderTreeIterator
- java.lang.Object
-
- org.forester.phylogeny.iterators.LevelOrderTreeIterator
-
- All Implemented Interfaces:
java.util.Iterator<PhylogenyNode>
,PhylogenyNodeIterator
public class LevelOrderTreeIterator extends java.lang.Object implements PhylogenyNodeIterator
-
-
Constructor Summary
Constructors Constructor Description LevelOrderTreeIterator(Phylogeny phylogeny)
Creates a new LevelOrderTreeIterator for iterating over all the nodes of Phylogeny phylogenyLevelOrderTreeIterator(PhylogenyNode node)
Creates a new LevelOrderTreeIterator for iterating over all the child nodes of PhylogenyNode node (including node itself).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.
-
-
-
Constructor Detail
-
LevelOrderTreeIterator
public LevelOrderTreeIterator(Phylogeny phylogeny) throws java.lang.IllegalArgumentException
Creates a new LevelOrderTreeIterator for iterating over all the nodes of Phylogeny phylogeny- Parameters:
phylogeny
- the Phylogeny to iterate over- Throws:
java.lang.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 interfacejava.util.Iterator<PhylogenyNode>
- Specified by:
hasNext
in interfacePhylogenyNodeIterator
- Returns:
- true is this iterator has at least one more element, false otherwise
-
next
public PhylogenyNode next() throws java.util.NoSuchElementException
Returns the next PhylogenyNode.- Specified by:
next
in interfacejava.util.Iterator<PhylogenyNode>
- Specified by:
next
in interfacePhylogenyNodeIterator
- Returns:
- the next PhylogenyNode
- Throws:
java.util.NoSuchElementException
- if iteration is complete
-
remove
public void remove()
Not supported.- Specified by:
remove
in interfacejava.util.Iterator<PhylogenyNode>
-
reset
public void reset()
Resets the iterator.- Specified by:
reset
in interfacePhylogenyNodeIterator
-
-