package listFW.visitor; import listFW.*; /** * Sums the elements in the host list by using a helper algorithm when the host * list is not empty. * @author DXN */ public class GetSum implements IListAlgo { public Object emptyCase(IEmptyList host, Object inp) { return new Integer(0); } /** * Passes the host's first to the rest and asks for help to compute the sum. */ public Object nonEmptyCase(INEList host, Object inp) { return host.getRest().execute(new HelpGetSum(), host.getFirst()); } }