public class FilteredDependencyIterator extends Object implements Iterator<DependencyPath>
Relations.
Given the tree and a starting index, the traverser will find all paths that
satisfy several different criteria: length of the path and accepted relations
in the path.
Note that this class is NOT thread safe.| Constructor and Description |
|---|
FilteredDependencyIterator(DependencyTreeNode startNode,
DependencyPathAcceptor acceptor)
Creates a new
DependencyIterator that will return all DependencyPath instances rooted at startNode that are validated
by the provided acceptor. |
FilteredDependencyIterator(DependencyTreeNode startNode,
DependencyPathAcceptor acceptor,
int maxPathLength)
Creates a new
DependencyIterator that will return all DependencyPath instances rooted at startNode that are validated
by the provided acceptor and whose length are under the maximum length |
| Modifier and Type | Method and Description |
|---|---|
boolean |
hasNext()
Returns
true if there are more paths to return that meet the
acceptor and path length requirements. |
DependencyPath |
next()
Returns the next path that meets the requirements.
|
void |
remove()
Throws
UnsupportedOperationException if called. |
public FilteredDependencyIterator(DependencyTreeNode startNode, DependencyPathAcceptor acceptor)
DependencyIterator that will return all DependencyPath instances rooted at startNode that are validated
by the provided acceptor.startNode - the node that will start all the paths to be generated.acceptor - The DependencyPathAcceptor that will validate
each link the a pathIllegalArgumentException - if maxPathLength is less than 1public FilteredDependencyIterator(DependencyTreeNode startNode, DependencyPathAcceptor acceptor, int maxPathLength)
DependencyIterator that will return all DependencyPath instances rooted at startNode that are validated
by the provided acceptor and whose length are under the maximum lengthstartNode - the node that will start all the paths to be generated.acceptor - The DependencyPathAcceptor that will validate
the paths returned by this iteratormaxPathLength - the maximum number of relations in any pathIllegalArgumentException - if maxPathLength is less than 1public boolean hasNext()
true if there are more paths to return that meet the
acceptor and path length requirements.hasNext in interface Iterator<DependencyPath>public DependencyPath next()
next in interface Iterator<DependencyPath>NoSuchElementException - if called when no further paths existpublic void remove()
UnsupportedOperationException if called.remove in interface Iterator<DependencyPath>Copyright © 2012. All Rights Reserved.