Class brs.ToStringHelp
- public class ToStringHelp
- extends Object
- implements brs.IVisitor
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.
- Author:
- Dung X. Nguyen - Copyright 2001 - All rights reserved.

Singleton

ToStringHelp
()

emptyCase
(BiTree, Object[])
- Returns "|_[]" to denote an empty tree subtree
nonEmptyCase
(BiTree, Object[])
- Computes a String representation of the binary tree host so that it

Singleton
public static final ToStringHelp Singleton = new ToStringHelp ()

ToStringHelp
private ToStringHelp()

emptyCase
public Object emptyCase(BiTree host, Object[] nu)
- Returns "|_[]" to denote an empty tree subtree.
- Parameters:
- host - an empty binary (sub)tree.
- nu - not used.
- Returns:
- String
nonEmptyCase
public Object nonEmptyCase(BiTree host, Object[] leftLead)
- Computes a String representation of the binary tree host so that it
can be printed vertically.
There is no '\n' at the end of the String.
- Parameters:
- host - a non-empty binary (sub)tree.
- leftLead[0] - appropriate leftmost leading String to help compute the
String representations of the left and right subtrees.
- Returns:
- String