public abstract class AbstractPlanBody extends jade.core.behaviours.Behaviour implements PlanBody
PlanBody
interface. It represents a plan that has been instantiated to be executed.| Constructor and Description |
|---|
AbstractPlanBody()
Creates a new plan body.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
dispatchGoal(Goal goal)
Dispatches a goal to be achieved.
|
boolean |
dispatchSubgoal(Goal subgoal)
Dispatches a subgoal to be achieved.
|
boolean |
dispatchSubgoalAndListen(Goal subgoal)
Dispatches a subgoal to be achieved and registers itself as a listener to
receive a notification of the end of execution of the goal.
|
boolean |
done()
Indicates to the JADE platform that this behavior/plan body finished its
execution.
|
BeliefBase |
getBeliefBase()
Returns the belief base of the capability associated with the plan of
this plan body.
|
Capability |
getCapability()
Returns the capability associated with the plan of this plan body.
|
Plan.EndState |
getEndState()
Returns the end state of plan.
|
Goal |
getGoal()
Returns the goal to be achieved by this plan instance.
|
GoalEvent |
getGoalEvent()
Returns a goal event from the queue.
|
GoalEvent |
getGoalEvent(boolean block)
Returns a goal event from the queue.
|
GoalEvent |
getGoalEvent(long ms)
Returns a goal event from the queue.
|
Plan |
getPlan()
Returns the
Plan that is associated with this plan body. |
void |
goalPerformed(GoalEvent event)
Receives the notification that a goal event has occurred.
|
void |
init(Plan plan,
Intention intention)
Initializes this plan body.
|
protected void |
setEndState(Plan.EndState endState)
Sets the end state of plan.
|
void |
start()
Starts the plan body, by adding it as to the agent as a
Behaviour
. |
void |
stop()
Stops the plan body execution.
|
action, actionWrapper, block, block, getAgent, getBehaviourName, getDataStore, getExecutionState, getParent, getRestartCounter, handle, handleBlockEvent, handleRestartEvent, isRunnable, onEnd, onStart, reset, restart, root, setAgent, setBehaviourName, setDataStore, setExecutionStatepublic boolean dispatchGoal(Goal goal)
PlanBodydispatchGoal in interface PlanBodygoal - the goal to be dispatched.PlanBody.dispatchGoal(Goal)public boolean dispatchSubgoal(Goal subgoal)
PlanBodydispatchSubgoal in interface PlanBodysubgoal - the subgoal to be dispatched.PlanBody.dispatchSubgoal(Goal)public boolean dispatchSubgoalAndListen(Goal subgoal)
PlanBodydispatchSubgoalAndListen in interface PlanBodysubgoal - the subgoal to be dispatched.PlanBody.dispatchSubgoalAndListen(Goal)public final boolean done()
getEndState() returns null, it returns false, as
the plan body has not reached a final state. It returns true otherwise.done in class jade.core.behaviours.BehaviourgetEndState() returns null, true otherwise.Behaviour.done()public BeliefBase getBeliefBase()
PlanBodygetBeliefBase in interface PlanBodyPlanBody.getBeliefBase()public Capability getCapability()
PlanBodygetCapability in interface PlanBodyPlanBody.getCapability()public Plan.EndState getEndState()
getEndState in interface PlanBodypublic final Goal getGoal()
public GoalEvent getGoalEvent()
getGoalEvent in interface PlanBodypublic GoalEvent getGoalEvent(boolean block)
getGoalEvent in interface PlanBodyblock - true if the plan body must be blocked if the queue is empty.public GoalEvent getGoalEvent(long ms)
getGoalEvent in interface PlanBodyms - the maximum amount of time that the behavior must be blocked.public void goalPerformed(GoalEvent event)
getGoalEvent() method, and restarts
the plan body execution.goalPerformed in interface GoalListenerevent - the goal event that occurred.GoalListener.goalPerformed(bdi4jade.event.GoalEvent)public final void init(Plan plan, Intention intention) throws PlanInstantiationException
Plan) and an Intention. If this plan body has
already been initialized, this method throws a
PlanInstantiationException. It also sets up the plan input
parameters based on the goal input parameters.init in interface PlanBodyplan - the plan associated this this plan body.intention - the intention that this plan instance have to achieve.PlanInstantiationException - if this plan body has already been initialized.protected final void setEndState(Plan.EndState endState)
OutputPlanBody interface (this is invoked only once), or sets up
the goal inputs parameters based on the plan body output parameters. If
an error occurs during this setting process, a warn is shown, but no
exception is thrown.
If the plan body has come to an end state, it drops all subgoals, in case
they are still trying to be achieved.endState - the endState to set.public final void start()
Behaviour
.public final void stop()
DisposablePlanBody, it invokes the method to
about the plan body, so it can perform finalizations.