org.geotools.graph.traverse.standard
Class NoBifurcationIterator

java.lang.Object
  extended byorg.geotools.graph.traverse.basic.AbstractGraphIterator
      extended byorg.geotools.graph.traverse.basic.SourceGraphIterator
          extended byorg.geotools.graph.traverse.standard.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
NoBifurcationIterator()
           
 
Method Summary
 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 org.geotools.graph.traverse.basic.SourceGraphIterator
getSource
 
Methods inherited from class org.geotools.graph.traverse.basic.AbstractGraphIterator
getGraph, getTraversal, getWalker, setTraversal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NoBifurcationIterator

public NoBifurcationIterator()
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 class SourceGraphIterator
Parameters:
source - node of degree less than or equal 2
Throws:
java.lang.IllegalStateException
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)


Copyright © GeoTools. All Rights Reserved.