java.lang.Object
provided.listFW.visitors.ToStringHelper
- All Implemented Interfaces:
IListAlgo
Helps ToStringAlgo compute the String representation of the rest of the list.
This is the recursive part of the forward accumulation algorithm.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
Singleton
Singleton instance of helper algo
-
-
Constructor Details
-
ToStringHelper
private ToStringHelper()Private constructor for Singleton
-
-
Method Details
-
emptyCase
Returns the accumulated String + ")". At end of list: done! -
nonEmptyCase
Continues accumulating the String representation by appending ", " + first to acc and recurse!- Specified by:
nonEmptyCase
in interfaceIListAlgo
- Parameters:
acc
- acc[0] is the accumulated String representation of the preceding list.host
- theNEList
that is executing this algorithm- Returns:
- the String representation of the list.
-