org.geotools.graph.traverse.basic
Class CountingWalker

java.lang.Object
  extended byorg.geotools.graph.traverse.basic.CountingWalker
All Implemented Interfaces:
GraphWalker

public class CountingWalker
extends java.lang.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
CountingWalker()
           
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CountingWalker

public CountingWalker()
Method Detail

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:
Graphable.setCount(int), GraphWalker.visit(Graphable, GraphTraversal)

finish

public void finish()
Does nothing.

Specified by:
finish in interface GraphWalker
See Also:
GraphWalker.finish()

getCount

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

Returns:
int Value of the counter.


Copyright © GeoTools. All Rights Reserved.