bdi4jade.plan

## Class PlanLibrary

- java.lang.Object
- - bdi4jade.plan.PlanLibrary

- All Implemented Interfaces:
    java.io.Serializable

      public class PlanLibrary
      extends java.lang.Object
      implements java.io.Serializable

  This class represents the plan library of a capability. It aggregates the plans that can be used to achieve goals.
  Author:
    Ingrid Nunes
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `PlanLibrary()` The default constructor.
    `` | `PlanLibrary(Capability capability)` Creates a plan library associated with a capability.
    `` | `PlanLibrary(Capability capability, java.util.Set<Plan> plans)` Creates a plan library base associated with a capability and adds the plans in the provided set.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `addDefaultPlans()` Adds a set of default plans to this library.
    `void` | `addPlan(Plan plan)` Adds a plan to the plan library.
    `boolean` | `canAchieve(Goal goal)` Returns true if there is a plan that can achieve the given goal.
    `boolean` | `canHandle(jade.lang.acl.ACLMessage message)` Returns true if there is a plan that can handle the given message.
    `java.util.Set<Plan>` | `getCandidatePlans(Goal goal)` Returns the set of plans that can achieve the given goal.
    `Capability` | `getCapability()` Returns the capability with which this plan library is associated.
    `java.util.Set<Plan>` | `getPlans()` Returns the set of plans that are part of this plan library.
    `boolean` | `hasPlan(Plan plan)` Checks if a plan is part of the plan library.
    `boolean` | `removePlan(Plan plan)` Removes a plan from the plan library.

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

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

- - ### Constructor Detail

    - #### PlanLibrary

          protected PlanLibrary()

      The default constructor. It should be only used if persistence frameworks are used.

    - #### PlanLibrary

          public PlanLibrary(Capability capability)

      Creates a plan library associated with a capability.
      Parameters:
        `capability` - the capability with which this plan library is associated.

    - #### PlanLibrary

          public PlanLibrary(Capability capability,
                             java.util.Set<Plan> plans)

      Creates a plan library base associated with a capability and adds the plans in the provided set.
      Parameters:
        `capability` - the capability with which this plan library is associated.
        `plans` - the initial plans

  - ### Method Detail

    - #### addDefaultPlans

          protected void addDefaultPlans()

      Adds a set of default plans to this library. It adds plans to achieve the sequential and parallel goals. This method may be overridden by children capabilities.

    - #### addPlan

          public void addPlan(Plan plan)

      Adds a plan to the plan library.
      Parameters:
        `plan` - the plan to be added.

    - #### canAchieve

          public boolean canAchieve(Goal goal)

      Returns true if there is a plan that can achieve the given goal.
      Parameters:
        `goal` - the goal to be checked.
      Returns:
        true if a plan can achieve the goal, false otherwise.

    - #### canHandle

          public boolean canHandle(jade.lang.acl.ACLMessage message)

      Returns true if there is a plan that can handle the given message.
      Parameters:
        `message` - the message to be checked.
      Returns:
        true if a plan can handle the message, false otherwise.

    - #### getCandidatePlans

          public java.util.Set<Plan> getCandidatePlans(Goal goal)

      Returns the set of plans that can achieve the given goal.
      Parameters:
        `goal` - the goal to be achieved.
      Returns:
        the set of plans that can achieve the goal.

    - #### getCapability

          public Capability getCapability()

      Returns the capability with which this plan library is associated.
      Returns:
        the capability.

    - #### getPlans

          public java.util.Set<Plan> getPlans()

      Returns the set of plans that are part of this plan library.
      Returns:
        the plans.

    - #### hasPlan

          public boolean hasPlan(Plan plan)

      Checks if a plan is part of the plan library.
      Parameters:
        `plan` - the plan to be checked
      Returns:
        true if the plan library contains the plan.

    - #### removePlan

          public boolean removePlan(Plan plan)

      Removes a plan from the plan library.
      Parameters:
        `plan` - the plan to be removed.
      Returns:
        true if the plan was removed, false otherwise.