package lrs.visitor; import lrs.*; /** * Uses reverse accumulation to remove duplicates from the host list. * @author Dung X. Nguyen - Copyright 2005 - All rights reserved. */ public class RemDupRev implements IAlgo { public final static RemDupRev Singleton = new RemDupRev(); private RemDupRev() { } /** */ public Object emptyCase(LRStruct host, Object... nu) { return host; } /** */ public Object nonEmptyCase(LRStruct host, Object... nu) { host.getRest().execute(this); if ((Boolean)host.getRest().execute(Contain.Singleton, host.getFirst())) { host.removeFront(); } return host; } }