Package org.geotools.graph.traverse
Interface GraphTraversal
- All Known Implementing Classes:
- BasicGraphTraversal,- StagedGraphTraversal
public interface GraphTraversal
Iterates a GraphWalker over the components of a Graph. The order in which components are iterated over is determined
 by the GraphIterator class. The GraphTraversal is the mediator between the GraphWalker and the GraphIterator.
 
Upon each visitation, the GraphWalker communicates to the GraphTraversal through a series of return codes, each specifying a different action to perform at that point of the travesal. The following summarizes the meaning of the codes.
 
 
   
 
 
GraphTraversals are started with a call to traverse(). If the traversal is suspended at some intermediate point, an additional call to traverse() will resume the traversal.
 
Upon each visitation, the GraphWalker communicates to the GraphTraversal through a series of return codes, each specifying a different action to perform at that point of the travesal. The following summarizes the meaning of the codes.
| Code | Action Taken | 
|---|---|
| CONTINUE | The traversal continues as normal. | 
| SUSPEND | Suspends the traversal at some intermediate stage. This code should be returned if the traversal is intended to be resumed. | 
| KILL_BRANCH | Kills the current branch of the traversal. Depending on the iteration algorithm, returning this code may end the traversal. | 
| STOP | Stops the traversal. | 
GraphTraversals are started with a call to traverse(). If the traversal is suspended at some intermediate point, an additional call to traverse() will resume the traversal.
- Author:
- Justin Deoliveira, Refractions Research Inc, jdeolive@refractions.net
- See Also:
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final intSignals the traversal to continue *static final intSignals the traversal to kill the current branch *static final intSignals the traversal to stop *static final intSignals the traversal to suspend at some intermediate point *
- 
Method SummaryModifier and TypeMethodDescriptiongetGraph()Returns the graph being traversed.Returns the iterator that specifies the order in which to visit graph components.Returns the walker (visitor) traversing the graph of the graph.voidinit()Initialises the traversal.booleanvoidSets the graph being traversed.voidsetIterator(GraphIterator iterator) Sets the iterator that specifies the order in which visit graph components.voidsetVisited(Graphable g, boolean visited) voidsetWalker(GraphWalker walker) Sets the walker (visitor) traversing the graph.voidtraverse()Starts or resumes a traversal over the components of a graph.
- 
Field Details- 
CONTINUEstatic final int CONTINUESignals the traversal to continue *- See Also:
 
- 
SUSPENDstatic final int SUSPENDSignals the traversal to suspend at some intermediate point *- See Also:
 
- 
KILL_BRANCHstatic final int KILL_BRANCHSignals the traversal to kill the current branch *- See Also:
 
- 
STOPstatic final int STOPSignals the traversal to stop *- See Also:
 
 
- 
- 
Method Details- 
setGraphSets the graph being traversed.- Parameters:
- graph- The graph whose components are being traversed.
 
- 
getGraphGraph getGraph()Returns the graph being traversed.- Returns:
- The graph whose components are being traversed.
- See Also:
 
- 
setIteratorSets the iterator that specifies the order in which visit graph components.- Parameters:
- iterator- The iterator over the graph components.
 
- 
getIteratorGraphIterator getIterator()Returns the iterator that specifies the order in which to visit graph components.- Returns:
- The iterator over the graph components.
- See Also:
 
- 
setWalkerSets the walker (visitor) traversing the graph.- Parameters:
- walker- The walker being iterated over the components of the graph.
 
- 
getWalkerGraphWalker getWalker()Returns the walker (visitor) traversing the graph of the graph.- Returns:
- The walker being iterated over the components.
 
- 
initvoid init()Initialises the traversal.
- 
traversevoid traverse()Starts or resumes a traversal over the components of a graph.
- 
isVisited
- 
setVisited
 
-