public class BreadthFirstIterator
extends java.lang.Object
implements java.util.Iterator
| Modifier and Type | Field and Description |
|---|---|
protected int |
m_depth |
protected boolean |
m_includeEdges |
protected boolean |
m_includeNodes |
protected Queue |
m_queue |
protected int |
m_traversal |
| Constructor and Description |
|---|
BreadthFirstIterator()
Create an uninitialized BreadthFirstIterator.
|
BreadthFirstIterator(java.util.Iterator it,
int depth,
int traversal)
Create a new BreadthFirstIterator starting from the given source nodes.
|
BreadthFirstIterator(Node n,
int depth,
int traversal)
Create a new BreadthFirstIterator starting from the given source node.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getDepth(Tuple t)
Get the traversal depth at which a particular tuple was encountered.
|
protected java.util.Iterator |
getEdges(Node n)
Determines which edges are traversed for a given node.
|
boolean |
hasNext() |
void |
init(java.lang.Object o,
int depth,
int traversal)
Initialize (or re-initialize) this iterator.
|
java.lang.Object |
next() |
void |
remove() |
protected Queue m_queue
protected int m_depth
protected int m_traversal
protected boolean m_includeNodes
protected boolean m_includeEdges
public BreadthFirstIterator()
init(Object, int, int) method to initialize the iterator.public BreadthFirstIterator(Node n, int depth, int traversal)
n - the source node from which to begin the traversaldepth - the maximum graph distance to traversetraversal - the traversal type, one of
Constants.NODE_TRAVERSAL,
Constants.EDGE_TRAVERSAL, or
Constants.NODE_AND_EDGE_TRAVERSALpublic BreadthFirstIterator(java.util.Iterator it,
int depth,
int traversal)
it - an Iterator over the source nodes from which to begin the
traversaldepth - the maximum graph distance to traversetraversal - the traversal type, one of
Constants.NODE_TRAVERSAL,
Constants.EDGE_TRAVERSAL, or
Constants.NODE_AND_EDGE_TRAVERSALpublic void init(java.lang.Object o,
int depth,
int traversal)
o - Either a source node or iterator over source nodesdepth - the maximum graph distance to traversetraversal - the traversal type, one of
Constants.NODE_TRAVERSAL,
Constants.EDGE_TRAVERSAL, or
Constants.NODE_AND_EDGE_TRAVERSALpublic void remove()
remove in interface java.util.IteratorIterator.remove()public boolean hasNext()
hasNext in interface java.util.IteratorIterator.hasNext()protected java.util.Iterator getEdges(Node n)
n - a nodepublic int getDepth(Tuple t)
t - the tuple to lookuppublic java.lang.Object next()
next in interface java.util.IteratorIterator.next()