gecco.server.actionprocessor
Class QueuedAction

java.lang.Object
  |
  +--gecco.server.actionprocessor.QueuedAction
All Implemented Interfaces:
Comparable

public class QueuedAction
extends Object
implements Comparable

This class is a wrapper object that is stored in the priority queue in the ActionProcessor.

Author:
Karl Hasselström, Henrik Hägerström

Constructor Summary
QueuedAction(String fromRole, Action action, double timeToExecute)
          Creates a QueuedAction object.
 
Method Summary
 int compareTo(Object a)
          Compares this object with the specified object for order.
 boolean equals(Object other)
          Indicates whether some other object is "equal to" this one.
 Action getAction()
          Gets the Action attribute of the QueuedAction object.
 String getFromRole()
          Gets the FromRole attribute of the QueuedAction object.
 double getTimeToExecute()
          Gets the TimeToExecute attribute of the QueuedAction object.
 void setTimeToExecute(double newTimeToExecute)
          Sets the TimeToExecute attribute of the QueuedAction object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueuedAction

public QueuedAction(String fromRole,
                    Action action,
                    double timeToExecute)
Creates a QueuedAction object.
Parameters:
fromRole - The commanding role.
action - The action to be executed.
timeToExecute - The time when the next checkpoint will be executed.
Method Detail

setTimeToExecute

public void setTimeToExecute(double newTimeToExecute)
Sets the TimeToExecute attribute of the QueuedAction object.
Parameters:
newTimeToExecute - The new TimeToExecute value.

getAction

public Action getAction()
Gets the Action attribute of the QueuedAction object.
Returns:
The Action value.

getFromRole

public String getFromRole()
Gets the FromRole attribute of the QueuedAction object.
Returns:
The FromRole value.

getTimeToExecute

public double getTimeToExecute()
Gets the TimeToExecute attribute of the QueuedAction object.
Returns:
The TimeToExecute value.

equals

public boolean equals(Object other)
Indicates whether some other object is "equal to" this one.
Overrides:
equals in class Object
Parameters:
other - The other object.
Returns:
true if this object is the same as the obj argument; false otherwise.

compareTo

public int compareTo(Object a)
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
Specified by:
compareTo in interface Comparable
Parameters:
other - The other object.
Returns:
A negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.