package scheme2; /** * Manufactures AListFW objects. * Implemented as a singleton. * * @author Dung X. Nguyen * @version 1.0 * @since 09/17/00 * @Custom Copyright 2000 -All rights reserved */ public class ListFWFactory { public final static ListFWFactory Singleton = new ListFWFactory (); private ListFWFactory() { } public AListFW makeEmptyList() { return EmptyListFW.Singleton; } /** * Creates a non-empty list with a given non-null first element and a non-nul tail. * Throws an IllegalArgumentException if any of the parameters is null. * * @param dat != null, the fist data element of the non-empty list. * @param tail !- null, the tail of this non-empty list. */ public AListFW makeNEList(Object dat, AListFW tail) { if (null == dat || null == tail) { throw new IllegalArgumentException ("dat and tail must be non-null."); } return new NEListFW (dat, tail); } }