java.lang.Object
com.phoenixst.plexus.DefaultGraph.TraverserImpl
- All Implemented Interfaces:
- java.util.Iterator, Traverser
- Enclosing class:
- DefaultGraph
- private class DefaultGraph.TraverserImpl
- extends java.lang.Object
- implements Traverser
Support implementation class used by both directed and
undirected standard traverser methods.
|
Method Summary |
Graph.Edge |
getEdge()
Returns the Edge which was traversed to get to
the last node returned by next() 55 . |
java.lang.Object |
getOtherEndpoint()
Returns the node at the other end of the edge which was
traversed to get to the last node returned by next() 55 . |
boolean |
hasNext()
Tests whether there are elements remaining in the collection. |
java.lang.Object |
next()
Obtain the next element in the collection. |
void |
remove()
Remove from the underlying collection the last element returned by next
(optional operation). |
void |
removeEdge()
Removes from the underlying Graph the
Edge that would be returned by getEdge() 55
(optional operation). |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
cursor
private DefaultGraph.AdjacencyList.Cursor cursor
DefaultGraph.TraverserImpl
private DefaultGraph.TraverserImpl(DefaultGraph.AdjacencyList.Cursor cursor)
- Creates a new
TraverserImpl over the
specified edges adjacent to the specified node, which is
expected to be the actual (using ==) node
object used by this Graph.
hasNext
public boolean hasNext()
- Description copied from interface:
java.util.Iterator
- Tests whether there are elements remaining in the collection. In other
words, calling
next() will not throw an exception.
- Specified by:
hasNext in interface java.util.Iterator
next
public java.lang.Object next()
- Description copied from interface:
java.util.Iterator
- Obtain the next element in the collection.
- Specified by:
next in interface java.util.Iterator
remove
public void remove()
- Description copied from interface:
java.util.Iterator
- Remove from the underlying collection the last element returned by next
(optional operation). This method can be called only once after each
call to
next(). It does not affect what will be returned
by subsequent calls to next.
- Specified by:
remove in interface java.util.Iterator
getEdge
public Graph.Edge getEdge()
- Description copied from interface:
Traverser
- Returns the
Edge which was traversed to get to
the last node returned by Iterator.next()>Iterator.next() 55 . If no edge was
traversed (as in the root of a breadth first search), this
method throws a NoSuchElementException. This
call can be made only if Iterator.remove()>Iterator.remove() 55 or Traverser.removeEdge() 55 has not been called after the last call to Iterator.next()>Iterator.next() 55 .
- Specified by:
getEdge in interface Traverser
removeEdge
public void removeEdge()
- Description copied from interface:
Traverser
- Removes from the underlying Graph the
Edge that would be returned by Traverser.getEdge() 55
(optional operation). If no edge was traversed (as in the
root of a breadth first search), this method throws a
NoSuchElementException. This method can be
called only once per call to Iterator.next()>Iterator.next() 55 . The behavior of a
traverser is unspecified if the underlying graph structure is
modified while the traversal is in progress in any way other
than by calling this method or Iterator.remove()>Iterator.remove() 55 .
- Specified by:
removeEdge in interface Traverser
getOtherEndpoint
public java.lang.Object getOtherEndpoint()
- Description copied from interface:
Traverser
- Returns the node at the other end of the edge which was
traversed to get to the last node returned by Iterator.next()>
Iterator.next() 55 .
If no edge was traversed (as in the root of a breadth first
search), this method throws a
NoSuchElementException. This call can be made
only if Iterator.remove()>Iterator.remove() 55 or Traverser.removeEdge() 55 has not been
called after the last call to Iterator.next()>Iterator.next() 55 .
- Specified by:
getOtherEndpoint in interface Traverser