package lrs.visitor; import lrs.*; /** * Determines whether or not an Object is in the host LRStruct. * @author Dung X. Nguyen - Copyright 2005 - All rights reserved. */ public class Contain implements IAlgo { public final static Contain Singleton = new Contain(); private Contain() { } /** */ public Object emptyCase(LRStruct host, Object... nu) { return false; } /** */ public Object nonEmptyCase(LRStruct host, Object... inp) { return inp[0].equals(host.getFirst())? true: host.getRest().execute(this, inp[0]); } }