wt.visitor
Class CompositeVisitor

java.lang.Object
  extended by wt.visitor.CompositeVisitor
All Implemented Interfaces:
Visitor
Direct Known Subclasses:
ObjectGraphCallback

public class CompositeVisitor
extends Object
implements Visitor

This class provides a mechanism for supporting more than one Visitor object that can be visited during a single traversal. This class contains a Vector of Visitor objects that can be added to or removed from. It implements the visit methods by calling the corresponding visit methods in each of the contained Visitor objects and returning the logical OR of their return values.

Supported API: true

Extendable: true


Method Summary
 void addVisitor(Visitor a_visitor)
          Adds a Visitor instance to the contained list of Visitors.
 void removeVisitor(Visitor a_visitor)
          Removes the Visitor instance from the contained list of Visitors.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

addVisitor

public void addVisitor(Visitor a_visitor)
Adds a Visitor instance to the contained list of Visitors.

Supported API: true

Parameters:
a_visitor -

removeVisitor

public void removeVisitor(Visitor a_visitor)
Removes the Visitor instance from the contained list of Visitors.

Supported API: true

Parameters:
a_visitor -

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

Specified by:
visit in interface Visitor
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

Specified by:
visitLevel in interface Visitor
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

Specified by:
visitLevel in interface Visitor
Parameters:
fromNodes -
links -
toNodes -
level -
Returns:
boolean
Throws:
WTException