/***********************************************************************

GECCO, a platform for command and control gaming

Copyright (C) 2001 Henrik Bäärnhielm, Andreas Enblom, Niklas
Hallenfur, Karl Hasselström, Henrik Hägerström, Oskar Linde, Jing Fu
Zi and Jon Åslund

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at
your option) any later version.

This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA.

***********************************************************************/

package gecco.server.actsofgod;

import gecco.server.automaton.*;

/**
 *  Description of the Class
 *
 * @author     Karl Hasselström
 * @created    June 27, 2001
 */
class Act implements Comparable {
    // The act to be carried out
    /**
     *  Description of the Field
     */
    private AutomatonEvent theAct;

    // The time to do it, in the format returned by
    // System.currentTimeMillis()
    /**
     *  Description of the Field
     */
    private long time;

    // The place of the deed.
    /**
     *  Description of the Field
     */
    private double x, y;


    /**
     *  Constructor for the Act object
     *
     * @param  ae    Description of Parameter
     * @param  x     Description of Parameter
     * @param  y     Description of Parameter
     * @param  time  Description of Parameter
     */
    public Act(AutomatonEvent ae, double x, double y, long time) {
        this.x = x;
        this.y = y;
        this.time = time;
        theAct = ae;
    }


    /**
     *  Gets the X attribute of the Act object
     *
     * @return    The X value
     */
    public double getX() {
        return x;
    }


    /**
     *  Gets the Y attribute of the Act object
     *
     * @return    The Y value
     */
    public double getY() {
        return y;
    }


    /**
     *  Gets the Time attribute of the Act object
     *
     * @return    The Time value
     */
    public long getTime() {
        return time;
    }


    /**
     *  Gets the Act attribute of the Act object
     *
     * @return    The Act value
     */
    public AutomatonEvent getAct() {
        return theAct;
    }


    /**
     *  Description of the Method
     *
     * @param  o  Description of Parameter
     * @return    Description of the Returned Value
     */
    public int compareTo(Object o) {
        // Cast to the correct type, generating a ClassCastException
        // if someone tries to compare an Act to something else.
        Act other = (Act) o;

        // The value returned is 0 if the times are equal, less than
        // zero if this time is earlier, and greater than zero if this
        // time is later.
        return (int) (this.time - other.time);
    }
}
