wt.visitor
Class BFSWalker

java.lang.Object
  extended bywt.visitor.BasicWalker
      extended bywt.visitor.Navigator
          extended bywt.visitor.BFSWalker
All Implemented Interfaces:
Walker
Direct Known Subclasses:
BFSNavigator

public class BFSWalker
extends Navigator

This class extends BasicWalker to implement a breadth-first traversal of a structure. Each level is traversed from parent to children. All of the nodes on a level will be visited before the traversal moves to the next level.

Supported API: true

Extendable: false


Nested Class Summary
private  class BFSWalker.Tuple
           
 
Field Summary
private static String CLASSNAME
           
private  Vector fromNodes
           
private  int level
           
private  Vector links
           
private static String RESOURCE
           
private  Vector toNodes
           
private  Vector toTuples
           
 
Fields inherited from class wt.visitor.BasicWalker
 
Fields inherited from interface wt.visitor.Walker
NODE_EXPANDER, VISITOR
 
Constructor Summary
BFSWalker()
           
 
Method Summary
 void traverse(Persistable root)
          Traverses the root node using a breadth-first manner.
private  void traverseLevel()
           
 
Methods inherited from class wt.visitor.BasicWalker
clearVisitedNodes, getNodeExpander, getVisitor, isRecursionDetectionEnabled, registerVisitedNode, setNodeExpander, setRecursionDetectionEnabled, setVisitor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

fromNodes

private Vector fromNodes

links

private Vector links

toNodes

private Vector toNodes

toTuples

private Vector toTuples

level

private int level
Constructor Detail

BFSWalker

public BFSWalker()
Method Detail

traverse

public void traverse(Persistable root)
              throws WTException
Traverses the root node using a breadth-first manner. This method is synchronized becuase of the need to maintain level information as the nodes are navigated. Since a traversal may take a significant amount of time, it may be better for a Threads to use a separate instances of this type of Walker.

Supported API: true

Parameters:
root -
Throws:
WTException

traverseLevel

private void traverseLevel()
                    throws WTException
Throws:
WTException