com.iotabits.examples.revisitor
Class BinaryTreeNode
java.lang.Object
com.iotabits.revisitor.BasicVisitable
com.iotabits.examples.revisitor.BinaryTreeNode
- All Implemented Interfaces:
- iVisitable
- public class BinaryTreeNode
- extends BasicVisitable
This class provides an example of using the visitor
without a passback. It represents a binary tree, so
the visitation algorithm is simple.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BinaryTreeNode
public BinaryTreeNode(java.lang.Object data,
BinaryTreeNode left,
BinaryTreeNode right)
BinaryTreeNode
public BinaryTreeNode(java.lang.Object data)
setRight
public void setRight(BinaryTreeNode right)
setLeft
public void setLeft(BinaryTreeNode left)
accept
public void accept(iReflectiveVisitor visitor)
throws java.lang.Exception
- Description copied from class:
BasicVisitable
- Dispatches this object to the revisitor.
In the reflective idiom we just call revisitor.dispatchToVisit().
- Specified by:
accept
in interface iVisitable
- Overrides:
accept
in class BasicVisitable
- Parameters:
visitor
-
- Throws:
java.lang.Exception
main
public static void main(java.lang.String[] args)