|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectbrs.ToStringHelp<T>
public class ToStringHelp<T>
Computes a String representation of the binary tree host so that it can be printed vertically, given a leftmost leading string for the two subtrees. Called by ToString. Should be implemented as an anonymous inner class in the call by ToString.
| Constructor Summary | |
|---|---|
ToStringHelp()
|
|
| Method Summary | |
|---|---|
java.lang.String |
emptyCase(BiTree<T> host,
java.lang.String... nu)
Returns "|_[]" to denote an empty tree subtree. |
java.lang.String |
nonEmptyCase(BiTree<T> host,
java.lang.String... leftLead)
Computes a String representation of the binary tree host so that it can be printed vertically. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ToStringHelp()
| Method Detail |
|---|
public java.lang.String emptyCase(BiTree<T> host,
java.lang.String... nu)
emptyCase in interface IVisitor<T,java.lang.String,java.lang.String>host - an empty binary (sub)tree.nu - not used.
public java.lang.String nonEmptyCase(BiTree<T> host,
java.lang.String... leftLead)
nonEmptyCase in interface IVisitor<T,java.lang.String,java.lang.String>host - a non-empty binary (sub)tree.leftLead - appropriate leftmost leading String to help compute the
String representations of the left and right subtrees.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||