public abstract class Plan extends MetadataElement
| Modifier and Type | Class and Description |
|---|---|
static class |
Plan.DefaultMetadata |
| Constructor and Description |
|---|
Plan(java.lang.String id)
Constructs a new Plan.
|
Plan(java.lang.String id,
java.lang.Class<? extends Goal> goalClass)
Constructs a new Plan.
|
Plan(java.lang.String id,
java.lang.Class<? extends Goal> goalClass,
jade.lang.acl.MessageTemplate messageTemplate)
Constructs a new Plan.
|
Plan(java.lang.String id,
jade.lang.acl.MessageTemplate messageTemplate)
Constructs a new Plan.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addGoal(java.lang.Class<? extends Goal> goalClass)
Adds a goal class that this plan may achieve.
|
void |
addMessageTemplate(jade.lang.acl.MessageTemplate messageTemplate)
Adds a message template of messages that this plan can process.
|
boolean |
canAchieve(Goal goal)
Verifies if a given goal can be achieved by this plan.
|
boolean |
canProcess(jade.lang.acl.ACLMessage message)
Verifies if the message received matches with any of the message
templates of this plan.
|
abstract jade.core.behaviours.Behaviour |
createPlanBody()
Instantiate the plan body of this plan.
|
boolean |
equals(java.lang.Object obj) |
java.lang.String |
getId() |
PlanLibrary |
getPlanLibrary() |
int |
hashCode() |
void |
setPlanLibrary(PlanLibrary planLibrary) |
java.lang.String |
toString() |
getMetadata, getMetadata, hasMetadata, putMetadata, removeMetadatapublic Plan(java.lang.String id)
id - plan identifierpublic Plan(java.lang.String id,
java.lang.Class<? extends Goal> goalClass)
id - plan identifiergoalClass - the goal that this plan can achievepublic Plan(java.lang.String id,
java.lang.Class<? extends Goal> goalClass,
jade.lang.acl.MessageTemplate messageTemplate)
id - plan identifiergoalClass - the goal that this plan can achievemessageTemplate - the template of messages that this plan can process.public Plan(java.lang.String id,
jade.lang.acl.MessageTemplate messageTemplate)
id - the plan identifiermessageTemplate - the template of messages that this plan can process.public void addGoal(java.lang.Class<? extends Goal> goalClass)
goalClass - the goal class that can be achieved by this plan.public void addMessageTemplate(jade.lang.acl.MessageTemplate messageTemplate)
messageTemplate - the message template of messages that can be processed.public boolean canAchieve(Goal goal)
MessageGoal, it invokes the method
canProcess(ACLMessage). Otherwise, it checks if the class of
this goal is contained in the goal set of this plan.goal - the goal to be verified.public boolean canProcess(jade.lang.acl.ACLMessage message)
message - the message to be checked.public abstract jade.core.behaviours.Behaviour createPlanBody()
throws PlanInstantiationException
Behaviour and also implements the PlanBody interface.PlanInstantiationException - if an error occurred during the instantiation process.public boolean equals(java.lang.Object obj)
equals in class java.lang.ObjectObject.equals(java.lang.Object)public java.lang.String getId()
public PlanLibrary getPlanLibrary()
public int hashCode()
hashCode in class java.lang.ObjectObject.hashCode()public void setPlanLibrary(PlanLibrary planLibrary)
planLibrary - the planLibrary to setpublic java.lang.String toString()
toString in class java.lang.ObjectObject.toString()