package gizmoball.game;

import gizmoball.NotImplementedException;


/**
 * A trigger is a connection to a "target" gizmo that triggers its
 * trigger handler. This is done by calling the target's
 * <code>fireTrigger</code> method. A Trigger can either be a
 * CollisionTrigger, which is triggered by a collision with another
 * gizmo, or a KeypressTrigger, which is triggered when a key is
 * pressed.
 *
 * @specfield target : AbstractGizmo // the gizmo that this trigger
 *             			     // triggers
 * 
 * @author <a href="mailto:drkp@mit.edu">Dan R. K. Ports</a>
 * @version $Id: AbstractTrigger.java,v 1.4 2004/04/24 16:38:26 dan Exp $
 */
public abstract class AbstractTrigger {
    // TODO: make Trigger extend Propertified?
    private AbstractGizmo target;
    
    public AbstractTrigger(AbstractGizmo target) {
        this.target = target;
    } // AbstractTrigger constructor


    /**
     * Gets the value of target
     *
     * @return the value of target
     */
    public AbstractGizmo getTarget()  {
        return this.target;
    }

    /**
     * Sets the value of target
     *
     * @param argTarget Value to assign to this.target
     */
    public void setTarget(AbstractGizmo argTarget) {
        this.target = argTarget;
    }


    /**
     * Fires the trigger.
     *
     * @effects target is triggered
     */
    public void fire() {
        target.fireTrigger(this);
    }
    
    
} // AbstractTrigger
