|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gecco.server.actionprocessor.ActionProcessor
The action processor handles the scheduling and execution of actions for the units in the ongoing game.
Field Summary |
Fields inherited from interface gecco.util.SignalRunnable |
SIGKILL, SIGNONE, SIGPAUSE, SIGQUIT, SIGRESUME |
Constructor Summary | |
ActionProcessor()
Constructor for the ActionProcessor object |
Method Summary | |
boolean |
abortAction(String fromRole,
int actionHandle)
Aborts an ongoing action for a unit. |
void |
continueGame()
|
void |
executeInstantaneousAction(Action action)
Executes an instantaneous action. |
Action |
getAction(String role,
int actionHandle)
Gets the action with the given handle ordered by the given role. |
TreeSet |
getActionQueue()
Returns the TreeSet object which is the queue that holds
the current scheduled actions for the units in the game. |
void |
handleAutomatonUnitEvent(int x,
int y,
UnitEvent unitEvent)
This method handles an incoming UnitEvent coming from the
automaton-layer, most probably due to a change of state in the automaton
at position (x, y). |
void |
handleUnitToUnitEvent(Unit unit,
UnitEvent unitEvent)
This method handles an incoming UnitEvent which originates from another unit in the game. |
void |
initiateAction(String fromRole,
Action action)
Initiates an action for a unit. |
void |
publicCheckActionBlocklist(Unit u)
|
void |
publicCheckChangedPosition(double oldx,
double oldy,
Unit u)
|
void |
publicCheckChangedProperties(Unit u)
|
void |
run()
Main processing method for the execution of actions. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ActionProcessor()
Method Detail |
public TreeSet getActionQueue()
TreeSet
object which is the queue that holds
the current scheduled actions for the units in the game. This method is
primarily used when another thread wants to synchronize on the queue
object, preventing any other thread to add a new action to the queue.
public Action getAction(String role, int actionHandle)
public void initiateAction(String fromRole, Action action)
fromRole
- The commanding role which initiated the action.action
- The Action class itself.public void executeInstantaneousAction(Action action)
checkPoint()
method in the action class.
action
- The class representing the instantaneous action.public void handleAutomatonUnitEvent(int x, int y, UnitEvent unitEvent)
UnitEvent
coming from the
automaton-layer, most probably due to a change of state in the automaton
at position (x, y).
x
- The x-coordinate of the automaton.y
- The y-coordinate of the automaton.unitEvent
- The UnitEvent class.public void handleUnitToUnitEvent(Unit unit, UnitEvent unitEvent)
unit
- The affected unit.unitEvent
- The UnitEvent class.public boolean abortAction(String fromRole, int actionHandle)
fromRole
- The commanding roleactionHandle
- The actionHandle
true
if the action was found and
removed, false
otherwise.public void run()
run
in interface Runnable
public void publicCheckChangedProperties(Unit u)
public void publicCheckActionBlocklist(Unit u)
public void publicCheckChangedPosition(double oldx, double oldy, Unit u)
public void continueGame()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |