/**
 * The Closed State (for a garage door Controller)
 *
 * @author  Prof. David Bernstein, James Madison University
 * @version 1.0
 */
public class Closed extends State
{
    private        Controller           controller;
    private static Closed               instance;
    

    /**
     * Explicit Value Constuctor 
     * [used by the enter() method]
     *
     * @param controller   The Controller to use
     */
    private Closed(Controller controller)
    {
       this.controller = controller;
    }
    

    /**
     * Enter this State
     *
     * Specifically, construct an instance if necessary and perform any
     * necessary operations
     *
     * @param controller   The Controller to perform operations on
     * @return             The (singleton) instance of this State
     */
    public static State enter(Controller controller)
    {
       if (instance == null) instance = new Closed(controller);

       return instance;
    }

    
    /**
     * Process a lock transition
     */
    public void lock()
    {
       controller.changeState(Locked.enter(controller));
    }
    


    
    /**
     * Process an open transition
     */
    public void open()
    {
       controller.changeState(Opened.enter(controller));
    }
    





}
