br.pucrio.inf.les.bdijade.plan
Class SimplePlan

java.lang.Object
  extended by br.pucrio.inf.les.bdijade.util.MetadataElement
      extended by br.pucrio.inf.les.bdijade.plan.Plan
          extended by br.pucrio.inf.les.bdijade.plan.SimplePlan

public class SimplePlan
extends Plan

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

Author:
ingrid

Field Summary
private  java.lang.Class<? extends jade.core.behaviours.Behaviour> planBodyClass
           
 
Fields inherited from class br.pucrio.inf.les.bdijade.plan.Plan
id
 
Fields inherited from class br.pucrio.inf.les.bdijade.util.MetadataElement
metadata
 
Constructor Summary
SimplePlan(java.lang.Class<? extends jade.core.behaviours.Behaviour> planBodyClass)
          Creates a new Simple Plan.
SimplePlan(java.lang.Class<? extends Goal> goalClass, java.lang.Class<? extends jade.core.behaviours.Behaviour> planBodyClass)
          Creates a new Simple Plan.
SimplePlan(java.lang.Class<? extends Goal> goalClass, jade.lang.acl.MessageTemplate messageTemplate, java.lang.Class<? extends jade.core.behaviours.Behaviour> planBodyClass)
          Creates a new Simple Plan.
SimplePlan(jade.lang.acl.MessageTemplate messageTemplate, java.lang.Class<? extends jade.core.behaviours.Behaviour> planBodyClass)
          Creates a new Simple Plan.
SimplePlan(java.lang.String id, java.lang.Class<? extends jade.core.behaviours.Behaviour> planBodyClass)
          Creates a new Simple Plan.
SimplePlan(java.lang.String id, java.lang.Class<? extends Goal> goalClass, java.lang.Class<? extends jade.core.behaviours.Behaviour> planBodyClass)
          Creates a new Simple Plan.
SimplePlan(java.lang.String id, java.lang.Class<? extends Goal> goalClass, jade.lang.acl.MessageTemplate messageTemplate, java.lang.Class<? extends jade.core.behaviours.Behaviour> planBodyClass)
          Creates a new Simple Plan.
SimplePlan(java.lang.String id, jade.lang.acl.MessageTemplate messageTemplate, java.lang.Class<? extends jade.core.behaviours.Behaviour> planBodyClass)
          Creates a new Simple Plan.
 
Method Summary
 jade.core.behaviours.Behaviour createPlanBody()
          Creates a new instance of the plan body.
 java.lang.Class<? extends jade.core.behaviours.Behaviour> getPlanBodyClass()
           
 
Methods inherited from class br.pucrio.inf.les.bdijade.plan.Plan
addGoal, addMessageTemplate, canAchieve, canProcess, equals, getId, getPlanLibrary, hashCode, initGoals, initMessageTemplates, matchesContext, setPlanLibrary, toString
 
Methods inherited from class br.pucrio.inf.les.bdijade.util.MetadataElement
getMetadata, getMetadata, hasMetadata, putMetadata, removeMetadata
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

planBodyClass

private final java.lang.Class<? extends jade.core.behaviours.Behaviour> planBodyClass
Constructor Detail

SimplePlan

public SimplePlan(java.lang.Class<? extends jade.core.behaviours.Behaviour> planBodyClass)
Creates a new Simple Plan. It is a plan whose body is the specified class and its id is the plan body class name. The class must also implement the PlanBody interface, otherwise an exception is going to be thrown during the instantiation process.

Parameters:
planBodyClass - the class of the plan body. It must have the Behavior as super class and implement the PlanBody interface.

SimplePlan

public SimplePlan(java.lang.Class<? extends Goal> goalClass,
                  java.lang.Class<? extends jade.core.behaviours.Behaviour> planBodyClass)
Creates a new Simple Plan. It is a plan whose body is the specified class and its id is the plan body class name. The class must also implement the PlanBody interface, otherwise an exception is going to be thrown during the instantiation process. It sets that this plan can achieve the specified goal class, but more goals can be specified by overriding the initGoals() method.

Parameters:
goalClass - the goal that this plan can achieve.
planBodyClass - the class of the plan body. It must have the Behavior as super class and implement the PlanBody interface.

SimplePlan

