01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2002-2006, GeoTools Project Managment Committee (PMC)
05: * (C) 2002, Refractions Reserach Inc.
06: *
07: * This library is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU Lesser General Public
09: * License as published by the Free Software Foundation;
10: * version 2.1 of the License.
11: *
12: * This library is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * Lesser General Public License for more details.
16: */
17: package org.geotools.graph.traverse;
18:
19: import org.geotools.graph.structure.Graphable;
20:
21: /**
22: * Iterated over the components of a graph using a standard visitor
23: * pattern.
24: *
25: * @author Justin Deoliveira, Refractions Research Inc, jdeolive@refractions.net
26: *
27: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/extension/graph/src/main/java/org/geotools/graph/traverse/GraphWalker.java $
28: */
29: public interface GraphWalker {
30:
31: /**
32: * Visits a graph component.
33: *
34: * @param element The component being visited.
35: * @param traversal The traversal controlling the sequence of graph
36: * component visits.
37: *
38: * @return GraphTraversal#CONTINUE to signal that the traversal should
39: * continue.<BR>
40: * GraphTraversal#CONTINUE to signal that the traversal should
41: * suspend.<BR>
42: * GraphTraversal#KILL_BRANCH to signal that the traversal should
43: * kill its current branch.<BR>
44: * GraphTraversal#STOP to signal that the traversal should stop.<BR>
45: *
46: * @see GraphTraversal
47: * @see GraphIterator
48: */
49: public int visit(Graphable element, GraphTraversal traversal);
50:
51: /**
52: * Called when the graph traversal is completed. Wether this method is called
53: * after a traversal has been stopped with a return signal is up to the
54: * implementation of GraphTraversal.
55: *
56: * @see GraphTraversal
57: */
58: public void finish();
59: }
|