wt.visitor
Interface Visitor

All Known Implementing Classes:
BaselineVisitor, CompositeVisitor, VisitorAdapter

public interface Visitor

This interface defines generic "callback" methods which are called by the Navigator as a structure is traversed. The Visitor is used to customize the operations performed on nodes in a structure, independent of how the structure is navigated. Classes that implement this interface are expected to perform some operation as each node or level is visited. The Visitor does not have control over how the structure is navigated. However, if a boolean false value is returned, then the Navigator will not traverse that node any further.

Several types of visit methods are defined. In practice, a Visitor implementation would only use one of these methods for its specific purpose. The unused methods can simply return true.



Supported API: true

Extendable: true


Method Summary
 boolean visit(Persistable fromNode, Link link, Persistable toNode, int level, boolean previouslyVisited)
          Visit a node.
 boolean visitLevel(Persistable fromNode, Vector links, Vector toNodes, int level)
          Vist nodes at this level.
 boolean visitLevel(Vector fromNodes, Vector links, Vector toNodes, int level)
          Vist nodes at this level.
 

Method Detail

visit

public boolean visit(Persistable fromNode,
                     Link link,
                     Persistable toNode,
                     int level,
                     boolean previouslyVisited)
              throws WTException
Visit a node. If false is returned, then the node will not be traversed.

Supported API: true

Parameters:
fromNode -
link -
toNode -
level -
previouslyVisited -
Returns:
boolean
Throws:
WTException

visitLevel

public boolean visitLevel(Persistable fromNode,
                          Vector links,
                          Vector toNodes,
                          int level)
                   throws WTException
Vist nodes at this level. If false is returned, then none of the nodes on this level will be traversed.

Supported API: true

Parameters:
fromNode -
links -
toNodes -
level -
Returns:
boolean
Throws:
WTException

visitLevel

public boolean visitLevel(Vector fromNodes,
                          Vector links,
                          Vector toNodes,
                          int level)
                   throws WTException
Vist nodes at this level. If false is returned, then none of the nodes on this level will be traversed.

Supported API: true

Parameters:
fromNodes -
links -
toNodes -
level -
Returns:
boolean
Throws:
WTException