public interface PlanBody extends GoalListener
Plan, which in turn specifies different
properties such as the goals that a plan can achieve or messages it can
process. When a plan should be executed, a plan body is instantiated and run.
A plan body is a GoalListener as it may dispatch goals during its
execution and be notified when it is achieved (or learn it is not possible to
achieve it).| Modifier and Type | Method and Description |
|---|---|
void |
dispatchGoal(Goal goal)
Dispatches a goal to be achieved.
|
void |
dispatchProtectedGoal(Goal goal)
Dispatches a goal to be achieved, using the capability (or its children
capabilities) associated with the plan.
|
void |
dispatchProtectedSubgoal(Goal subgoal)
Dispatches a subgoal to be achieved, using the capability (or its
children capabilities) associated with the plan.
|
void |
dispatchProtectedSubgoalAndListen(Goal subgoal)
Dispatches a subgoal to be achieved, using the capability (or its
children capabilities) associated with the plan, and registers itself as
a listener to receive a notification of the end of execution of the goal.
|
void |
dispatchSubgoal(Goal subgoal)
Dispatches a subgoal to be achieved.
|
void |
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.
|
BeliefBase |
getBeliefBase()
Returns the belief base of the capability associated with the plan of
this plan body.
|
Plan.EndState |
getEndState()
Returns the end state of the execution of this plan.
|
Goal |
getGoal()
Returns the goal to be achieved by this plan body.
|
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 instance. |
void |
init(Plan plan,
Intention intention)
Initializes this plan body.
|
int |
onEnd()
This method is invoked just once after this behaviour has ended.
|
void |
onStart()
This method is executed just once before starting this plan body
execution.
|
void |
reset()
Restores plan body initial state.
|
void |
start()
Starts the execution of a plan body, a
Behaviour, associated with
this plan. |
void |
stop()
Stops the plan body, a
Behaviour, associated with this plan. |
goalPerformedvoid dispatchGoal(Goal goal)
goal - the goal to be dispatched.void dispatchProtectedGoal(Goal goal)
goal - the goal to be dispatched.void dispatchProtectedSubgoal(Goal subgoal)
subgoal - the subgoal to be dispatched.void dispatchProtectedSubgoalAndListen(Goal subgoal)
subgoal - the subgoal to be dispatched.void dispatchSubgoal(Goal subgoal)
subgoal - the subgoal to be dispatched.void dispatchSubgoalAndListen(Goal subgoal)
subgoal - the subgoal to be dispatched.BeliefBase getBeliefBase()
Plan.EndState getEndState()
Goal getGoal()
GoalEvent getGoalEvent()
GoalEvent getGoalEvent(boolean block)
block - true if the behavior must be blocked if the queue is empty.GoalEvent getGoalEvent(long ms)
ms - the maximum amount of time that the behavior must be blocked.Plan getPlan()
Plan that is associated with this plan instance.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.plan - 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.int onEnd()
Behaviour.onEnd(),
Behaviour.onEnd()void onStart()
Behaviour.onStart()void reset()
Behaviour.reset()void start()
Behaviour, associated with
this plan.void stop()
Behaviour, associated with this plan. If
the body implements the DisposablePlanBody, it invokes the method
to about the plan body, so it can perform finalizations.