package scheme2.visitor; import scheme2.AListFW; import scheme2.IListAlgo; public class Sum implements IListAlgo { /** @SBGen Singleton Variable */ public final static Sum Singleton = new Sum (); /** @SBGen Constructor */ private Sum() { } /** * @param host * @param input not used. * @return */ public Object forEmpty(AListFW host, Object input) { return new Integer (0); // Empty Range Axiom! } /** * @param host * @param input not used * @return */ public Object forNonEmpty(AListFW host, Object input) { Integer restSum = (Integer)host.getRest ().execute (this, null); return new Integer (((Integer)host.getFirst ()).intValue () + restSum.intValue ()); } }