salvo.jesus.graph
Class CycleCheckVisitor

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

 class CycleCheckVisitor
extends NullVisitor
implements java.io.Serializable

This is a non-public class the extends salvo.jesus.graph.Vistor to check if there is a cycle from a Vertex back to itself.

Author:
Jesus M. Salvo Jr.
See Also:
Visitor

Field Summary
(package private)  Vertex objectToCheck
          Vertex to check for a cycle path
 
Constructor Summary
CycleCheckVisitor(Vertex objectToCheck)
          Creates a new instance of CheckCycleVisitor and specifies which Vertex to be checked for a cycle path
 
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 a cycle path

Constructor Detail

CycleCheckVisitor

CycleCheckVisitor(Vertex objectToCheck)
Creates a new instance of CheckCycleVisitor and specifies which Vertex to be checked for a cycle path

Parameters:
objectToCheck - Vertex to be checked for a cycle path
Method Detail

visit

public boolean visit(Vertex objectToVisit)
Override of superclass' visit() method. Compares the Vertex being visited to the Vertex we are checking for a cycle path. If they are the same, a cycle has been reached and false is returned. Otherwise, true is returned

Specified by:
visit in interface Visitor
Overrides:
visit in class NullVisitor
Parameters:
objectToVisit - Vertex being visited. This is compared to the Vertex we are trying to check for a cycle path.
Returns:
false if the Vertex being visited is the same as the Vertex we are trying to check for a cycle path. True otherwise.