salvo.jesus.graph
Class StopAtVisitor

java.lang.Object
  extended by salvo.jesus.graph.NullVisitor
      extended by salvo.jesus.graph.StopAtVisitor
All Implemented Interfaces:
java.io.Serializable, Visitor

 class StopAtVisitor
extends NullVisitor

A Visitor that notifies a traversal to stop at a particular Vertex.

Author:
Jesus M. Salvo Jr. $Id: StopAtVisitor.html,v 1.1 2008/10/30 14:32:20 ftaiani_normal Exp $

Field Summary
(package private)  Vertex objectToCheck
          Vertex to check for when visiting a vertex
 
Constructor Summary
StopAtVisitor(Vertex objectToCheck)
          Creates a new instance of StopAtVisitor and specifies which Vertex stop
 
Method Summary
 boolean visit(Vertex objectToVisit)
          Override of superclass' visit() method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

objectToCheck

Vertex objectToCheck
Vertex to check for when visiting a vertex

Constructor Detail

StopAtVisitor

StopAtVisitor(Vertex objectToCheck)
Creates a new instance of StopAtVisitor and specifies which Vertex stop

Parameters:
objectToCheck - stop at the specified vertex
Method Detail

visit

public boolean visit(Vertex objectToVisit)
Override of superclass' visit() method. Compares the Vertex being visited to the Vertex specified in the constructor. If they are the same, return false. Otherwise, return true.

Specified by:
visit in interface Visitor
Overrides:
visit in class NullVisitor
Parameters:
objectToVisit - Vertex being visited.
Returns:
false if the Vertex being visited is the same as the Vertex specified in the constructor. True otherwise.