package lrs.visitor; import lrs.*; /** * Shares the host's tail with the input LRStruct. */ public class ShareRest implements IAlgo { public final static ShareRest Singleton = new ShareRest (); private ShareRest() { } /** * Does nothing. * @param host an empty LRStruct. * @param input a non-empty LRStruct * @return null. */ public Object nullCase(LRStruct host, Object input) { //((LRStruct)input).setRest (new LRStruct ()); return null; } /** * Sets the input's tail to the host's tail. * @param host a non-empty LRStruct. * @param input a non-empty LRStruct. * @return null. */ public Object nonNullCase(LRStruct host, Object input) { ((LRStruct)input).setRest (host.getRest ()); return null; } }