

PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
java.lang.Object  +javaslam.tjt.graph.Traversal
An iterator that traverses the nodes of a graph.
Field Summary  
protected Node 
current
The most recently returned node, or null if next() has not yet been called. 
protected boolean 
cycle
If true , then this iterator has traversed a node
more than once. 
protected HashMap 
edges
A mapping from each node to the Edge used to arrive
at that node (most recently). 
Constructor Summary  
Traversal(Node n)
Constructor. 
Method Summary  
Node 
current()
Returns the current node without advancing the iterator. 
protected abstract Node 
dequeue()
Dequeues a node to visit. 
Edge 
edge()
Returns the edge traversed to arrive at the current node. 
protected abstract void 
enqueue(Node n)
Enqueues a node for later visit. 
abstract boolean 
hasNext()
Returns true if the iteration has more elements. 
boolean 
isCyclic()
Returns true if the traversal has visited a node
more than once, implying the existence of a cycle if the graph is
undirected. 
Node 
next()
Returns the next Node in the iteration. 
List 
path()
Returns a list of Edge s that were traversed in order
to reach the Node most recently returned by next() . 
int 
size()
Returns the number of nodes traversed thus far. 
Methods inherited from class java.lang.Object 
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
Field Detail 
protected boolean cycle
true
, then this iterator has traversed a node
more than once.
protected HashMap edges
Edge
used to arrive
at that node (most recently).
protected Node current
null
if next()
has not yet been called.
Constructor Detail 
public Traversal(Node n)
Node
parameter.
n
 the node from which to start the traversal; this will be
the first node returned by the iteratorMethod Detail 
public abstract boolean hasNext()
true
if the iteration has more elements.
(In other words, returns true if next would return an element
rather than throwing an exception.)
public boolean isCyclic()
true
if the traversal has visited a node
more than once, implying the existence of a cycle if the graph is
undirected.
public int size()
protected abstract void enqueue(Node n)
protected abstract Node dequeue()
public Node next()
Node
in the iteration.
public Node current()
null
if next()
has not yet been called.
public Edge edge()
null
if next()
has not yet been called more than once.
public List path() throws IllegalStateException
Edge
s that were traversed in order
to reach the Node most recently returned by next()
.
Edge
objects that were
traversed in order to reach the Node most recently
returned by next()
.
IllegalStateException
 if next()
has not
yet been called.


PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 