CompositeListFact.java
Created with JBuilder |
package listFW.factory;
import listFW.*;
/**
* Concrete IListFactory to manufacture IList objects. How it does it is
* completely hidden from all external client code.
* The Singleton pattern is used ensure there is only one instance of this
* factory. This saves time and space.
* To use this factory, simply call CompositeListFactory.Singleton.
* @author D.X. Nguyen
*/
public class CompositeListFactory implements IListFactory {
/**
* Singleton Design Pattern:
*/
public static final CompositeListFactory Singleton
= new CompositeListFactory();
/**
* private constructor makes it impossible for external code to instantiate
* any copy of this factory object. Only the code inside of this class can
* call this constructor, which is what the above line of code does.
*/
private CompositeListFactory() {
}
// A bunch of code to implement IEmptyList and INEList elided...
public IEmptyList makeEmptyList() {
// code elided.
}
public INEList makeNEList(Object first, IList tail) {
// code elided.
}
}
CompositeListFact.java
Created with JBuilder |