public class DependencyIterator 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.| 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 |
|---|
DependencyIterator(DependencyTreeNode startNode,
DependencyRelationAcceptor acceptor,
int maxPathLength)
Creates a new
DependencyIterator that will return all DependencyPaths rooted at the term with index startTerm. |
| 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 DependencyIterator(DependencyTreeNode startNode, DependencyRelationAcceptor acceptor, int maxPathLength)
DependencyIterator that will return all DependencyPaths rooted at the term with index startTerm. Each
link in the path will be valied with acceptor and weighted with
weighter. Each path will have length 1 + maxPathLength.startNode - the node that will start all the paths to be generated.acceptor - The DependencyRelationAcceptor that will validate
each link the a pathmaxPathLength - the maximum length of any path returnedIllegalArgumentException - if maxPathLength is less than 1public 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.