bdi4jade.plan

## Class DefaultPlan

- java.lang.Object
- - bdi4jade.core.MetadataElementImpl
  - - bdi4jade.plan.AbstractPlan
    - - bdi4jade.plan.DefaultPlan

- All Implemented Interfaces:
    MetadataElement, Plan

      public class DefaultPlan
      extends AbstractPlan

  This class represents a plan whose plan body is a class that can be instantiated by invoking the `Class.newInstance()` method. A class that has the `Behaviour` class as superclass is provides and it is instantiates in the `createPlanBody()` method.
  Author:
    ingrid

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface bdi4jade.plan.Plan

      `Plan.EndState`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.lang.Class<? extends PlanBody>` | `planBodyClass`

    - ### Fields inherited from class bdi4jade.core.MetadataElementImpl

      `metadata`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultPlan(java.lang.Class<? extends Goal> goalClass, java.lang.Class<? extends PlanBody> planBodyClass)` Creates a new simple plan, which is able to achieve goals of the given goal class, and its body should be instances of the provided plan body class.
    `DefaultPlan(java.lang.Class<? extends PlanBody> planBodyClass)` Creates a new simple plan.
    `DefaultPlan(GoalTemplate goalTemplate, java.lang.Class<? extends PlanBody> planBodyClass)` Creates a new simple plan, which is able to achieve goals that match the provided template.
    `DefaultPlan(GoalTemplate goalTemplate, jade.lang.acl.MessageTemplate messageTemplate, java.lang.Class<? extends PlanBody> planBodyClass)` Creates a new simple plan, which is able to achieve goals that match the provided goal template and process messages that match the provided message template.
    `DefaultPlan(jade.lang.acl.MessageTemplate messageTemplate, java.lang.Class<? extends PlanBody> planBodyClass)` Creates a new simple plan, which is able to process messages that match the provided message template.
    `DefaultPlan(java.lang.String id, GoalTemplate goalTemplate, java.lang.Class<? extends PlanBody> planBodyClass)` Creates a new simple plan, which is able to achieve goals that match the provided template.
    `DefaultPlan(java.lang.String id, GoalTemplate goalTemplate, jade.lang.acl.MessageTemplate messageTemplate, java.lang.Class<? extends PlanBody> planBodyClass)` Creates a new simple plan, which is able to achieve goals that match the provided goal template and process messages that match the provided message template.
    `DefaultPlan(java.lang.String id, jade.lang.acl.MessageTemplate messageTemplate, java.lang.Class<? extends PlanBody> planBodyClass)` Creates a new simple plan, which is able to process messages that match the provided message template.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `PlanBody` | `createPlanBody()` Creates a new instance of the plan body.
    `java.lang.Class<? extends PlanBody>` | `getPlanBodyClass()` Returns the class of plan body of this plan, to be instantiated and executed.

    - ### Methods inherited from class bdi4jade.plan.AbstractPlan

      `addGoalTemplate, addMessageTemplate, canAchieve, canProcess, equals, getGoalTemplates, getId, getMessageTemplates, getPlanLibrary, hashCode, initGoalTemplates, initMessageTemplates, isContextApplicable, setPlanLibrary, toString`

    - ### Methods inherited from class bdi4jade.core.MetadataElementImpl

      `getMetadata, getMetadata, hasMetadata, putMetadata, removeMetadata`

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

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface bdi4jade.core.MetadataElement

      `getMetadata, getMetadata, hasMetadata, putMetadata, removeMetadata`

