Jadex 0.96-beta1

jadex.runtime
Class JavaMobilePlanExecutor

java.lang.Object
  extended by jadex.runtime.JavaMobilePlanExecutor
All Implemented Interfaces:
IPlanExecutor, Serializable

public class JavaMobilePlanExecutor
extends Object
implements IPlanExecutor, Serializable

A plan executor for JADE-behaviour style plans (with action method called for each step). Plan bodies have to inherit from @link{MobilePlan}.

See Also:
Serialized Form

Constructor Summary
JavaMobilePlanExecutor()
          Create a new threadbased plan executor.
 
Method Summary
 void cleanup(jadex.runtime.impl.RPlan rplan)
          Called on termination of a plan.
 Object createPlanBody(jadex.runtime.impl.RPlan plan)
          Create the body of a plan.
 jadex.runtime.impl.IREvent eventWaitFor(jadex.runtime.impl.RPlan rplan, jadex.runtime.impl.WaitAbstraction wa)
          Block a plan until an event matching the wait abstraction occurs.
 boolean executeAbortedStep(jadex.runtime.impl.RPlan plan)
          Execute a step of the plans aborted() code.
 boolean executeFailedStep(jadex.runtime.impl.RPlan plan)
          Execute a step of the plans failed() code.
 boolean executePassedStep(jadex.runtime.impl.RPlan plan)
          Execute a step of the plans passed() code.
 boolean executePlanStep(jadex.runtime.impl.RPlan plan)
          Execute a step of a plan.
 Thread getExecutionThread(jadex.runtime.impl.RPlan rplan)
          Get the executing thread of a plan.
 void interruptPlanStep(jadex.runtime.impl.RPlan plan)
          Interrupt a plan step during execution.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaMobilePlanExecutor

public JavaMobilePlanExecutor()
Create a new threadbased plan executor.

Method Detail

createPlanBody

public Object createPlanBody(jadex.runtime.impl.RPlan plan)
                      throws Exception
Create the body of a plan.

Specified by:
createPlanBody in interface IPlanExecutor
Parameters:
plan - The plan.
Returns:
The created body. May throw any kind of exception, when the body creation fails
Throws:
Exception

executePlanStep

public boolean executePlanStep(jadex.runtime.impl.RPlan plan)
                        throws Exception
Execute a step of a plan. Executing a step should cause the latest event to be handled. Will be called by the scheduler for every event to be handled. May throw any kind of exception, when the plan execution fails

Specified by:
executePlanStep in interface IPlanExecutor
Returns:
True, if plan was interrupted (micro plan step).
Throws:
Exception

executePassedStep

public boolean executePassedStep(jadex.runtime.impl.RPlan plan)
                          throws Exception
Execute a step of the plans passed() code. This method is called, after the plan has finished successfully (i.e. without exception). Will be called by the scheduler for the first time and every subsequent event to be handled. May throw any kind of exception, when the execution fails

Specified by:
executePassedStep in interface IPlanExecutor
Returns:
True, if execution was interrupted (micro plan step).
Throws:
Exception

executeFailedStep

public boolean executeFailedStep(jadex.runtime.impl.RPlan plan)
                          throws Exception
Execute a step of the plans failed() code. This method is called, when the plan has failed (i.e. due to an exception occurring in the plan body). Will be called by the scheduler for the first time and every subsequent event to be handled. May throw any kind of exception, when the execution fails

Specified by:
executeFailedStep in interface IPlanExecutor
Returns:
True, if execution was interrupted (micro plan step).
Throws:
Exception

executeAbortedStep

public boolean executeAbortedStep(jadex.runtime.impl.RPlan plan)
                           throws Exception
Execute a step of the plans aborted() code. This method is called, when the plan is terminated from the outside (e.g. when the corresponding goal is dropped or the context condition of the plan becomes invalid) Will be called by the scheduler for the first time and every subsequent event to be handled. May throw any kind of exception, when the execution fails

Specified by:
executeAbortedStep in interface IPlanExecutor
Returns:
True, if execution was interrupted (micro plan step).
Throws:
Exception

interruptPlanStep

public void interruptPlanStep(jadex.runtime.impl.RPlan plan)
Interrupt a plan step during execution. The plan is requested to stop the execution to allow consequences of performed plan actions (like belief changes) taking place. If the method is not implemented the plan step will be NOT be interrupted.

Specified by:
interruptPlanStep in interface IPlanExecutor

cleanup

public void cleanup(jadex.runtime.impl.RPlan rplan)
Called on termination of a plan. Free all associated ressources, stop threads, etc.

Specified by:
cleanup in interface IPlanExecutor

getExecutionThread

public Thread getExecutionThread(jadex.runtime.impl.RPlan rplan)
Get the executing thread of a plan.

Specified by:
getExecutionThread in interface IPlanExecutor
Parameters:
rplan - The plan.
Returns:
The executing thread (if any).

eventWaitFor

public jadex.runtime.impl.IREvent eventWaitFor(jadex.runtime.impl.RPlan rplan,
                                               jadex.runtime.impl.WaitAbstraction wa)
Block a plan until an event matching the wait abstraction occurs. Only used for standard plans, which block during execution.

Specified by:
eventWaitFor in interface IPlanExecutor

Jadex 0.96-beta1

Submit a bug or feature
For further API reference and developer documentation, see the Jadex User Guide and the Jadex Tutorial. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, and working code examples.

Copyright (C) 2002-2007 Lars Braubach, Alexander Pokahr - University of Hamburg. Use is subject to license terms.