brs.visitor
Class InOrder1<T,P>

java.lang.Object
  extended by brs.visitor.InOrder1<T,P>
All Implemented Interfaces:
IVisitor<T,P,P>

public class InOrder1<T,P>
extends java.lang.Object
implements IVisitor<T,P,P>

Traverse a binary tree in order: For an empty tree: do the appropriate processing. For a non-empty tree: Traverse the left subtree in order; Process the root; Traverse the right subtree in order; Uses one lambda as variant. Let f be an ILambda and b be some input object. empty case: InOrder1(empty, f, b) = b; non-empty case: InOder(tree, f, b) = f(InOrder1(tree.left, f, b), tree, InOrder1(tree.right, f, b));

Since:
09/22/2004

Field Summary
private   _f
           
 
Constructor Summary
InOrder1( f)
           
 
Method Summary
 P emptyCase(BiTree<T> host, P... b)
          Called by the host when the host is empty.
static void main(java.lang.String[] nu)
           
 P nonEmptyCase(BiTree<T> host, P... b)
          Called by the host when the host is not empty.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_f

private  _f
Constructor Detail

InOrder1

public InOrder1( f)
Method Detail

emptyCase

public P emptyCase(BiTree<T> host,
                   P... b)
Description copied from interface: IVisitor
Called by the host when the host is empty.

Specified by:
emptyCase in interface IVisitor<T,P,P>
Parameters:
host - an empty BiTree on which this IVisitor operates.
b - the vararg input needed by this IVisitor to perform its task.
Returns:
Object the output of this algorithm on the host.

nonEmptyCase

public P nonEmptyCase(BiTree<T> host,
                      P... b)
Description copied from interface: IVisitor
Called by the host when the host is not empty.

Specified by:
nonEmptyCase in interface IVisitor<T,P,P>
Parameters:
host - a non-empty BiTree on which this IVisitor operates.
b - the vararg input needed by this IVisitor to perform its task.
Returns:
Object the output of this algorithm on the host.

main

public static void main(java.lang.String[] nu)