com.interface21.core
Class NodeCountVisitor

java.lang.Object
  |
  +--com.interface21.core.NodeCountVisitor
All Implemented Interfaces:
Visitor

public class NodeCountVisitor
extends java.lang.Object
implements Visitor

Test Visitor. Useful for testing.


Constructor Summary
NodeCountVisitor()
           
 
Method Summary
 boolean enterComposite(Visitable host, int depth)
          Begin a visit to a composite element, with subnodes.
 void exitComposite(Visitable host)
          End a visit to a composite element, with subnodes
 int getNodeCount()
           
protected  void recordVisit(Visitable host)
           
 void visitLeaf(Visitable host, int depth)
          Make an entire visit to a terminal node
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeCountVisitor

public NodeCountVisitor()
Method Detail

enterComposite

public boolean enterComposite(Visitable host,
                              int depth)
Description copied from interface: Visitor
Begin a visit to a composite element, with subnodes. Return false to just treat it as a terminal.
Note that either this method or exitComposite(), depending on implementation, must do the actual visit to the composite, as visit() will never be called on this node unless this method returns false.
Specified by:
enterComposite in interface Visitor
See Also:
Visitor.enterComposite(Visitable, int)

recordVisit

protected void recordVisit(Visitable host)

exitComposite

public void exitComposite(Visitable host)
Description copied from interface: Visitor
End a visit to a composite element, with subnodes
Specified by:
exitComposite in interface Visitor
See Also:
Visitor.exitComposite(Visitable)

visitLeaf

public void visitLeaf(Visitable host,
                      int depth)
Description copied from interface: Visitor
Make an entire visit to a terminal node
Specified by:
visitLeaf in interface Visitor
See Also:
Visitor.visitLeaf(Visitable, int)

getNodeCount

public int getNodeCount()


Rod Johnson and Spring contributors 2001-2003.