Jadex 0.96-beta1

jadex.runtime
Class AbstractPlan

java.lang.Object
  extended by jadex.runtime.AbstractPlan
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
MobilePlan, Plan

public abstract class AbstractPlan
extends Object
implements Serializable

The abstract plan is the abstract superclass for standard plans and mobile plans.

See Also:
Serialized Form

Constructor Summary
AbstractPlan()
          Create a new plan.
 
Method Summary
 void addPlanListener(IPlanListener listener, boolean async)
          Add a plan listener.
 ICondition createCondition(String expression)
          Create a condition, that is triggered whenever the expression value changes to true.
 ICondition createCondition(String expression, String trigger, String[] paramnames, Class[] paramtypes)
          Create a condition.
 IExpression createExpression(String expression)
          Create a precompiled expression.
 IExpression createExpression(String expression, String[] paramnames, Class[] paramtypes)
          Create a precompiled expression.
 IGoal createGoal(String type)
          Create a goal from a template goal.
 IInternalEvent createInternalEvent(String type)
          Create a new intenal event.
 IInternalEvent createInternalEvent(String type, Object content)
          Deprecated. Convenience method for easy conversion to new explicit internal events. Will be removed in later releases.
 IMessageEvent createMessageEvent(String type)
          Create a new message event.
 IExpression createQuery(String query)
          Deprecated. Use @link{#createExpression(String)} instead.
 void dispatchInternalEvent(IInternalEvent event)
          Dispatch an internal event.
 IFilter dispatchSubgoal(IGoal subgoal)
          Dispatch a new subgoal.
 void dispatchTopLevelGoal(IGoal goal)
          Dispatch a new top-level goal.
 void endAtomic()
          End an atomic transaction.
 void fail()
          Let a plan fail.
 void fail(String message, Throwable cause)
          Let a plan fail.
 void fail(Throwable cause)
          Let a plan fail.
 BasicAgentIdentifier getAgentIdentifier()
          Get the agent identifier.
 String getAgentName()
          Get the agent name.
 IBeliefbase getBeliefbase()
          Get the belief base.
 ICondition getCondition(String name)
          Get a condition predefined in the ADF.
 IEventbase getEventbase()
          Get the event base.
 Exception getException()
          Get the uncatched exception that occurred in the body (if any).
 IExpression getExpression(String name)
          Get an instance of a predefined expression.
 IExpressionbase getExpressionbase()
          Get the expression base.
 IExternalAccess getExternalAccess()
          Get the scope.
 IGoalbase getGoalbase()
          Get the goal base.
 Logger getLogger()
          Get the logger.
 String getName()
          Get the name.
 IParameter getParameter(String name)
          Get a parameter.
 IParameter[] getParameters()
          Get all parameters.
 IParameterSet getParameterSet(String name)
          Get a parameter.
 IParameterSet[] getParameterSets()
          Get all parameter sets.
 IPlanbase getPlanbase()
          Get the plan base.
 IPropertybase getPropertybase()
          Get the property base.
 IExpression getQuery(String name)
          Deprecated. Use @link{#getExpression(String)} instead.
 IProcessGoal getRootGoal()
          Deprecated.  
 jadex.runtime.impl.RPlan getRPlan()
          Get the plan instance info.
 ICapability getScope()
          Get the scope.
 IWaitqueue getWaitqueue()
          Get the waitqueue.
 boolean hasParameter(String name)
          Has the element a parameter element.
 boolean hasParameterSet(String name)
          Has the element a parameter set element.
 boolean isAbortedOnSuccess()
          Check if the corresponding plan was aborted because the proprietary goal succeeded during the plan was running.
 void killAgent()
          Kill this agent.
 void removePlanListener(IPlanListener listener)
          Remove a plan listener.
 IFilter sendMessage(IMessageEvent me)
          Send a message after some delay.
 void startAtomic()
          Start an atomic transaction.
 String toString()
          Get the string representation.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractPlan

public AbstractPlan()
Create a new plan.

Method Detail

fail

public void fail()
Let a plan fail.


fail

public void fail(Throwable cause)
Let a plan fail.

Parameters:
cause - The cause.

fail

public void fail(String message,
                 Throwable cause)
Let a plan fail.

Parameters:
message - The message.
cause - The cause.

getScope

public ICapability getScope()
Get the scope.

Returns:
The scope.

getLogger

public Logger getLogger()
Get the logger.

Returns:
The logger.

startAtomic

public void startAtomic()
Start an atomic transaction. All possible side-effects (i.e. triggered conditions) of internal changes (e.g. belief changes) will be delayed and evaluated after endAtomic() has been called.

See Also:
endAtomic()

endAtomic

public void endAtomic()
End an atomic transaction. Side-effects (i.e. triggered conditions) of all internal changes (e.g. belief changes) performed after the last call to startAtomic() will now be evaluated and performed.

See Also:
startAtomic()

dispatchSubgoal

public IFilter dispatchSubgoal(IGoal subgoal)
Dispatch a new subgoal.

Parameters:
subgoal - The new subgoal.
Returns:
The eventfilter for identifying the result event. Note: plan step is interrupted after call.

getName

public String getName()
Get the name.

Returns:
The name of the plan.

getRootGoal

public IProcessGoal getRootGoal()
Deprecated. 

todo: remove Get the plans root goal.

Returns:
The goal.

getWaitqueue

public IWaitqueue getWaitqueue()
Get the waitqueue.

Returns:
The waitqueue.

toString

public String toString()
Get the string representation.

Overrides:
toString in class Object
Returns:
The string representation.

getAgentName

public String getAgentName()
Get the agent name.

Returns:
The agent name.

getAgentIdentifier

public BasicAgentIdentifier getAgentIdentifier()
Get the agent identifier.

Returns:
The agent identifier.

isAbortedOnSuccess

public boolean isAbortedOnSuccess()
Check if the corresponding plan was aborted because the proprietary goal succeeded during the plan was running.

Returns:
True, if the goal was aborted on success of the proprietary goal.

getException

public Exception getException()
Get the uncatched exception that occurred in the body (if any). Method should be called when in failed() method.

Returns:
The exception.

killAgent

public void killAgent()
Kill this agent.


getBeliefbase

public IBeliefbase getBeliefbase()
Get the belief base.

Returns:
The belief base.

getGoalbase

public IGoalbase getGoalbase()
Get the goal base.

Returns:
The goal base.

getPlanbase

public IPlanbase getPlanbase()
Get the plan base.

Returns:
The plan base.

getEventbase

public IEventbase getEventbase()
Get the event base.

Returns:
The event base.

getExpressionbase

public IExpressionbase getExpressionbase()
Get the expression base.

Returns:
The expression base.

getPropertybase

public IPropertybase getPropertybase()
Get the property base.

Returns:
The property base.

dispatchTopLevelGoal

public void dispatchTopLevelGoal(IGoal goal)
Dispatch a new top-level goal.

Parameters:
goal - The new goal. Note: plan step is interrupted after call.

createGoal

public IGoal createGoal(String type)
Create a goal from a template goal. To be processed, the goal has to be dispatched as subgoal or adopted as top-level goal.

Parameters:
type - The template goal name as specified in the ADF.
Returns:
The created goal.

sendMessage

public IFilter sendMessage(IMessageEvent me)
Send a message after some delay.

Parameters:
me - The message event.
Returns:
The filter to wait for an answer.

dispatchInternalEvent

public void dispatchInternalEvent(IInternalEvent event)
Dispatch an internal event.

Parameters:
event - The event. Note: plan step is interrupted after call.

createMessageEvent

public IMessageEvent createMessageEvent(String type)
Create a new message event.

Returns:
The new message event.

createInternalEvent

public IInternalEvent createInternalEvent(String type)
Create a new intenal event.

Returns:
The new intenal event.

createInternalEvent

public IInternalEvent createInternalEvent(String type,
                                          Object content)
Deprecated. Convenience method for easy conversion to new explicit internal events. Will be removed in later releases.

Create a new intenal event.

Returns:
The new intenal event.

getExternalAccess

public IExternalAccess getExternalAccess()
Get the scope.

Returns:
The scope.

getQuery

public IExpression getQuery(String name)
Deprecated. Use @link{#getExpression(String)} instead.

Get a query created from a predefined expression.

Parameters:
name - The name of an expression defined in the ADF.
Returns:
The query object.

getExpression

public IExpression getExpression(String name)
Get an instance of a predefined expression.

Parameters:
name - The name of an expression defined in the ADF.
Returns:
The expression instance.

getCondition

public ICondition getCondition(String name)
Get a condition predefined in the ADF. Note that a new condition instance is returned each time this method is called.

Parameters:
name - The name of a condition defined in the ADF.
Returns:
The condition object.

createQuery

public IExpression createQuery(String query)
Deprecated. Use @link{#createExpression(String)} instead.

Create a precompiled query.

Parameters:
query - The query string.
Returns:
The precompiled query.

createExpression

public IExpression createExpression(String expression)
Create a precompiled expression.

Parameters:
expression - The expression string.
Returns:
The precompiled expression.

createExpression

public IExpression createExpression(String expression,
                                    String[] paramnames,
                                    Class[] paramtypes)
Create a precompiled expression.

Parameters:
expression - The expression string.
Returns:
The precompiled expression.

createCondition

public ICondition createCondition(String expression)
Create a condition, that is triggered whenever the expression value changes to true.

Parameters:
expression - The condition expression.
Returns:
The condition.

createCondition

public ICondition createCondition(String expression,
                                  String trigger,
                                  String[] paramnames,
                                  Class[] paramtypes)
Create a condition.

Parameters:
expression - The condition expression.
trigger - The condition trigger.
Returns:
The condition.

getParameters

public IParameter[] getParameters()
Get all parameters.

Returns:
All parameters.

getParameterSets

public IParameterSet[] getParameterSets()
Get all parameter sets.

Returns:
All parameter sets.

getParameter

public IParameter getParameter(String name)
Get a parameter.

Parameters:
name - The name.
Returns:
The parameter.

getParameterSet

public IParameterSet getParameterSet(String name)
Get a parameter.

Parameters:
name - The name.
Returns:
The parameter set.

hasParameter

public boolean hasParameter(String name)
Has the element a parameter element.

Parameters:
name - The name.
Returns:
True, if it has the parameter.

hasParameterSet

public boolean hasParameterSet(String name)
Has the element a parameter set element.

Parameters:
name - The name.
Returns:
True, if it has the parameter set.

getRPlan

public jadex.runtime.impl.RPlan getRPlan()
Get the plan instance info.

Returns:
The plan instance info.

addPlanListener

public void addPlanListener(IPlanListener listener,
                            boolean async)
Add a plan listener.

Parameters:
listener - The plan listener.
async - True, if the notification should be done on a separate thread.

removePlanListener

public void removePlanListener(IPlanListener listener)
Remove a plan listener.

Parameters:
listener - The plan listener.

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.