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

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.core;

/**
 *  An instance of this class should be returned from action handlers to
 *  indicate that the action is not finished and that the handler should be
 *  called again after a specified amount of time.
 *
 * @author     Henrik Bäärnhielm, Karl Hasselström, Henrik Hägerström
 * @created    April 30, 2001
 */
public class ActionReturnRequeue extends ActionReturn {

    /**
     *  Description of the Field
     */
    private long timeToWakeup;


    /**
     *  Constructor for the ActionReturnRequeue object
     *
     * @param  _timeToWakeup  Milliseconds until next call to handler.
     */
    public ActionReturnRequeue(double _timeToWakeup) {
        timeToWakeup = Math.round(_timeToWakeup * 1000);
    }


    /**
     *  Constructor for the ActionReturnRequeue object
     *
     * @param  _timeToWakeup  Milliseconds until next call to handler.
     * @param  unitMessage    Return message from handler.
     */
    public ActionReturnRequeue(double _timeToWakeup, String unitMessage) {
        timeToWakeup = Math.round(_timeToWakeup * 1000);
        super.unitMessage = unitMessage;
    }


    /**
     *  Gets the number of milliseconds until next call to handler.
     *
     * @return    Milliseconds until next call to handler.
     */
    public long getTimeToWakeup() {
        return timeToWakeup;
    }

}
