Class NoBifurcationIterator
- Object
-
- AbstractGraphIterator
-
- SourceGraphIterator
-
- NoBifurcationIterator
-
- All Implemented Interfaces:
GraphIterator
public class NoBifurcationIterator extends SourceGraphIterator
Iterates over the nodes of a graph starting from a specified node, stopping at a bifurcation. A bifurcation is defined as a node of degree > 2. The following figures illustrate examples of the iterator.
- Author:
- Justin Deoliveira, Refractions Research Inc, jdeolive@refractions.net
-
-
Constructor Summary
Constructors Constructor Description NoBifurcationIterator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cont(Graphable current, GraphTraversal traversal)
Searches for the next node to be returned in the iteration.void
init(Graph graph, GraphTraversal traversal)
Does nothing.void
killBranch(Graphable current, GraphTraversal traversal)
Kills the current branch of the iteration by explicitly setting the next node to be returned to null.Graphable
next(GraphTraversal traversal)
The next node in the iteration is the first node found adjacent to the current node that is non visited and of degree less than 2.void
setSource(Graphable source)
Sets the source of the traversal.-
Methods inherited from class SourceGraphIterator
getSource
-
Methods inherited from class AbstractGraphIterator
getGraph, getTraversal, getWalker, setTraversal
-
-
-
-
Method Detail
-
init
public void init(Graph graph, GraphTraversal traversal)
Does nothing.- Parameters:
graph
- The graph being whose components are being iterated over.- See Also:
GraphIterator#init(Graph)
-
setSource
public void setSource(Graphable source)
Sets the source of the traversal. This must be a node of degree less than or equal to 2.- Overrides:
setSource
in classSourceGraphIterator
- Parameters:
source
- node of degree less than or equal 2- See Also:
SourceGraphIterator.setSource(Graphable)
-
next
public Graphable next(GraphTraversal traversal)
The next node in the iteration is the first node found adjacent to the current node that is non visited and of degree less than 2.- Returns:
- The next component in the iteration, or null if iteration is complete.
- See Also:
org.geotools.graph.traverse.GraphIterator#next()
-
cont
public void cont(Graphable current, GraphTraversal traversal)
Searches for the next node to be returned in the iteration. The next node is the first node (of two) related to the current node that is non visited and of degree <= 2.- Parameters:
current
- The current component of the traversal.- See Also:
org.geotools.graph.traverse.GraphIterator#cont(Graphable)
-
killBranch
public void killBranch(Graphable current, GraphTraversal traversal)
Kills the current branch of the iteration by explicitly setting the next node to be returned to null. This call always ends the traversal.- Parameters:
current
- The current component of the traversal.- See Also:
org.geotools.graph.traverse.GraphIterator#killBranch(Graphable)
-
-