- - ### Field Detail

    - #### planBodyClass

          protected final java.lang.Class<? extends PlanBody> planBodyClass

  - ### Constructor Detail

    - #### DefaultPlan

          public DefaultPlan(java.lang.Class<? extends Goal> goalClass,
                     java.lang.Class<? extends PlanBody> planBodyClass)

      Creates a new simple plan, which is able to achieve goals of the given goal class, and its body should be instances of the provided plan body class. Its identifier is set of the class name of the plan body class.
      Parameters:
        `goalClass` - the class of goals that this plan is able to achieve.
        `planBodyClass` - the class of this plan body.

    - #### DefaultPlan

          public DefaultPlan(java.lang.Class<? extends PlanBody> planBodyClass)

      Creates a new simple plan. Its body should be instances of the provided plan body class. Its identifier is set of the class name of the plan body class.
      Parameters:
        `planBodyClass` - the class of this plan body.

    - #### DefaultPlan

          public DefaultPlan(GoalTemplate goalTemplate,
                     java.lang.Class<? extends PlanBody> planBodyClass)

      Creates a new simple plan, which is able to achieve goals that match the provided template. It is a plan whose body is the specified class and its id is the plan body class name. It sets that this plan can achieve goals of the specified goal template, but more goal templates can be specified by overriding the `AbstractPlan.initGoalTemplates()` method or invoking the `AbstractPlan.addGoalTemplate(GoalTemplate)` method.
      Parameters:
        `goalTemplate` - the template of goals that this plan can achieve.
        `planBodyClass` - the class of this plan body.

    - #### DefaultPlan

          public DefaultPlan(GoalTemplate goalTemplate,
                     jade.lang.acl.MessageTemplate messageTemplate,
                     java.lang.Class<? extends PlanBody> planBodyClass)

      Creates a new simple plan, which is able to achieve goals that match the provided goal template and process messages that match the provided message template. It is a plan whose body is the specified class and its id is the plan body class name. It sets that this plan can achieve goals of the specified goal template, but more goal templates can be specified by overriding the `AbstractPlan.initGoalTemplates()` method or invoking the `AbstractPlan.addGoalTemplate(GoalTemplate)` method, while more message templates can be specified by overriding the `AbstractPlan.initMessageTemplates()` method or invoking the `AbstractPlan.addMessageTemplate(MessageTemplate)` method.
      Parameters:
        `goalTemplate` - the template of goals that this plan can achieve.
        `messageTemplate` - the template of messages that this plan can process.
        `planBodyClass` - the class of this plan body.

    - #### DefaultPlan

          public DefaultPlan(jade.lang.acl.MessageTemplate messageTemplate,
                     java.lang.Class<? extends PlanBody> planBodyClass)

      Creates a new simple plan, which is able to process messages that match the provided message template. It is a plan whose body is the specified class and its id is the plan body class name. It sets that this plan can process messages of the specified message template, but more message templates can be specified by overriding the `AbstractPlan.initMessageTemplates()` method or invoking the `AbstractPlan.addMessageTemplate(MessageTemplate)` method.
      Parameters:
        `messageTemplate` - the template of messages that this plan can process.
        `planBodyClass` - the class of this plan body.

    - #### DefaultPlan

          public DefaultPlan(java.lang.String id,
                     GoalTemplate goalTemplate,
                     java.lang.Class<? extends PlanBody> planBodyClass)

      Creates a new simple plan, which is able to achieve goals that match the provided template. It is a plan whose body is the specified class and its id is the given id. It sets that this plan can achieve goals of the specified goal template, but more goal templates can be specified by overriding the `AbstractPlan.initGoalTemplates()` method or invoking the `AbstractPlan.addGoalTemplate(GoalTemplate)` method.
      Parameters:
        `id` - the plan id.
        `goalTemplate` - the template of goals that this plan can achieve.
        `planBodyClass` - the class of this plan body.

    - #### DefaultPlan

          public DefaultPlan(java.lang.String id,
                     GoalTemplate goalTemplate,
                     jade.lang.acl.MessageTemplate messageTemplate,
                     java.lang.Class<? extends PlanBody> planBodyClass)

      Creates a new simple plan, which is able to achieve goals that match the provided goal template and process messages that match the provided message template. It is a plan whose body is the specified class and its id is the given id. It sets that this plan can achieve goals of the specified goal template, but more goal templates can be specified by overriding the `AbstractPlan.initGoalTemplates()` method or invoking the `AbstractPlan.addGoalTemplate(GoalTemplate)` method, while more message templates can be specified by overriding the `AbstractPlan.initMessageTemplates()` method or invoking the `AbstractPlan.addMessageTemplate(MessageTemplate)` method.
      Parameters:
        `id` - the plan id.
        `goalTemplate` - the template of goals that this plan can achieve.
        `messageTemplate` - the template of messages that this plan can process.
        `planBodyClass` - the class of this plan body.

    - #### DefaultPlan

          public DefaultPlan(java.lang.String id,
                     jade.lang.acl.MessageTemplate messageTemplate,
                     java.lang.Class<? extends PlanBody> planBodyClass)

      Creates a new simple plan, which is able to process messages that match the provided message template. It is a plan whose body is the specified class and its id is the given id. It sets that this plan can process messages of the specified message template, but more message templates can be specified by overriding the `AbstractPlan.initMessageTemplates()` method or invoking the `AbstractPlan.addMessageTemplate(MessageTemplate)` method.
      Parameters:
        `id` - the plan id.
        `messageTemplate` - the template of messages that this plan can process.
        `planBodyClass` - the class of this plan body.

  - ### Method Detail

    - #### createPlanBody

          public PlanBody createPlanBody()
                                  throws PlanInstantiationException

      Creates a new instance of the plan body. It invokes the method newInstance() from the plan body class.
      Returns:
        the instantiated plan body.
      Throws:
        `PlanInstantiationException` - if an error occurred during the instantiation process.
      See Also:
        `Plan.createPlanBody()`

    - #### getPlanBodyClass

          public java.lang.Class<? extends PlanBody> getPlanBodyClass()

      Returns the class of plan body of this plan, to be instantiated and executed.
      Returns:
        the planBodyClass