|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectbr.pucrio.inf.les.bdijade.plan.PlanInstance
public class PlanInstance
This class represents a plan that has been instantiated to be executed, with an associated plan body (a behavior).
| Nested Class Summary | |
|---|---|
static class |
PlanInstance.EndState
This enumuration represents the possible end states of a plan execution. |
| Field Summary | |
|---|---|
private jade.core.behaviours.Behaviour |
behaviour
|
private PlanInstance.EndState |
endState
|
private java.util.List<GoalFinishedEvent> |
goalEventQueue
|
private Intention |
intention
|
private Plan |
plan
|
private java.util.List<Goal> |
subgoals
|
| Constructor Summary | |
|---|---|
PlanInstance(Plan plan,
Intention intention)
Creates a new plan instance. |
|
| Method Summary | |
|---|---|
void |
dispatchGoal(Goal goal)
Dispatches a goal to be achieved. |
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. |
private void |
dropSubgoals()
Drops all current subgoals dispatched by this plan. |
BeliefBase |
getBeliefBase()
Returns the belief base of the capability. |
PlanInstance.EndState |
getEndState()
Returns the end state of plan. |
Goal |
getGoal()
Returns the goal to be achieved by this plan instance. |
GoalFinishedEvent |
getGoalEvent()
Returns a goal event from the queue. |
GoalFinishedEvent |
getGoalEvent(boolean block)
Returns a goal event from the queue. |
private GoalFinishedEvent |
getGoalEvent(boolean block,
long ms)
Returns a goal event from the queue. |
GoalFinishedEvent |
getGoalEvent(long ms)
Returns a goal event from the queue. |
Plan |
getPlan()
Returns the Plan that is associated with this plan instance. |
void |
goalPerformed(GoalEvent event)
Notifies the listener that the goal was performed. |
void |
startPlan()
Starts the plan body, a Behaviour, associated with this plan. |
void |
stopPlan()
Stops the plan body, a Behaviour, associated with this plan. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private final jade.core.behaviours.Behaviour behaviour
private PlanInstance.EndState endState
private final java.util.List<GoalFinishedEvent> goalEventQueue
private final Intention intention
private final Plan plan
private final java.util.List<Goal> subgoals
| Constructor Detail |
|---|
public PlanInstance(Plan plan,
Intention intention)
throws PlanInstantiationException
Plan) and an Intention. It creates an instance of the
plan body defined in the plan and throws an exception if an error occurs
in this process.
plan - the plan associated this this plan instance.intention - the intention that this plan instance have to achieve.
PlanBodyInstantiationException - in an error occurred during the instantiation.
PlanInstantiationException| Method Detail |
|---|
public void dispatchGoal(Goal goal)
goal - the goal to be dispatched.public void dispatchSubgoal(Goal subgoal)
subgoal - the subgoal to be dispatched.public void dispatchSubgoalAndListen(Goal subgoal)
subgoal - the subgoal to be dispatched.private void dropSubgoals()
public BeliefBase getBeliefBase()
public PlanInstance.EndState getEndState()
OutputPlanBody interface (this is
invoked only once). If the plan body has come to a failed state, it sets
all of its subgoals as no longer desired.
public Goal getGoal()
public GoalFinishedEvent getGoalEvent()
public GoalFinishedEvent getGoalEvent(boolean block)
block - true if the behavior must be blocked if the queue is empty.
private GoalFinishedEvent getGoalEvent(boolean block,
long ms)
Behaviour.block()).
block - true if the behavior must be blocked if the queue is empty.ms - the maximum amount of time that the behavior must be blocked.
public GoalFinishedEvent getGoalEvent(long ms)
ms - the maximum amount of time that the behavior must be blocked.
public Plan getPlan()
Plan that is associated with this plan instance.
public void goalPerformed(GoalEvent event)
GoalListener
goalPerformed in interface GoalListenerevent - the performed goal event.GoalListener.goalPerformed(br.pucrio.inf.les.bdijade.event.GoalEvent)public void startPlan()
Behaviour, associated with this plan.
public void stopPlan()
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.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||