public class Capability
extends java.lang.Object
implements java.io.Serializable
| Modifier and Type | Field and Description |
|---|---|
protected BeliefBase |
beliefBase |
protected java.lang.String |
id |
protected PlanLibrary |
planLibrary |
| Modifier | Constructor and Description |
|---|---|
|
Capability()
Creates a new capability with a generated id.
|
|
Capability(java.util.Set<Belief<?,?>> initialBeliefs,
java.util.Set<Plan> initialPlans)
Creates a new capability with a generated id.
|
|
Capability(java.lang.String id)
Creates a new capability with the given id.
|
protected |
Capability(java.lang.String id,
BeliefBase beliefBase,
java.util.Set<Belief<?,?>> initialBeliefs,
PlanLibrary planLibrary,
java.util.Set<Plan> initialPlans)
Creates a new capability with the given id, or a generated one if it is
null.
|
|
Capability(java.lang.String id,
java.util.Set<Belief<?,?>> initialBeliefs,
java.util.Set<Plan> initialPlans)
Creates a new capability with the given id.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
addAnnotatedFields(java.lang.Class<? extends Capability> capabilityClass)
Adds by reflection capability components, such as beliefs and plans,
according to annotated fields.
|
void |
addAssociatedCapability(Capability capability)
Associates a capability to this capability.
|
void |
addCandidatePlans(Goal goal,
java.util.Map<Capability,java.util.Set<Plan>> candidatePlansMap)
Adds the set of plans of this capability that can achieve the given goal
to a map of candidate plans.
|
void |
addPartCapability(Capability partCapability)
Adds a capability as part of this capability, which is a
whole-capability.
|
boolean |
canAchieve(Goal goal)
Checks if this capability has a plan that can achieve the given goal.
|
boolean |
canHandle(jade.lang.acl.ACLMessage msg)
Checks if this capability has a plan that can process the given message.
|
boolean |
equals(java.lang.Object obj)
Returns true if the object given as parameter is a capability and has the
same full id of this capability.
|
java.util.Set<Capability> |
getAssociatedCapabilities()
Returns all capabilities with which this capability is associated.
|
BeliefBase |
getBeliefBase()
Returns this capability belief base.
|
BeliefRevisionStrategy |
getBeliefRevisionStrategy()
Returns the belief revision strategy of this capability.
|
DeliberationFunction |
getDeliberationFunction()
Returns the deliberation function of this capability.
|
java.lang.String |
getFullId()
Returns the full id of this capability, which is its id prefixed by all
whole-capabilities' ids.
|
java.util.Set<Capability> |
getGoalOwner(java.lang.Class<? extends Capability> owner,
boolean internal)
Returns the capability instances that owns a dispatched goal, considering
the superclasses of this capability, its associations and compositions.
|
java.lang.String |
getId()
Returns this capability id.
|
BDIAgent |
getMyAgent()
Returns the agent that this capability is associated with.
|
OptionGenerationFunction |
getOptionGenerationFunction()
Returns the option generation function of this capability.
|
java.util.List<java.lang.Class<? extends Capability>> |
getParentCapabilities()
Returns the classes of all parent capabilities of this capability.
|
java.util.Set<Capability> |
getPartCapabilities()
Returns the parts of this capability.
|
PlanLibrary |
getPlanLibrary()
Returns the plan library of this capability.
|
PlanSelectionStrategy |
getPlanSelectionStrategy()
Returns the plan selection strategy of this capability.
|
Capability |
getWholeCapability()
Returns the whole-capability, if this is a part capability.
|
int |
hashCode() |
void |
removeAssociatedCapability(Capability capability)
Dissociates a capability of this capability.
|
boolean |
removePartCapability(Capability partCapability)
Removes a capability as part of this capability, which is a
whole-capability.
|
void |
setBeliefRevisionStrategy(BeliefRevisionStrategy beliefRevisionStrategy)
Sets the belief revision strategy of this capability.
|
void |
setDeliberationFunction(DeliberationFunction deliberationFunction)
Sets the deliberation function of this capability.
|
void |
setOptionGenerationFunction(OptionGenerationFunction optionGenerationFunction)
Sets the option generation function of this capability.
|
void |
setPlanSelectionStrategy(PlanSelectionStrategy planSelectionStrategy)
Sets the plan selection strategy of this capability.
|
protected void |
setup()
This is an empty holder for being overridden by subclasses.
|
protected void |
takeDown()
This is an empty holder for being overridden by subclasses.
|
java.lang.String |
toString() |
protected final BeliefBase beliefBase
protected final java.lang.String id
protected final PlanLibrary planLibrary
public Capability()
BeliefBase
and PlanLibrary as belief base and plan library respectively.public Capability(java.util.Set<Belief<?,?>> initialBeliefs, java.util.Set<Plan> initialPlans)
BeliefBase
and PlanLibrary as belief base and plan library respectively, and
adds initial beliefs and plans.initialBeliefs - the initial set of beliefs to be added to the belief base of
this capability.initialPlans - the initial set of plans to be added to the plan library of
this capability.public Capability(java.lang.String id)
BeliefBase
and PlanLibrary as belief base and plan library respectively.id - the capability id. If it is null, the class name is going to
be used.protected Capability(java.lang.String id,
BeliefBase beliefBase,
java.util.Set<Belief<?,?>> initialBeliefs,
PlanLibrary planLibrary,
java.util.Set<Plan> initialPlans)
id - the capability id. If it is null, the class name is going to
be used.beliefBase - the belief base.initialBeliefs - the initial set of beliefs to be added to the belief base of
this capability.planLibrary - the plan library.initialPlans - the initial set of plans to be added to the plan library of
this capability.public Capability(java.lang.String id,
java.util.Set<Belief<?,?>> initialBeliefs,
java.util.Set<Plan> initialPlans)
BeliefBase
and PlanLibrary as belief base and plan library respectively, and
adds initial beliefs and plans.id - the capability id. If it is null, the class name is going to
be used.initialBeliefs - the initial set of beliefs to be added to the belief base of
this capability.initialPlans - the initial set of plans to be added to the plan library of
this capability.protected void addAnnotatedFields(java.lang.Class<? extends Capability> capabilityClass)
capabilityClass - the capability class of which fields should me added to this
capability.public final void addAssociatedCapability(Capability capability)
capability - the capability to be associated.public void addCandidatePlans(Goal goal, java.util.Map<Capability,java.util.Set<Plan>> candidatePlansMap)
goal - the goal to be achieved.candidatePlansMap - the map to which the set of plans that can achieve the goal
should be added.public final void addPartCapability(Capability partCapability)
partCapability - the part capability to be added.public boolean canAchieve(Goal goal)
goal - the goal to be checked.public boolean canHandle(jade.lang.acl.ACLMessage msg)
msg - the message to be checked.public final 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 final java.util.Set<Capability> getAssociatedCapabilities()
public final BeliefBase getBeliefBase()
public final BeliefRevisionStrategy getBeliefRevisionStrategy()
public final DeliberationFunction getDeliberationFunction()
public final java.lang.String getFullId()
public final java.util.Set<Capability> getGoalOwner(java.lang.Class<? extends Capability> owner, boolean internal)
Owner annotation in goals).
If this method returns an empty set, it means that this capability has no
access to the goal owned by capabilities of the given class.owner - the capability class that is the goal owner.internal - the boolean that indicates whether the goal is internal or
external.public java.lang.String getId()
public final BDIAgent getMyAgent()
public final OptionGenerationFunction getOptionGenerationFunction()
public final java.util.List<java.lang.Class<? extends Capability>> getParentCapabilities()
public final java.util.Set<Capability> getPartCapabilities()
public final PlanLibrary getPlanLibrary()
public final PlanSelectionStrategy getPlanSelectionStrategy()
public final Capability getWholeCapability()
public final int hashCode()
hashCode in class java.lang.ObjectObject.hashCode()public final void removeAssociatedCapability(Capability capability)
capability - the capability to be dissociated.public final boolean removePartCapability(Capability partCapability)
partCapability - the part capability to be removed.public final void setBeliefRevisionStrategy(BeliefRevisionStrategy beliefRevisionStrategy)
beliefRevisionStrategy - the beliefRevisionStrategy to set.public final void setDeliberationFunction(DeliberationFunction deliberationFunction)
deliberationFunction - the deliberationFunction to set.public final void setOptionGenerationFunction(OptionGenerationFunction optionGenerationFunction)
optionGenerationFunction - the optionGenerationFunction to set.public final void setPlanSelectionStrategy(PlanSelectionStrategy planSelectionStrategy)
planSelectionStrategy - the planSelectionStrategy to set.protected void setup()
protected void takeDown()
public java.lang.String toString()
toString in class java.lang.ObjectObject.toString()