package gizmoball.game;

import gizmoball.NotImplementedException;

/**
 * A trigger triggered by a keypress. Keypresses are specified in
 * terms of their key code, as defined in KeyEvent. A KeypressTrigger
 * is triggered when the specified key is pressed.
 *
 * <p>Note: we may want to extend this to allow triggers to specify
 * whether they are to be triggered by key-pressed, key-released, or
 * both types of events.
 *
 * @see java.awt.event.KeyEvent
 *
 * @specfield keyCode : int // the key code that triggers the trigger
 * (as in KeyEvent)
 * @specfield target : AbstractGizmo // the gizmo triggered by this
 * trigger
 *
 * @author <a href="mailto:drkp@mit.edu">Dan R. K. Ports</a>
 * @version $Id: KeypressTrigger.java,v 1.4 2004/04/24 16:39:15 dan Exp $
 */
public class KeypressTrigger extends AbstractTrigger {

    private int keyCode;
    
    /**
     * Creates a new <code>KeypressTrigger</code> instance with the
     * specified keyCode and target.
     *
     * @param keyCode the key code to be triggered by, as per KeyEvent
     * (an <code>int</code> value)
     * @param target the <code>AbstractGizmo</code> to trigger
     */
    public KeypressTrigger(int keyCode, AbstractGizmo target) {
        super(target);
        this.keyCode = keyCode;
    } // KeypressTrigger constructor


    /**
     * Gets the value of keyCode
     *
     * @return the value of keyCode
     */
    public int getKeyCode()  {
        return this.keyCode;
    }

    /**
     * Sets the value of keyCode
     *
     * @param argKeyCode Value to assign to this.keyCode
     */
    public void setKeyCode(int argKeyCode) {
        this.keyCode = argKeyCode;
    }

    
} // KeypressTrigger
