package OOscheme; /** * Concrete implementation of the empty list interface, IEmptyList. * Provides concrete code for the execute method: simply calls the emptyCase * method of the IListAlgo parameter, passing to this method itself as the host * and the given input Object as the input. * Note the class is not public in order to hide from all client code outside * of the OOscheme package. * @author Dung X. Nguyen * @since Copyright 2002 by DXN - All rights reserved */ public class EmptyList implements IEmptyList { /** * Singleton Design Pattern. */ public final static EmptyList Singleton = new EmptyList(); private EmptyList() { } /** * Calls the empty case of the algorithm algo, passing to it itself as * the host parameter and the given inp as the input parameter. * This method is marked as final to prevent all subclasses from * overriding it. Finalizing a method also allows the compiler to generate * more efficient calling code. */ final public Object execute(IListAlgo algo, Object... inp) { return algo.emptyCase(this, inp); } }