package listFW.visitor; import listFW.*; /** * Checks to see if the host list contains all non-negative integers. * @author DXN */ public class CheckAllNonNegative implements IListAlgo { public Object emptyCase(IEmptyList host, Object inp) { return Boolean.TRUE; } public Object nonEmptyCase(INEList host, Object inp) { int f = ((Integer)host.getFirst()).intValue(); return new Boolean(0 <= f && ((Boolean)host.getRest().execute(this, null)).booleanValue()); } }