Class CountingWalker

Object
CountingWalker
All Implemented Interfaces:
GraphWalker

public class CountingWalker extends Object implements GraphWalker
An implementation of GraphWalker that counts the number of components visited. As each component is visited, the walker sets the count of the component to the value of its counter.
Author:
Justin Deoliveira, Refractions Research Inc, jdeolive@refractions.net
See Also:
  • Constructor Details

    • CountingWalker

      public CountingWalker()
  • Method Details

    • visit

      public int visit(Graphable element, GraphTraversal traversal)
      Sets the count of the component and increments the counter.
      Specified by:
      visit in interface GraphWalker
      Parameters:
      element - The component being visited.
      traversal - The traversal controlling the sequence of graph component visits.
      Returns:
      GraphTraversal#CONTINUE to signal that the traversal should continue.
      GraphTraversal#CONTINUE to signal that the traversal should suspend.
      GraphTraversal#KILL_BRANCH to signal that the traversal should kill its current branch.
      GraphTraversal#STOP to signal that the traversal should stop.
      See Also:
    • finish

      public void finish()
      Does nothing.
      Specified by:
      finish in interface GraphWalker
      See Also:
    • getCount

      public int getCount()
      Returns the value of the visitation counter.
      Returns:
      int Value of the counter.