/** * Assigns the input list to the host. host thus "becomes" the input list. * Both host and the input list share the same head node. * @author Dung X. Nguyen */ public class Becomes implements IAlgo { public final static Becomes Singleton = new Becomes (); private Becomes() { } /** * @param host * @param input * @return */ public Object nullCase(QFList host, Object input) { return assign (host, (QFList)input); } /** * @param host * @param input * @return */ public Object nonNullCase(QFList host, Object input) { return assign (host, (QFList)input); } private Object assign (QFList lhs, QFList rhs) { lhs.insertFront (null); lhs.setRest (rhs); lhs.removeFront(); return null; } }