Class brs.ToString


public class ToString
extends Object
implements brs.IVisitor
Computes a String representation of the binary tree host so that it can be printed vertically.

Author:
Dung X. Nguyen - Copyright 2000 - All rights reserved.

Variable Index

 o Singleton

Constructor Index

 o ToString ()

Method Index

 o emptyCase (BiTree, Object[])
Returns "[]", a String representation of an empty binary tree
 o nonEmptyCase (BiTree, Object[])
Computes a String representation of the binary tree host so that it can

Variables

 o Singleton
public static final ToString Singleton = new ToString ()

Constructors

 o ToString
private  ToString()

Methods

 o emptyCase
public Object emptyCase(BiTree host, Object[] nu)
Returns "[]", a String representation of an empty binary tree.

Parameters:
host - an empty binary tree.
nu - not used.
Returns:
String
 o nonEmptyCase
public Object nonEmptyCase(BiTree host, Object[] nu)
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. Passes appropriate leftmost leading String to a helper visitor to compute the String representations of the left and right subtrees.

Parameters:
host - a non-empty binary tree.
nu - not used.
Returns:
String