Source of 30.14.java


  1: // @author Frank M. Carrano, Timothy M. Henry
  2: // @version 5.0
  3: public boolean hasNeighbor()
  4: {
  5:    return !edgeList.isEmpty();
  6: } // end hasNeighbor

  8: public VertexInterface<T> getUnvisitedNeighbor()
  9: {
 10:    VertexInterface<T> result = null;

 12:    Iterator<VertexInterface<T>> neighbors = getNeighborIterator();
 13:    while ( neighbors.hasNext() && (result == null) )
 14:    {
 15:       VertexInterface<T> nextNeighbor = neighbors.next();
 16:       if (!nextNeighbor.isVisited())
 17:          result = nextNeighbor;
 18:    } // end while

 20:    return result;
 21: } // end getUnvisitedNeighbor