public abstract class AbstractPlan extends MetadataElementImpl implements Plan
Plan interface.Plan.EndStatemetadata| Modifier | Constructor and Description |
|---|---|
protected |
AbstractPlan()
The default constructor.
|
|
AbstractPlan(java.lang.String id)
Creates a new plan with an identifier.
|
|
AbstractPlan(java.lang.String id,
GoalTemplate goalTemplate)
Creates a new plan with an identifier and a template of goals it can
achieve.
|
|
AbstractPlan(java.lang.String id,
GoalTemplate goalTemplate,
jade.lang.acl.MessageTemplate messageTemplate)
Creates a new plan with an identifier, a template of goals it can
achieve, and a template of messages it can process.
|
|
AbstractPlan(java.lang.String id,
jade.lang.acl.MessageTemplate messageTemplate)
Creates a new plan with an identifier and a template of messages it can
process.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addGoalTemplate(GoalTemplate goalTemplate)
Adds template of goals that this plan can 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 matches with any of the message templates of this
plan.
|
boolean |
equals(java.lang.Object obj)
Returns true if the object given as parameter is a plan and has the same
id of this plan.
|
java.util.Set<GoalTemplate> |
getGoalTemplates()
Returns the set of goal templates of the goals that can be achieved by
this plan.
|
java.lang.String |
getId()
Returns the identifier of this plan.
|
java.util.Set<jade.lang.acl.MessageTemplate> |
getMessageTemplates()
Returns the set of message templates of the messages that can be
processed by this plan.
|
PlanLibrary |
getPlanLibrary()
Returns the plan library with which this plan is associated.
|
int |
hashCode() |
protected void |
initGoalTemplates()
This method is invoked in the Plan constructor.
|
protected void |
initMessageTemplates()
This method is invoked in the Plan constructor.
|
boolean |
isContextApplicable(Goal goal)
Verifies that this plan can be executed in the current context and a
given goal.
|
void |
setPlanLibrary(PlanLibrary planLibrary)
Sets the plan library with which this plan is associated.
|
java.lang.String |
toString()
Returns the string representation of this plan, which is its id.
|
getMetadata, getMetadata, hasMetadata, putMetadata, removeMetadataclone, finalize, getClass, notify, notifyAll, wait, wait, waitcreatePlanBodygetMetadata, getMetadata, hasMetadata, putMetadata, removeMetadataprotected AbstractPlan()
public AbstractPlan(java.lang.String id)
id - the plan identifier.public AbstractPlan(java.lang.String id,
GoalTemplate goalTemplate)
id - the plan identifier.goalTemplate - the template of goals that this plan can achieve.public AbstractPlan(java.lang.String id,
GoalTemplate goalTemplate,
jade.lang.acl.MessageTemplate messageTemplate)
id - the plan identifier.goalTemplate - the template of goals that this plan can achieve.messageTemplate - the template of messages that this plan can process.public AbstractPlan(java.lang.String id,
jade.lang.acl.MessageTemplate messageTemplate)
id - the plan identifier.messageTemplate - the template of messages that this plan can process.public void addGoalTemplate(GoalTemplate goalTemplate)
goalTemplate - the template of goals that this plan can achieve.public void addMessageTemplate(jade.lang.acl.MessageTemplate messageTemplate)
messageTemplate - the message template of messages that can be processed.public boolean canAchieve(Goal goal)
isContextApplicable(Goal) method. If so, when the goal is a
MessageGoal, it invokes the method
canProcess(ACLMessage). Otherwise, it checks if the class of
this goal is in the goal set of this plan.canAchieve in interface Plangoal - the goal to be verified.Plan.canAchieve(Goal)public boolean canProcess(jade.lang.acl.ACLMessage message)
canProcess in interface Planmessage - the message to be checked.Plan.canProcess(ACLMessage)public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectobj - the object to be tested as equals to this plan.Object.equals(java.lang.Object)public java.util.Set<GoalTemplate> getGoalTemplates()
public java.lang.String getId()
getId in interface PlanPlan.getId()public java.util.Set<jade.lang.acl.MessageTemplate> getMessageTemplates()
public PlanLibrary getPlanLibrary()
getPlanLibrary in interface PlanPlan.getPlanLibrary()public int hashCode()
hashCode in class java.lang.ObjectObject.hashCode()protected void initGoalTemplates()
protected void initMessageTemplates()
public boolean isContextApplicable(Goal goal)
isContextApplicable in interface Plangoal - the goal to be achieved whose conditions may be tested to
verify the applicability of this plan.Plan.isContextApplicable(Goal)public void setPlanLibrary(PlanLibrary planLibrary)
setPlanLibrary in interface PlanplanLibrary - the planLibrary to setpublic java.lang.String toString()
toString in class java.lang.ObjectObject.toString()