public SimplePlan(java.lang.Class<? extends Goal> goalClass,
                  jade.lang.acl.MessageTemplate messageTemplate,
                  java.lang.Class<? extends jade.core.behaviours.Behaviour> planBodyClass)
Creates a new Simple Plan. It is a plan whose body is the specified class and its id is the plan body class name. The class must also implement the PlanBody interface, otherwise an exception is going to be thrown during the instantiation process. It sets that this plan can achieve the specified goal class, but more goals can be specified by overriding the initGoals() method. The message templates is initialized with the provided template.

Parameters:
goalClass - the goal that this plan can achieve.
messageTemplate - the template of messages that this plan can process.
planBodyClass - the class of the plan body. It must have the Behavior as super class and implement the PlanBody interface.

SimplePlan

public SimplePlan(jade.lang.acl.MessageTemplate messageTemplate,
                  java.lang.Class<? extends jade.core.behaviours.Behaviour> planBodyClass)
Creates a new Simple Plan. It is a plan whose body is the specified class and its id is the plan body class name. The class must also implement the PlanBody interface, otherwise an exception is going to be thrown during the instantiation process. The message templates is initialized with the provided template.

Parameters:
messageTemplate - the template of messages that this plan can process.
planBodyClass - the class of the plan body. It must have the Behavior as super class and implement the PlanBody interface.

SimplePlan

public SimplePlan(java.lang.String id,
                  java.lang.Class<? extends jade.core.behaviours.Behaviour> planBodyClass)
Creates a new Simple Plan. It is a plan that has the provided id and whose body is the specified class. The class must also implement the PlanBody interface, otherwise an exception is going to be thrown during the instantiation process.

Parameters:
id - the id of this plan.
planBodyClass - the class of the plan body. It must have the Behavior as super class and implement the PlanBody interface.

SimplePlan

public SimplePlan(java.lang.String id,
                  java.lang.Class<? extends Goal> goalClass,
                  java.lang.Class<? extends jade.core.behaviours.Behaviour> planBodyClass)
Creates a new Simple Plan. It is a plan that has the provided id and whose body is the specified class. The class must also implement the PlanBody interface, otherwise an exception is going to be thrown during the instantiation process. It sets that this plan can achieve the specified goal class, but more goals can be specified by overriding the initGoals() method.

Parameters:
id - the id of this plan.
goalClass - the goal that this plan can achieve.
planBodyClass - the class of the plan body. It must have the Behavior as super class and implement the PlanBody interface.

SimplePlan

public SimplePlan(java.lang.String id,
                  java.lang.Class<? extends Goal> goalClass,
                  jade.lang.acl.MessageTemplate messageTemplate,
                  java.lang.Class<? extends jade.core.behaviours.Behaviour> planBodyClass)
Creates a new Simple Plan. It is a plan that has the provided id and whose body is the specified class. The class must also implement the PlanBody interface, otherwise an exception is going to be thrown during the instantiation process. It sets that this plan can achieve the specified goal class, but more goals can be specified by overriding the initGoals() method. The message templates is initialized with the provided template.

Parameters:
id - the id of this plan.
messageTemplate - the template of messages that this plan can process.
goalClass - the goal that this plan can achieve.
planBodyClass - the class of the plan body. It must have the Behavior as super class and implement the PlanBody interface.

SimplePlan

public SimplePlan(java.lang.String id,
                  jade.lang.acl.MessageTemplate messageTemplate,
                  java.lang.Class<? extends jade.core.behaviours.Behaviour> planBodyClass)
Creates a new Simple Plan. It is a plan that has the provided id and whose body is the specified class. The class must also implement the PlanBody interface, otherwise an exception is going to be thrown during the instantiation process. The message templates is initialized with the provided template.

Parameters:
id - the id of this plan.
messageTemplate - the template of messages that this plan can process.
planBodyClass - the class of the plan body. It must have the Behavior as super class and implement the PlanBody interface.
Method Detail

createPlanBody

public jade.core.behaviours.Behaviour createPlanBody()
                                              throws PlanInstantiationException
Creates a new instance of the plan body. It invokes the method newInstance() from the plan body class.

Specified by:
createPlanBody in class Plan
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 jade.core.behaviours.Behaviour> getPlanBodyClass()
Returns:
the planBodyClass