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

Package class diagram package DFSNodeStackVisitor
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
              extended by net.sourceforge.combean.graph.alg.traversal.DFSNodeStackVisitor
All Implemented Interfaces:
DFSVisitor, TraversalVisitor

public class DFSNodeStackVisitor
extends DFSNodeNumberingVisitor

Maintains a stack of currently opened nodes during the DFS. (i.e. the stack of nodes that one would have during a classic recursive implementation of the DFS).


Constructor Summary
DFSNodeStackVisitor()
          constructor.
 
Method Summary
 NodeStack getStack()
           
 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.
 void leaveNode(Node v)
          The exploration of all nodes reachable from v ends.
 void setStack(NodeStack stack)
          Set the stack which shall be used.
 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.DFSNodeNumberingVisitor
getDfsNum, getDfsNumbering, isOnStack, setDfsNumbering
 
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

DFSNodeStackVisitor

public DFSNodeStackVisitor()
constructor.

Method Detail

getStack

public final NodeStack getStack()
Returns:
Returns the stack.

setStack

public final void setStack(NodeStack stack)
Set the stack which shall be used. If left unset, an ordinary java.util.Stack is used.

Parameters:
stack - The stack to set.

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 DFSNodeNumberingVisitor
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 DFSNodeNumberingVisitor
Parameters:
g - the graph which will be traversed.
startNode - the local start node.
See Also:
TraversalVisitor.initLocal(Graph, net.sourceforge.combean.interfaces.graph.Node)

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 DFSNodeNumberingVisitor
Parameters:
v - the node which is being visited.
See Also:
TraversalVisitor.visitNode(net.sourceforge.combean.interfaces.graph.Node)

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 DFSNodeNumberingVisitor