public class BreadthFirstPathIterator extends Object implements Iterator<DependencyPath>
Modifier and Type | Field and Description |
---|---|
protected Queue<SimpleDependencyPath> |
frontier
The paths that have been expanded from the starting node but have not yet
been returned.
|
Constructor and Description |
---|
BreadthFirstPathIterator(DependencyTreeNode startNode)
Creates a new iterator over all the paths starting at the provided index.
|
BreadthFirstPathIterator(DependencyTreeNode startNode,
int maxPathLength)
Creates a new iterator over all the paths starting at the provided index
that will only return paths up to the specified maximum length.
|
Modifier and Type | Method and Description |
---|---|
boolean |
hasNext()
Returns
true if there are still paths to return for the tree. |
DependencyPath |
next()
Returns the next
DependencyPath in the tree whose length is equal
or greater than the previously returned path. |
void |
remove()
Throws an
UnsupportedOperationException if called |
protected final Queue<SimpleDependencyPath> frontier
public BreadthFirstPathIterator(DependencyTreeNode startNode)
startNode
- the node that will start all the paths to be generated.public BreadthFirstPathIterator(DependencyTreeNode startNode, int maxPathLength)
startNode
- the node that will start all the paths to be generated.maxPathLength
- the maximum path length to returnIllegalArgumentException
- if is < 1.public boolean hasNext()
true
if there are still paths to return for the tree.hasNext
in interface Iterator<DependencyPath>
public DependencyPath next()
DependencyPath
in the tree whose length is equal
or greater than the previously returned path.next
in interface Iterator<DependencyPath>
public void remove()
UnsupportedOperationException
if calledremove
in interface Iterator<DependencyPath>
Copyright © 2012. All Rights Reserved.