package part1;

import javax.swing.JButton;

/**
 *
 * A representation of a button on a Player.
 * 
 * A PlayerCommand exists in a PlayerContext.
 * 
 * PlayerCommands are cloneable so they can be used as Prototypes
 * in a PlayerFactory.
 *
 *
 * @author $Author: cdent $
 *
 * @version $Revision: 1.2 $
 *
 */
public interface PlayerCommand {

    /**
     * Called when the button associated with a PlayerCommand 
     * has its ActionEvent.
     *
     */
    public abstract void press();

    /**
     * Returns true is the current state shows this command to be
     * in progress.
     *
     */
    public abstract boolean isPressed();

    /**
     * Sets the state to false
     */
    public abstract void falsify();

    /**
     * Sets the state to true
     */
    public abstract void truify();

    /**
     * Sets the PlayerContext for this command so it knows
     * who to tell when it has been pressed.
     */
    public abstract void setContext(PlayerContext context);

    /**
     * Initializes button settings and makes the PlayerCommand
     * a listener of the Button which it uses.
     */
    public abstract void init();
    
    /**
     * Returns the JButton the PlayerCommand uses so the PlayerContext
     * can add it to the presenation.
     */
    public abstract JButton getButton();

    public abstract Object clone();
}
