OOscheme
Class EmptyList

java.lang.Object
  extended by OOscheme.EmptyList
All Implemented Interfaces:
IEmptyList, IList

public class EmptyList
extends Object
implements IEmptyList

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.

Since:
Copyright 2002 by DXN - All rights reserved
Author:
Dung X. Nguyen

Field Summary
static EmptyList Singleton
          Singleton Design Pattern.
 
Constructor Summary
private EmptyList()
           
 
Method Summary
 Object execute(IListAlgo algo, Object... inp)
          Calls the empty case of the algorithm algo, passing to it itself as the host parameter and the given inp as the input parameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Singleton

public static final EmptyList Singleton
Singleton Design Pattern.

Constructor Detail

EmptyList

private EmptyList()
Method Detail

execute

public final Object execute(IListAlgo algo,
                            Object... inp)
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.

Specified by:
execute in interface IList
Parameters:
algo - the visitor, the algorithm to be executed.
inp - a variable number of input parameters to be used by the algorithm algo.
Returns:
an Object output from executing the algorithm algo; may be null.