java.lang.Object
provided.listFW.visitors.ToStringAlgo
- All Implemented Interfaces:
IListAlgo
Computes a String representation of IList showing a left parenthesis followed
by elements of the IList separated by commas, ending with with a right parenthesis.
Implemented as a forward accumulation algorithm.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
Singleton
Singeton instance
-
-
Constructor Details
-
ToStringAlgo
private ToStringAlgo()Private constructor for the Singleton
-
-
Method Details
-
emptyCase
Returns "()". -
nonEmptyCase
Passes "(" + first to the rest of IList and asks for help to complete the computation.- Specified by:
nonEmptyCase
in interfaceIListAlgo
- Parameters:
nu
- not usedhost
- theNEList
that is executing this algorithm- Returns:
- String
-