nl.tudelft.goal.ut2004.actions
Class Action

Package class diagram package Action
java.lang.Object
  extended by nl.tudelft.goal.ut2004.actions.Action
Direct Known Subclasses:
Combo, Continue, DropWeapon, Look, Navigate, Prefer, Respawn, Shoot, Stop, StopShooting

public abstract class Action
extends Object

Basic class for actions executed by the UT2004BotBehavior. Before actions are executed they are are queued up in the ActionQueue. To ensure the queue does not overflow the ActionQueue checks which actions can replace other actions in the queue and if this action would have any effect. Actions can be replaced when executing this action after them would have no effect. This is indicated by using the setReplaces(Class...) method. Actions have no effect if there is an action in the queue which prevents this action from having any effect. this is indicated by using the setBlockedBy(Class...) .


Constructor Summary
Action()
           
 
Method Summary
abstract  void execute()
           
 boolean hasEffect(Action action)
          Returns true if executing the argument action does not impede the execution of this action.
 boolean replaces(Action action)
          Returns true if executing the argument action before this action will have no effect.
 void setBlockedBy(Class<? extends Action>... blocks)
          Sets which actions will prevent this action from having any effect if executed after them.
 void setReplaces(Class<? extends Action>... replaces)
          Sets which actions will have no effect if this action is executed after them.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Action

public Action()
Method Detail

execute

public abstract void execute()
                      throws cz.cuni.amis.utils.exception.PogamutException
Throws:
cz.cuni.amis.utils.exception.PogamutException

setReplaces

public void setReplaces(Class<? extends Action>... replaces)
Sets which actions will have no effect if this action is executed after them.

Parameters:
replaces -

replaces

public boolean replaces(Action action)
Returns true if executing the argument action before this action will have no effect. This action overrides all effects of the argument action.

Parameters:
action -
Returns:

setBlockedBy

public void setBlockedBy(Class<? extends Action>... blocks)
Sets which actions will prevent this action from having any effect if executed after them.

Parameters:
blocks -

hasEffect

public boolean hasEffect(Action action)
Returns true if executing the argument action does not impede the execution of this action. When false executing this action after the argument action will have no effect.

Parameters:
action -
Returns:


Copyright © 2013 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.