com.evelopers.unimod.runtime.interpretation
Class ActionExecutor

java.lang.Object
  extended bycom.evelopers.unimod.runtime.interpretation.ActionExecutor

class ActionExecutor
extends java.lang.Object

Knows how to excecute given Action against given context. Supports two types of Action return type - int and boolean.


Constructor Summary
ActionExecutor(ControlledObjectsMap controlledObjectsMap)
           
 
Method Summary
protected  java.lang.Object _execute(Action action, StateMachineContext context)
          This executes given action.
 void execute(Action action, StateMachineContext context)
          Executes action against given context, ignoring return type.
 boolean executeBool(Action action, StateMachineContext context)
          Executes action against given context, treating return type as boolean.
 int executeNum(Action action, StateMachineContext context)
          Executes action against given context, treating return type as int.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActionExecutor

public ActionExecutor(ControlledObjectsMap controlledObjectsMap)
Method Detail

_execute

protected java.lang.Object _execute(Action action,
                                    StateMachineContext context)
                             throws com.evelopers.common.exception.SystemException
This executes given action.

Controlled object handler of the action is used only to find controlled object's name. To get real controlled object instance this method uses ControlledObjectsMap passed to constructor.

Parameters:
action - action to execute
context - action context
Returns:
return-value of the action
Throws:
com.evelopers.common.exception.SystemException - if action couldn't be executed or have thrown exception

execute

public void execute(Action action,
                    StateMachineContext context)
             throws EventProcessorException
Executes action against given context, ignoring return type.

Parameters:
action - action to execute
context - state machine runtime context
Throws:
EventProcessorException - if error while executing occurs

executeNum

public int executeNum(Action action,
                      StateMachineContext context)
               throws InterpreterException
Executes action against given context, treating return type as int.

Parameters:
action - action to execute
context - state machine runtime context
Returns:
usually 0 as false and 1 as true. Returned values of input actions only will be taken into account by runtime interpretter.
Throws:
InterpreterException - if error while executing occurs or return type is not int.

executeBool

public boolean executeBool(Action action,
                           StateMachineContext context)
                    throws InterpreterException
Executes action against given context, treating return type as boolean.

Parameters:
action - action to execute
context - state machine runtime context
Returns:
boolean
Throws:
InterpreterException - if error while executing occurs or return type is not boolean.