net.sourceforge.combean.graph.alg.traversal
Class DFSNodeNumberingVisitor

Package class diagram package DFSNodeNumberingVisitor
java.lang.Object
  extended by net.sourceforge.combean.graph.alg.traversal.IdleTraversalVisitor
      extended by net.sourceforge.combean.graph.alg.traversal.IdleDFSVisitor
          extended by net.sourceforge.combean.graph.alg.traversal.DFSNodeNumberingVisitor
All Implemented Interfaces:
DFSVisitor, TraversalVisitor
Direct Known Subclasses:
DFSNodeStackVisitor

public class DFSNodeNumberingVisitor
extends IdleDFSVisitor


Constructor Summary
DFSNodeNumberingVisitor()
          constructor
 
Method Summary
 int getDfsNum(Node v)
           
 NodeNumbering getDfsNumbering()
           
 void init(Graph g)
          This method is called immediately before the traversal algorithm starts if all components of g shall be traversed.
 void initLocal(Graph g, Node startNode)
          This method is called immediately before the traversal algorithm starts if a component of g shall be traversed from a local start node.
protected  boolean isOnStack(Node v)
           
 void leaveNode(Node v)
          The exploration of all nodes reachable from v ends.
 void setDfsNumbering(NodeNumbering dfsNum)
          Set the dfs numbering.
 void visitNode(Node v)
          The traversal algorithms begins to explore the neighborhood of a node.
 
Methods inherited from class net.sourceforge.combean.graph.alg.traversal.IdleDFSVisitor
leaveNeighbor
 
Methods inherited from class net.sourceforge.combean.graph.alg.traversal.IdleTraversalVisitor
finish, leaveComponent, openNeighbor, readyToTerminate, reopenNeighbor, visitComponent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sourceforge.combean.interfaces.graph.alg.traverse.TraversalVisitor
finish, leaveComponent, openNeighbor, readyToTerminate, reopenNeighbor, visitComponent
 

Constructor Detail

DFSNodeNumberingVisitor

public DFSNodeNumberingVisitor()
constructor

Method Detail

getDfsNumbering

public final NodeNumbering getDfsNumbering()
Returns:
Returns the dfs numbering.

setDfsNumbering

public final void setDfsNumbering(NodeNumbering dfsNum)
Set the dfs numbering. If left unset, the NodeNumberingAdvisor will be consulted.

Parameters:
dfsNum - The dfs numbering to set.

getDfsNum

public final int getDfsNum(Node v)
Parameters:
v -
Returns:
the dfs number of v (positive value, regardless whether v is on the stack of not.

isOnStack

protected final boolean isOnStack(Node v)
Parameters:
v -
Returns:
true if v is on the dfs stack while the dfs is executed.

leaveNode

public void leaveNode(Node v)
Description copied from interface: DFSVisitor
The exploration of all nodes reachable from v ends.

Specified by:
leaveNode in interface DFSVisitor
Overrides:
leaveNode in class IdleDFSVisitor

visitNode

public void visitNode(Node v)
Description copied from interface: TraversalVisitor
The traversal algorithms begins to explore the neighborhood of a node.

Specified by:
visitNode in interface TraversalVisitor
Overrides:
visitNode in class IdleTraversalVisitor
Parameters:
v - the node which is being visited.
See Also:
TraversalVisitor.visitNode(net.sourceforge.combean.interfaces.graph.Node)

init

public void init(Graph g)
Description copied from interface: TraversalVisitor
This method is called immediately before the traversal algorithm starts if all components of g shall be traversed.

Specified by:
init in interface TraversalVisitor
Overrides:
init in class IdleTraversalVisitor
Parameters:
g - the graph which will be traversed.
See Also:
TraversalVisitor.init(Graph)

initLocal

public void initLocal(Graph g,
                      Node startNode)
Description copied from interface: TraversalVisitor
This method is called immediately before the traversal algorithm starts if a component of g shall be traversed from a local start node.

Specified by:
initLocal in interface TraversalVisitor
Overrides:
initLocal in class IdleTraversalVisitor
Parameters:
g - the graph which will be traversed.
startNode - the local start node.
See Also:
TraversalVisitor.initLocal(Graph, net.sourceforge.combean.interfaces.graph.Node)