brs
Interface IVisitor<T,R,P>

All Known Implementing Classes:
InOrder1, InOrder2, InOrder3, InOrderPrint, ToString, ToStringHelp

public interface IVisitor<T,R,P>

Represents all extrinsic algorithms on a BiTree as a visitor to the BiTree host structure. The BiTree host will make the appropriate call on this IVisitor's methods. Since BiTree is a mutable data structure, we require an exact match for the data type (BiTree, not BiTree).


Method Summary
 R emptyCase(BiTree<T> host, P... inp)
          Called by the host when the host is empty.
 R nonEmptyCase(BiTree<T> host, P... inp)
          Called by the host when the host is not empty.
 

Method Detail

emptyCase

R emptyCase(BiTree<T> host,
            P... inp)
Called by the host when the host is empty.

Parameters:
host - an empty BiTree on which this IVisitor operates.
inp - the vararg input needed by this IVisitor to perform its task.
Returns:
Object the output of this algorithm on the host.

nonEmptyCase

R nonEmptyCase(BiTree<T> host,
               P... inp)
Called by the host when the host is not empty.

Parameters:
host - a non-empty BiTree on which this IVisitor operates.
inp - the vararg input needed by this IVisitor to perform its task.
Returns:
Object the output of this algorithm on the host.