Class CountingWalker
Object
CountingWalker
- All Implemented Interfaces:
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidfinish()Does nothing.intgetCount()Returns the value of the visitation counter.intvisit(Graphable element, GraphTraversal traversal) Sets the count of the component and increments the counter.
-
Constructor Details
-
CountingWalker
public CountingWalker()
-
-
Method Details
-
visit
Sets the count of the component and increments the counter.- Specified by:
visitin interfaceGraphWalker- 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:
finishin interfaceGraphWalker- See Also:
-
getCount
public int getCount()Returns the value of the visitation counter.- Returns:
- int Value of the counter.
-