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:
Graphable.setCount(int)
-
-
Constructor Summary
Constructors Constructor Description CountingWalker()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
finish()
Does nothing.int
getCount()
Returns the value of the visitation counter.int
visit(Graphable element, GraphTraversal traversal)
Sets the count of the component and increments the counter.
-
-
-
Method Detail
-
visit
public int visit(Graphable element, GraphTraversal traversal)
Sets the count of the component and increments the counter.- Specified by:
visit
in 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:
Graphable.setCount(int)
,GraphWalker.visit(Graphable, GraphTraversal)
-
finish
public void finish()
Does nothing.- Specified by:
finish
in interfaceGraphWalker
- See Also:
GraphWalker.finish()
-
getCount
public int getCount()
Returns the value of the visitation counter.- Returns:
- int Value of the counter.
-
-