bdi4jade.plan.planbody

## Class ParallelGoalPlanBody

- java.lang.Object
- - jade.core.behaviours.Behaviour
  - - bdi4jade.plan.planbody.AbstractPlanBody
    - - bdi4jade.plan.planbody.ParallelGoalPlanBody

- All Implemented Interfaces:
    GoalListener, OutputPlanBody, PlanBody, java.io.Serializable, java.util.EventListener

      public class ParallelGoalPlanBody
      extends AbstractPlanBody
      implements OutputPlanBody

  This plan body provides the set of actions to achieve a `ParallelGoal`.
  Author:
    Ingrid Nunes
  See Also:
    Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class jade.core.behaviours.Behaviour

      `jade.core.behaviours.Behaviour.RunnableChangedEvent`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.util.List<Goal>` | `completedGoals`
    `protected boolean` | `dispatched`
    `protected GoalEvent` | `failedGoal`
    `protected ParallelGoal` | `parallelGoal`

    - ### Fields inherited from class jade.core.behaviours.Behaviour

      `myAgent, myEvent, NOTIFY_DOWN, NOTIFY_UP, parent, STATE_BLOCKED, STATE_READY, STATE_RUNNING`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ParallelGoalPlanBody()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `action()` This method tries to achieve all subgoals of the `ParallelGoal` to be achieved in a parallel way.
    `void` | `onStart()` Initializes this plan.
    `void` | `setGoalOutput(Goal goal)` Sets completed goals, and the failed goal, if there is one.

    - ### Methods inherited from class bdi4jade.plan.planbody.AbstractPlanBody

      `dispatchGoal, dispatchSubgoal, dispatchSubgoalAndListen, done, getBeliefBase, getCapability, getEndState, getGoal, getGoalEvent, getGoalEvent, getGoalEvent, getPlan, goalPerformed, init, setEndState, start, stop`

    - ### Methods inherited from class jade.core.behaviours.Behaviour

      `actionWrapper, block, block, getAgent, getBehaviourName, getDataStore, getExecutionState, getParent, getRestartCounter, handle, handleBlockEvent, handleRestartEvent, isRunnable, onEnd, reset, restart, root, setAgent, setBehaviourName, setDataStore, setExecutionState`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface bdi4jade.plan.planbody.PlanBody

      `onEnd, reset`

- - ### Field Detail

    - #### completedGoals

          protected java.util.List<Goal> completedGoals

    - #### dispatched

          protected boolean dispatched

    - #### failedGoal

          protected GoalEvent failedGoal

    - #### parallelGoal

          protected ParallelGoal parallelGoal

  - ### Constructor Detail

    - #### ParallelGoalPlanBody

          public ParallelGoalPlanBody()

  - ### Method Detail

    - #### action

          public void action()

      This method tries to achieve all subgoals of the `ParallelGoal` to be achieved in a parallel way. If one of the subgoals fail, it stops the plan body execution, and consequently all other subgoals not achieved yet are dropped.
      Specified by:
        `action` in class `jade.core.behaviours.Behaviour`
      See Also:
        `Behaviour.action()`

    - #### onStart

          public void onStart()

      Initializes this plan. It verifies if the goal that triggered this plan body execution is a `ParallelGoal`. If not, it throws an `IllegalArgumentException`.
      Specified by:
        `onStart` in interface `PlanBody`
      Overrides:
        `onStart` in class `jade.core.behaviours.Behaviour`
      See Also:
        `Behaviour.onStart()`

    - #### setGoalOutput

          public void setGoalOutput(Goal goal)

      Sets completed goals, and the failed goal, if there is one.
      Specified by:
        `setGoalOutput` in interface `OutputPlanBody`
      Parameters:
        `goal` - the goal whose output parameters are to be set.
      See Also:
        `OutputPlanBody.setGoalOutput(bdi4jade.goal.Goal)`