bdi4jade.core

## Class Intention

- java.lang.Object
- - bdi4jade.core.Intention

-     public class Intention
      extends java.lang.Object

  This class represents the intention abstraction from the BDI model. It represents a goal that the agent is committed to achieve. It has the associated goal and tries to execute plans to achieve it. It keeps a list of the executed plans, and after using all plans unsuccessfully, the goal is considered unachievable. When a plan fails, the BDI-interpreter cycle may invoke the `tryToAchive()` method again, so the intention tries another plan. During its execution, the intention can be set to no longer desired.
  Author:
    ingrid

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Intention(Goal goal, BDIAgent bdiAgent)` Creates a new intention.
    `Intention(Goal goal, BDIAgent bdiAgent, Capability owner)` Creates a new intention.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addGoalListener(GoalListener goalListener)` Adds a listener to be notified when the given has achieve its end state.
    `void` | `doWait()` Sets this intention to the `GoalStatus.WAITING` status.
    `void` | `fireGoalFinishedEvent()` Fires a goal event when a goal has achieved its end state.
    `Goal` | `getGoal()`
    `java.util.List<GoalListener>` | `getGoalListeners()`
    `BDIAgent` | `getMyAgent()`
    `GoalStatus` | `getStatus()` Returns the current goal status that this capability is committed to achieve.
    `void` | `noLongerDesire()` Sets this intention as no longer desired.
    `void` | `removeGoalListener(GoalListener goalListener)` Removes a goal listener to not be notified about the goal achievement anymore.
    `void` | `tryToAchive()` Makes this intention starts to try to achieve the goal.

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

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

- - ### Constructor Detail

    - #### Intention

          public Intention(Goal goal,
                   BDIAgent bdiAgent)

      Creates a new intention. It is associated with an agent and the goal that it is committed to achieve.
      Parameters:
        `goal` - the goal to be achieved.
        `bdiAgent` - the bdiAgent associated with this intention.

    - #### Intention

          public Intention(Goal goal,
                   BDIAgent bdiAgent,
                   Capability owner)

      Creates a new intention. It is associated with an agent and the goal that it is committed to achieve. It also receives a `Capability` as parameter indicating the owner of the goal (dispatched the goal).
      Parameters:
        `goal` - the goal to be achieved.
        `bdiAgent` - the bdiAgent associated with this intention.
        `owner` - the Capability that is owner of the goal.

  - ### Method Detail

    - #### addGoalListener

          public void addGoalListener(GoalListener goalListener)

      Adds a listener to be notified when the given has achieve its end state.
      Parameters:
        `goalListener` - the listener to be notified.

    - #### doWait

          public void doWait()

      Sets this intention to the `GoalStatus.WAITING` status. It may come from the `GoalStatus.PLAN_FAILED` or `GoalStatus.TRYING_TO_ACHIEVE` states.

    - #### fireGoalFinishedEvent

          public void fireGoalFinishedEvent()

      Fires a goal event when a goal has achieved its end state.
      See Also:
        `GoalStatus`

    - #### getGoal

          public Goal getGoal()

      Returns:
        the goal

    - #### getGoalListeners

          public java.util.List<GoalListener> getGoalListeners()

      Returns:
        the goalListeners

    - #### getMyAgent

          public BDIAgent getMyAgent()

      Returns:
        the myAgent

    - #### getStatus

          public GoalStatus getStatus()

      Returns the current goal status that this capability is committed to achieve.
      Returns:
        the current goal status.
      See Also:
        `GoalStatus`

    - #### noLongerDesire

          public void noLongerDesire()

      Sets this intention as no longer desired. It stops the current plan execution. It changes the goal status from `GoalStatus.WAITING`, `GoalStatus.PLAN_FAILED` or `GoalStatus.TRYING_TO_ACHIEVE` to `GoalStatus.NO_LONGER_DESIRED`.

    - #### removeGoalListener

          public void removeGoalListener(GoalListener goalListener)

      Removes a goal listener to not be notified about the goal achievement anymore.
      Parameters:
        `goalListener` - the goal listener to be removed.

    - #### tryToAchive

          public void tryToAchive()

      Makes this intention starts to try to achieve the goal. It changes the goal status from `GoalStatus.WAITING` or `GoalStatus.PLAN_FAILED` to `GoalStatus.TRYING_TO_ACHIEVE`.