
/**
 * A class implementing the "singleton" design pattern for printing.
 */
public class PrintSpooler
{
    /* The reference to the single PrintSpooler object
     * that will be used to print */
    private static PrintSpooler spooler;

    /**
     * This method returns the singleton to use for printing documents.
     */
    public static PrintSpooler getSpooler()
    {
        if (spooler == null)
            spooler = new PrintSpooler();
        return spooler;
    }

    /**
     * Print a document
     * @param s the document (string) to print
     */
    public void printDocument(String s)
    {
        System.out.println(s);
    }
}
