/** * Removes and returns the minimum of the non-empty input list. * Assumes host is a sublist of the non-empty input list. * @author Dung X. Nguyen - Copyright 1999 - All rights reserved. */ public class RemMinHelper implements IAlgo { public final static RemMinHelper Singleton = new RemMinHelper (); private RemMinHelper() { } /** * @param host a sublist of input. * @param input a non-empty QFList of Integers. * @return */ public Object nullCase(QFList host, Object input) { return ((QFList)input).removeFront(); } /** * @param host a sublist of input. * @param input a non-empty QFList of Integers. * @return */ public Object nonNullCase(QFList host, Object input) { Integer hostFirst = (Integer)host.getFirst(); Integer inputFirst = (Integer)((QFList)input).getFirst (); return hostFirst.intValue() < inputFirst.intValue()? host.getRest().execute(this, host): host.getRest().execute(this, input); } }