package listFW.visitor; import listFW.*; /** * Sums a list of Numbers, including lists of any sub-types. * @author Mathias Ricken - Copyright 2008 - All rights reserved. */ public class SumNumList implements IListAlgo { public Number emptyCase(IMTList host, Object ... inp) { return 0; } public Number nonEmptyCase(INEList host, Object ... inp) { return host.getFirst().doubleValue() + host.getRest().execute(this).doubleValue(); } }