listFW.visitor
Class ToStringAlgo

java.lang.Object
  extended by listFW.visitor.ToStringAlgo
All Implemented Interfaces:
IListAlgo<Object,String,Object>

public class ToStringAlgo
extends Object
implements IListAlgo<Object,String,Object>

Computes a String reprsentation of IList showing a left parenthesis followed by elements of the IList separated by commas, ending with with a right parenthesis. This code has been written to make it run on any list.

Since:
07/01/2004
Author:
D.X. Nguyen, S. Wong

Field Summary
static ToStringAlgo Singleton
           
 
Constructor Summary
private ToStringAlgo()
           
 
Method Summary
 String emptyCase(IMTList<? extends Object> host, Object... inp)
          Returns "()".
 String nonEmptyCase(INEList<? extends Object> host, Object... inp)
          Passes "(" + first to the rest of IList and asks for help to complete the computation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Singleton

public static final ToStringAlgo Singleton
Constructor Detail

ToStringAlgo

private ToStringAlgo()
Method Detail

emptyCase

public String emptyCase(IMTList<? extends Object> host,
                        Object... inp)
Returns "()".

Specified by:
emptyCase in interface IListAlgo<Object,String,Object>

nonEmptyCase

public String nonEmptyCase(INEList<? extends Object> host,
                           Object... inp)
Passes "(" + first to the rest of IList and asks for help to complete the computation.

Specified by:
nonEmptyCase in interface IListAlgo<Object,String,Object>