bdi4jade
Changes
bdi-jade/src/bdi4jade/belief/Belief.java 11(+9 -2)
bdi-jade/src/bdi4jade/belief/BeliefBase.java 90(+32 -58)
bdi-jade/src/bdi4jade/core/BDIAgent.java 15(+8 -7)
bdi-jade/src/bdi4jade/core/Capability.java 143(+79 -64)
bdi-jade/src/bdi4jade/plan/PlanLibrary.java 39(+9 -30)
Details
diff --git a/bdi-jade/src/bdi4jade/belief/AbstractBelief.java b/bdi-jade/src/bdi4jade/belief/AbstractBelief.java
index 85cc5d8..5bce3f4 100644
--- a/bdi-jade/src/bdi4jade/belief/AbstractBelief.java
+++ b/bdi-jade/src/bdi4jade/belief/AbstractBelief.java
@@ -50,7 +50,7 @@ public abstract class AbstractBelief<T> extends MetadataElementImpl implements
*/
public AbstractBelief(String name) {
if (name == null)
- throw new InvalidParameterException("Belief name must be not null.");
+ throw new NullPointerException("Belief name must be not null.");
this.name = name;
this.beliefBases = new HashSet<BeliefBase>();
}
@@ -92,10 +92,12 @@ public abstract class AbstractBelief<T> extends MetadataElementImpl implements
}
/**
- * @return the beliefBases
+ * Returns the belief bases with which this belief is associated.
+ *
+ * @return the beliefBases.
*/
public Set<BeliefBase> getBeliefBases() {
- return beliefBases;
+ return new HashSet<BeliefBase>(beliefBases);
}
/**
@@ -108,17 +110,10 @@ public abstract class AbstractBelief<T> extends MetadataElementImpl implements
}
/**
- * Gets the current value of the Belief.
- *
- * @return the belief value.
- */
- public abstract T getValue();
-
- /**
* @see java.lang.Object#hashCode()
*/
@Override
- public int hashCode() {
+ public final int hashCode() {
return this.name.hashCode();
}
bdi-jade/src/bdi4jade/belief/Belief.java 11(+9 -2)
diff --git a/bdi-jade/src/bdi4jade/belief/Belief.java b/bdi-jade/src/bdi4jade/belief/Belief.java
index ecf353a..0e9566c 100644
--- a/bdi-jade/src/bdi4jade/belief/Belief.java
+++ b/bdi-jade/src/bdi4jade/belief/Belief.java
@@ -47,10 +47,17 @@ public interface Belief<T> extends MetadataElement, Serializable, Concept {
public void addBeliefBase(BeliefBase beliefBase);
/**
- * @return the beliefBases
+ * Returns the belief bases with which this belief is associated.
+ *
+ * @return the beliefBases.
*/
public Set<BeliefBase> getBeliefBases();
+ /**
+ * Returns the name of this belief.
+ *
+ * @return the string that is the belief name.
+ */
public String getName();
/**
@@ -65,7 +72,7 @@ public interface Belief<T> extends MetadataElement, Serializable, Concept {
* agent whose capability does not contain this belief in the belief base
* does not believe in this belief anymore.
*
- * @param beliefBases
+ * @param beliefBase
* the belief base to be removed.
*/
public void removeBeliefBase(BeliefBase beliefBase);
bdi-jade/src/bdi4jade/belief/BeliefBase.java 90(+32 -58)
diff --git a/bdi-jade/src/bdi4jade/belief/BeliefBase.java b/bdi-jade/src/bdi4jade/belief/BeliefBase.java
index 3ea3705..8d5b988 100644
--- a/bdi-jade/src/bdi4jade/belief/BeliefBase.java
+++ b/bdi-jade/src/bdi4jade/belief/BeliefBase.java
@@ -44,30 +44,38 @@ import bdi4jade.exception.BeliefAlreadyExistsException;
*
* @author ingrid
*/
-public class BeliefBase implements Serializable {
+public final class BeliefBase implements Serializable {
private static final long serialVersionUID = -6411530721625492882L;
private final Set<BeliefListener> beliefListeners;
private final Map<String, Belief<?>> beliefs;
- private Capability capability;
+ private final Capability capability;
/**
- * Creates a belief base.
+ * Creates a belief base associated with a capability.
+ *
+ * @param capability
+ * the capability to which this belief base belongs
*/
- public BeliefBase() {
- this(null);
+ public BeliefBase(final Capability capability) {
+ this(capability, null);
}
/**
* Creates a belief base associated with a capability and adds the beliefs
* in the provided belief set.
*
+ * @param capability
+ * the capability to which this belief base belongs
* @param beliefs
* the initial beliefs
*/
- public BeliefBase(Set<Belief<?>> beliefs) {
- this.capability = null;
+ public BeliefBase(final Capability capability, Set<Belief<?>> beliefs) {
+ if (capability == null)
+ throw new NullPointerException("Capability must be not null.");
+
+ this.capability = capability;
this.beliefListeners = new HashSet<BeliefListener>();
this.beliefs = new HashMap<String, Belief<?>>();
if (beliefs != null) {
@@ -132,8 +140,9 @@ public class BeliefBase implements Serializable {
private void getAllBeliefs(final Collection<Belief<?>> beliefs) {
beliefs.addAll(this.beliefs.values());
- if (capability != null && capability.getParent() != null) {
- capability.getParent().getBeliefBase().getAllBeliefs(beliefs);
+ if (capability.getWholeCapability() != null) {
+ capability.getWholeCapability().getBeliefBase()
+ .getAllBeliefs(beliefs);
}
}
@@ -148,9 +157,9 @@ public class BeliefBase implements Serializable {
*/
public Belief<?> getBelief(String name) {
Belief<?> belief = this.beliefs.get(name);
- if (belief == null && capability != null
- && capability.getParent() != null) {
- belief = capability.getParent().getBeliefBase().getBelief(name);
+ if (belief == null && capability.getWholeCapability() != null) {
+ belief = capability.getWholeCapability().getBeliefBase()
+ .getBelief(name);
}
return belief;
}
@@ -159,7 +168,7 @@ public class BeliefBase implements Serializable {
* @return the beliefListeners
*/
public Set<BeliefListener> getBeliefListeners() {
- return beliefListeners;
+ return new HashSet<BeliefListener>(beliefListeners);
}
/**
@@ -168,10 +177,7 @@ public class BeliefBase implements Serializable {
* @return the beliefs
*/
public Set<Belief<?>> getBeliefs() {
- Set<Belief<?>> beliefValues = new HashSet<Belief<?>>(beliefs.size());
- for (Belief<?> belief : beliefs.values())
- beliefValues.add(belief);
- return beliefValues;
+ return new HashSet<Belief<?>>(beliefs.values());
}
/**
@@ -202,19 +208,14 @@ public class BeliefBase implements Serializable {
*/
public boolean hasBelief(String name) {
boolean hasBelief = this.beliefs.containsKey(name);
- if (!hasBelief && capability != null && capability.getParent() != null) {
- hasBelief = capability.getParent().getBeliefBase().hasBelief(name);
+ if (!hasBelief && capability.getWholeCapability() != null) {
+ hasBelief = capability.getWholeCapability().getBeliefBase()
+ .hasBelief(name);
}
return hasBelief;
}
/**
- * Initialize the belief base, adding initial beliefs.
- */
- protected void init() {
- }
-
- /**
* Notifies the capability associate with this BeliefBase that a belief was
* modified.
*
@@ -225,10 +226,8 @@ public class BeliefBase implements Serializable {
for (BeliefListener beliefListener : beliefListeners) {
beliefListener.update(beliefChanged);
}
- if (capability != null) {
- for (Capability child : capability.getChildren()) {
- child.getBeliefBase().notifyBeliefChanged(beliefChanged);
- }
+ for (Capability child : capability.getPartCapabilities()) {
+ child.getBeliefBase().notifyBeliefChanged(beliefChanged);
}
}
@@ -246,8 +245,8 @@ public class BeliefBase implements Serializable {
belief.removeBeliefBase(this);
notifyBeliefChanged(new BeliefEvent(belief, Action.BELIEF_REMOVED));
} else {
- if (capability != null && capability.getParent() != null) {
- belief = capability.getParent().getBeliefBase()
+ if (capability.getWholeCapability() != null) {
+ belief = capability.getWholeCapability().getBeliefBase()
.removeBelief(name);
}
}
@@ -265,31 +264,6 @@ public class BeliefBase implements Serializable {
}
/**
- * This method is an empty place holder for subclasses. It may be invoked to
- * review beliefs from this belief base.
- */
- public void reviewBeliefs() {
-
- }
-
- /**
- * Sets the capability of this belief base. If the capability was already
- * set, it throws a {@link RuntimeException}. After setting the capability,
- * the {@link #init()} method is invoked.
- *
- * @param capability
- * the capability to set
- */
- public void setCapability(Capability capability) {
- if (this.capability != null) {
- throw new RuntimeException(
- "BeliefBase already binded to another capability!");
- }
- this.capability = capability;
- this.init();
- }
-
- /**
* Gets the size of this belief base (the number of beliefs).
*
* @return the size of this belief base.
@@ -325,8 +299,8 @@ public class BeliefBase implements Serializable {
if (belief != null) {
belief.setValue(value);
return true;
- } else if (capability != null && capability.getParent() != null) {
- return capability.getParent().getBeliefBase()
+ } else if (capability.getWholeCapability() != null) {
+ return capability.getWholeCapability().getBeliefBase()
.updateBelief(name, value);
}
return false;
diff --git a/bdi-jade/src/bdi4jade/belief/PersistentBelief.java b/bdi-jade/src/bdi4jade/belief/PersistentBelief.java
index 6eea7dd..e1fb04e 100644
--- a/bdi-jade/src/bdi4jade/belief/PersistentBelief.java
+++ b/bdi-jade/src/bdi4jade/belief/PersistentBelief.java
@@ -48,7 +48,7 @@ public class PersistentBelief<T> extends AbstractBelief<T> {
@Override
public T getValue() {
// XXX PersistentBelief.getValue()
- return null;
+ throw new RuntimeException("Not implemented yet!");
}
/**
@@ -56,6 +56,7 @@ public class PersistentBelief<T> extends AbstractBelief<T> {
*/
protected void updateValue(T value) {
// XXX PersistentBelief.setValue(T value)
+ throw new RuntimeException("Not implemented yet!");
}
}
diff --git a/bdi-jade/src/bdi4jade/belief/TransientBeliefSet.java b/bdi-jade/src/bdi4jade/belief/TransientBeliefSet.java
index 02ccb14..efe8e3f 100644
--- a/bdi-jade/src/bdi4jade/belief/TransientBeliefSet.java
+++ b/bdi-jade/src/bdi4jade/belief/TransientBeliefSet.java
@@ -63,7 +63,7 @@ public class TransientBeliefSet<T> extends AbstractBeliefSet<T> implements
}
/**
- * @see bdi4jade.belief.BeliefSet#addValue(java.lang.Object)
+ * @see bdi4jade.belief.AbstractBeliefSet#addSetValue(Object)
*/
@Override
protected void addSetValue(T value) {
@@ -71,7 +71,7 @@ public class TransientBeliefSet<T> extends AbstractBeliefSet<T> implements
}
/**
- * @see bdi4jade.belief.AbstractBelief#getValue()
+ * @see bdi4jade.belief.Belief#getValue()
*/
@Override
public Set<T> getValue() {
@@ -95,7 +95,7 @@ public class TransientBeliefSet<T> extends AbstractBeliefSet<T> implements
}
/**
- * @see bdi4jade.belief.BeliefSet#removeValue(java.lang.Object)
+ * @see bdi4jade.belief.AbstractBeliefSet#removeSetValue(Object)
*/
@Override
protected boolean removeSetValue(T value) {
bdi-jade/src/bdi4jade/core/BDIAgent.java 15(+8 -7)
diff --git a/bdi-jade/src/bdi4jade/core/BDIAgent.java b/bdi-jade/src/bdi4jade/core/BDIAgent.java
index 300a7c9..1668f57 100644
--- a/bdi-jade/src/bdi4jade/core/BDIAgent.java
+++ b/bdi-jade/src/bdi4jade/core/BDIAgent.java
@@ -225,12 +225,12 @@ public class BDIAgent extends Agent {
*/
public void addCapability(Capability capability) {
synchronized (rootCapability) {
- if (capability.getParent() != null) {
+ if (capability.getWholeCapability() != null) {
throw new RuntimeException(
"Capability already binded to another capability!");
}
- this.rootCapability.addChild(capability);
+ this.rootCapability.addPartCapability(capability);
capability.setMyAgent(this);
}
}
@@ -351,7 +351,7 @@ public class BDIAgent extends Agent {
private void getAllBeliefs(final Collection<Belief<?>> beliefs,
Capability capability) {
beliefs.addAll(capability.getBeliefBase().getBeliefs());
- for (Capability child : capability.getChildren()) {
+ for (Capability child : capability.getPartCapabilities()) {
getAllBeliefs(beliefs, child);
}
}
@@ -370,7 +370,7 @@ public class BDIAgent extends Agent {
private void getAllCapabilities(final List<Capability> capabilities,
Capability capability) {
capabilities.add(capability);
- Set<Capability> children = capability.getChildren();
+ Set<Capability> children = capability.getPartCapabilities();
for (Capability child : children) {
getAllCapabilities(capabilities, child);
}
@@ -470,7 +470,8 @@ public class BDIAgent extends Agent {
*/
public boolean removeCapability(Capability capability) {
synchronized (rootCapability) {
- boolean removed = this.rootCapability.removeChild(capability);
+ boolean removed = this.rootCapability
+ .removePartCapability(capability);
if (removed) {
capability.setMyAgent(null);
}
@@ -568,9 +569,9 @@ public class BDIAgent extends Agent {
@Override
protected void takeDown() {
synchronized (rootCapability) {
- Set<Capability> capabilities = rootCapability.getChildren();
+ Set<Capability> capabilities = rootCapability.getPartCapabilities();
for (Capability capability : capabilities) {
- rootCapability.removeChild(capability);
+ rootCapability.removePartCapability(capability);
}
}
}
bdi-jade/src/bdi4jade/core/Capability.java 143(+79 -64)
diff --git a/bdi-jade/src/bdi4jade/core/Capability.java b/bdi-jade/src/bdi4jade/core/Capability.java
index 8d50baf..567ec82 100644
--- a/bdi-jade/src/bdi4jade/core/Capability.java
+++ b/bdi-jade/src/bdi4jade/core/Capability.java
@@ -31,7 +31,9 @@ import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import bdi4jade.belief.Belief;
import bdi4jade.belief.BeliefBase;
+import bdi4jade.plan.Plan;
import bdi4jade.plan.PlanLibrary;
/**
@@ -46,13 +48,13 @@ public class Capability implements Serializable {
private static final long serialVersionUID = -4922359927943108421L;
protected final BeliefBase beliefBase;
- protected final Set<Capability> children;
protected final String id;
- private final Log log;
+ protected final Log log;
protected BDIAgent myAgent;
- protected Capability parent;
+ protected final Set<Capability> partCapabilities;
protected final PlanLibrary planLibrary;
private boolean start;
+ protected Capability wholeCapability;
/**
* Creates a new capability. It uses {@link BeliefBase} and
@@ -65,13 +67,15 @@ public class Capability implements Serializable {
/**
* Creates a new capability.
*
- * @param beliefBase
- * the belief base of this capability.
- * @param planLibrary
- * the plan library of this capability.
+ * @param initialBeliefs
+ * the initial set of beliefs to be added to the belief base of
+ * this capability.
+ * @param initialPlans
+ * the initial set of plans to be added to the plan library of
+ * this capability.
*/
- public Capability(BeliefBase beliefBase, PlanLibrary planLibrary) {
- this(null, beliefBase, planLibrary);
+ public Capability(Set<Belief<?>> initialBeliefs, Set<Plan> initialPlans) {
+ this(null, initialBeliefs, initialPlans);
}
/**
@@ -83,22 +87,7 @@ public class Capability implements Serializable {
* be used.
*/
public Capability(String id) {
- this(id, new BeliefBase(), new PlanLibrary());
- }
-
- /**
- * Creates a new capability.
- *
- * @param id
- * the capability id. If it is null, the class name is going to
- * be used.
- * @param beliefBase
- * the belief base of this capability.
- * @param planLibrary
- * the plan library of this capability.
- */
- public Capability(String id, BeliefBase beliefBase, PlanLibrary planLibrary) {
- this(id, null, beliefBase, planLibrary);
+ this(id, null, null);
}
/**
@@ -108,11 +97,11 @@ public class Capability implements Serializable {
* @param id
* the capability id. If it is null, the class name is going to
* be used.
- * @param parent
- * the parent of this capability.
+ * @param wholeCapability
+ * the whole-capability that this capability is part of.
*/
- public Capability(String id, Capability parent) {
- this(id, parent, new BeliefBase(), new PlanLibrary());
+ public Capability(String id, Capability wholeCapability) {
+ this(id, wholeCapability, null, null);
}
/**
@@ -121,15 +110,17 @@ public class Capability implements Serializable {
* @param id
* the capability id. If it is null, the class name is going to
* be used.
- * @param parent
- * the parent of this capability.
- * @param beliefBase
- * the belief base of this capability.
- * @param planLibrary
- * the plan library of this capability.
+ * @param wholeCapability
+ * the whole-capability that this capability is part of.
+ * @param initialBeliefs
+ * the initial set of beliefs to be added to the belief base of
+ * this capability.
+ * @param initialPlans
+ * the initial set of plans to be added to the plan library of
+ * this capability.
*/
- public Capability(String id, Capability parent, BeliefBase beliefBase,
- PlanLibrary planLibrary) {
+ public Capability(String id, Capability wholeCapability,
+ Set<Belief<?>> initialBeliefs, Set<Plan> initialPlans) {
this.log = LogFactory.getLog(getClass());
// Id initialization
@@ -146,28 +137,44 @@ public class Capability implements Serializable {
}
// Setting up parent
- this.children = new HashSet<>();
- if (parent != null) {
- parent.addChild(this);
+ this.partCapabilities = new HashSet<>();
+ if (wholeCapability != null) {
+ wholeCapability.addPartCapability(this);
}
// Initializing belief base
- beliefBase.setCapability(this);
- this.beliefBase = beliefBase;
+ this.beliefBase = new BeliefBase(this, initialBeliefs);
// Initializing plan library
- planLibrary.setCapability(this);
- this.planLibrary = planLibrary;
+ this.planLibrary = new PlanLibrary(this, initialPlans);
this.start = false;
}
- public void addChild(Capability capability) {
- if (capability.parent != null) {
- capability.parent.removeChild(capability);
+ /**
+ * Creates a new capability.
+ *
+ * @param id
+ * the capability id. If it is null, the class name is going to
+ * be used.
+ * @param initialBeliefs
+ * the initial set of beliefs to be added to the belief base of
+ * this capability.
+ * @param initialPlans
+ * the initial set of plans to be added to the plan library of
+ * this capability.
+ */
+ public Capability(String id, Set<Belief<?>> initialBeliefs,
+ Set<Plan> initialPlans) {
+ this(id, null, initialBeliefs, initialPlans);
+ }
+
+ public void addPartCapability(Capability partCapability) {
+ if (partCapability.wholeCapability != null) {
+ partCapability.wholeCapability.removePartCapability(partCapability);
}
- capability.parent = this;
- this.children.add(capability);
+ partCapability.wholeCapability = this;
+ this.partCapabilities.add(partCapability);
}
/**
@@ -190,13 +197,6 @@ public class Capability implements Serializable {
}
/**
- * @return the children
- */
- public Set<Capability> getChildren() {
- return new HashSet<>(children);
- }
-
- /**
* @return the id
*/
public String getId() {
@@ -211,10 +211,10 @@ public class Capability implements Serializable {
}
/**
- * @return the parent
+ * @return the partCapabilities
*/
- public Capability getParent() {
- return parent;
+ public Set<Capability> getPartCapabilities() {
+ return partCapabilities;
}
/**
@@ -224,19 +224,34 @@ public class Capability implements Serializable {
return planLibrary;
}
- public boolean hasChildren() {
- return !this.children.isEmpty();
+ /**
+ * @return the wholeCapability
+ */
+ public Capability getWholeCapability() {
+ return wholeCapability;
}
- public boolean removeChild(Capability capability) {
- boolean removed = this.children.remove(capability);
+ public boolean hasParts() {
+ return !this.partCapabilities.isEmpty();
+ }
+
+ public boolean removePartCapability(Capability partCapability) {
+ boolean removed = this.partCapabilities.remove(partCapability);
if (removed) {
- capability.parent = null;
+ partCapability.wholeCapability = null;
}
return removed;
}
/**
+ * This method is an empty place holder for subclasses. It may be invoked to
+ * review beliefs from this belief base.
+ */
+ public void reviewBeliefs() {
+
+ }
+
+ /**
* @param myAgent
* the myAgent to set
*/
diff --git a/bdi-jade/src/bdi4jade/core/Intention.java b/bdi-jade/src/bdi4jade/core/Intention.java
index 688c6d5..13588e6 100644
--- a/bdi-jade/src/bdi4jade/core/Intention.java
+++ b/bdi-jade/src/bdi4jade/core/Intention.java
@@ -216,7 +216,7 @@ public class Intention {
private void getCanAchievePlans(final Set<Plan> plans, Capability capability) {
plans.addAll(capability.getPlanLibrary().canAchievePlans(goal));
- for (Capability child : capability.getChildren()) {
+ for (Capability child : capability.getPartCapabilities()) {
getCanAchievePlans(plans, child);
}
}
diff --git a/bdi-jade/src/bdi4jade/message/BDIAgentMsgReceiver.java b/bdi-jade/src/bdi4jade/message/BDIAgentMsgReceiver.java
index 11926aa..a286361 100644
--- a/bdi-jade/src/bdi4jade/message/BDIAgentMsgReceiver.java
+++ b/bdi-jade/src/bdi4jade/message/BDIAgentMsgReceiver.java
@@ -56,7 +56,7 @@ public class BDIAgentMsgReceiver extends MsgReceiver {
if (capability.canProcess(msg)) {
capabilities.add(capability);
}
- for (Capability child : capability.getChildren()) {
+ for (Capability child : capability.getPartCapabilities()) {
getCanProcessCapabilities(msg, capabilities, child);
}
}
bdi-jade/src/bdi4jade/plan/PlanLibrary.java 39(+9 -30)
diff --git a/bdi-jade/src/bdi4jade/plan/PlanLibrary.java b/bdi-jade/src/bdi4jade/plan/PlanLibrary.java
index fd8b200..872adb8 100644
--- a/bdi-jade/src/bdi4jade/plan/PlanLibrary.java
+++ b/bdi-jade/src/bdi4jade/plan/PlanLibrary.java
@@ -42,18 +42,18 @@ import bdi4jade.util.plan.SequentialGoalPlanBody;
* @author ingrid
*/
// XXX PlanLibrary - create indexes to optimize plan matches
-public class PlanLibrary implements Serializable {
+public final class PlanLibrary implements Serializable {
private static final long serialVersionUID = 3038533629659859857L;
- private Capability capability;
+ private final Capability capability;
private final Set<Plan> plans;
/**
* Creates a plan library.
*/
- public PlanLibrary() {
- this(null);
+ public PlanLibrary(final Capability capability) {
+ this(capability, null);
}
/**
@@ -63,8 +63,11 @@ public class PlanLibrary implements Serializable {
* @param plans
* the initial plans
*/
- public PlanLibrary(Set<Plan> plans) {
- this.capability = null;
+ public PlanLibrary(final Capability capability, Set<Plan> plans) {
+ if (capability == null)
+ throw new NullPointerException("Capability must be not null.");
+
+ this.capability = capability;
this.plans = new HashSet<Plan>();
if (plans != null) {
for (Plan plan : plans) {
@@ -72,7 +75,6 @@ public class PlanLibrary implements Serializable {
}
}
addDefaultPlans();
- init();
}
/**
@@ -156,12 +158,6 @@ public class PlanLibrary implements Serializable {
}
/**
- * Initialize the plan library, adding initial plans.
- */
- protected void init() {
- }
-
- /**
* Removes a plan from the plan library.
*
* @param plan
@@ -176,21 +172,4 @@ public class PlanLibrary implements Serializable {
return removed;
}
- /**
- * Sets the capability of this plan library. If the capability was already
- * set, it throws a {@link RuntimeException}. After setting the capability,
- * the {@link #init()} method is invoked.
- *
- * @param capability
- * the capability to set
- */
- public void setCapability(Capability capability) {
- if (this.capability != null) {
- throw new RuntimeException(
- "PlanLibrary already binded to another capability!");
- }
- this.capability = capability;
- this.init();
- }
-
}
diff --git a/bdi-jade/src/bdi4jade/util/reasoning/DefaultBeliefRevisionStrategy.java b/bdi-jade/src/bdi4jade/util/reasoning/DefaultBeliefRevisionStrategy.java
index 263641d..5614881 100644
--- a/bdi-jade/src/bdi4jade/util/reasoning/DefaultBeliefRevisionStrategy.java
+++ b/bdi-jade/src/bdi4jade/util/reasoning/DefaultBeliefRevisionStrategy.java
@@ -48,8 +48,8 @@ public class DefaultBeliefRevisionStrategy implements BeliefRevisionStrategy {
}
public void reviewBeliefs(Capability capability) {
- capability.getBeliefBase().reviewBeliefs();
- for (Capability child : capability.getChildren()) {
+ capability.reviewBeliefs();
+ for (Capability child : capability.getPartCapabilities()) {
reviewBeliefs(child);
}
}
diff --git a/bdi-jade-test/src/bdi4jade/examples/compositegoal/CompositeGoalCapability.java b/bdi-jade-test/src/bdi4jade/examples/compositegoal/CompositeGoalCapability.java
index 71811a9..78b6805 100644
--- a/bdi-jade-test/src/bdi4jade/examples/compositegoal/CompositeGoalCapability.java
+++ b/bdi-jade-test/src/bdi4jade/examples/compositegoal/CompositeGoalCapability.java
@@ -30,14 +30,12 @@ import org.apache.commons.logging.LogFactory;
import bdi4jade.annotation.Parameter;
import bdi4jade.annotation.Parameter.Direction;
-import bdi4jade.belief.BeliefBase;
import bdi4jade.core.Capability;
import bdi4jade.event.GoalEvent;
import bdi4jade.event.GoalFinishedEvent;
import bdi4jade.event.GoalListener;
import bdi4jade.goal.Goal;
import bdi4jade.plan.Plan;
-import bdi4jade.plan.PlanLibrary;
import bdi4jade.plan.SimplePlan;
import bdi4jade.util.goal.CompositeGoal;
import bdi4jade.util.goal.ParallelGoal;
@@ -129,7 +127,7 @@ public class CompositeGoalCapability extends Capability implements GoalListener
private boolean sequential;
public CompositeGoalCapability(boolean sequential) {
- super(new BeliefBase(), new PlanLibrary(getPlans()));
+ super(null, getPlans());
this.sequential = sequential;
}
diff --git a/bdi-jade-test/src/bdi4jade/examples/nestedcapabilities/NestedCapabilitiesAgent.java b/bdi-jade-test/src/bdi4jade/examples/nestedcapabilities/NestedCapabilitiesAgent.java
index d801d9d..d64b8bf 100644
--- a/bdi-jade-test/src/bdi4jade/examples/nestedcapabilities/NestedCapabilitiesAgent.java
+++ b/bdi-jade-test/src/bdi4jade/examples/nestedcapabilities/NestedCapabilitiesAgent.java
@@ -74,9 +74,9 @@ public class NestedCapabilitiesAgent extends BDIAgent {
addBelief(child, Belief.CHILD_BELIEF);
addPlan(child, ChildGoal.class, SuccessPlanBody.class);
- getRootCapability().addChild(capability);
- getRootCapability().addChild(sibling);
- capability.addChild(child);
+ getRootCapability().addPartCapability(capability);
+ getRootCapability().addPartCapability(sibling);
+ capability.addPartCapability(child);
addGoal(new TestGoal());
}
diff --git a/bdi-jade-test/src/bdi4jade/examples/ping/PingPongCapability.java b/bdi-jade-test/src/bdi4jade/examples/ping/PingPongCapability.java
index 9e7960b..865c9c7 100644
--- a/bdi-jade-test/src/bdi4jade/examples/ping/PingPongCapability.java
+++ b/bdi-jade-test/src/bdi4jade/examples/ping/PingPongCapability.java
@@ -27,10 +27,8 @@ import jade.lang.acl.MessageTemplate;
import java.util.HashSet;
import java.util.Set;
-import bdi4jade.belief.BeliefBase;
import bdi4jade.core.Capability;
import bdi4jade.plan.Plan;
-import bdi4jade.plan.PlanLibrary;
import bdi4jade.plan.SimplePlan;
/**
@@ -55,7 +53,7 @@ public class PingPongCapability extends Capability {
private String otherAgent;
public PingPongCapability(String id, String otherAgent) {
- super(id, new BeliefBase(), new PlanLibrary(getPlans()));
+ super(id, null, getPlans());
this.otherAgent = otherAgent;
}
diff --git a/bdi-jade-test/src/bdi4jade/examples/planfailed/PlanFailedCapability.java b/bdi-jade-test/src/bdi4jade/examples/planfailed/PlanFailedCapability.java
index b58029f..280dc76 100644
--- a/bdi-jade-test/src/bdi4jade/examples/planfailed/PlanFailedCapability.java
+++ b/bdi-jade-test/src/bdi4jade/examples/planfailed/PlanFailedCapability.java
@@ -28,14 +28,12 @@ import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import bdi4jade.belief.BeliefBase;
import bdi4jade.core.Capability;
import bdi4jade.event.GoalEvent;
import bdi4jade.event.GoalFinishedEvent;
import bdi4jade.event.GoalListener;
import bdi4jade.goal.Goal;
import bdi4jade.plan.Plan;
-import bdi4jade.plan.PlanLibrary;
import bdi4jade.plan.SimplePlan;
/**
@@ -74,7 +72,7 @@ public class PlanFailedCapability extends Capability implements GoalListener {
private int counter;
public PlanFailedCapability() {
- super(new BeliefBase(), new PlanLibrary(getPlans()));
+ super(null, getPlans());
}
@Override
diff --git a/bdi-jade-test/src/bdi4jade/examples/subgoal/SubgoalCapability.java b/bdi-jade-test/src/bdi4jade/examples/subgoal/SubgoalCapability.java
index 8b8b60c..098f66d 100644
--- a/bdi-jade-test/src/bdi4jade/examples/subgoal/SubgoalCapability.java
+++ b/bdi-jade-test/src/bdi4jade/examples/subgoal/SubgoalCapability.java
@@ -25,10 +25,8 @@ package bdi4jade.examples.subgoal;
import java.util.HashSet;
import java.util.Set;
-import bdi4jade.belief.BeliefBase;
import bdi4jade.core.Capability;
import bdi4jade.plan.Plan;
-import bdi4jade.plan.PlanLibrary;
import bdi4jade.plan.SimplePlan;
/**
@@ -48,7 +46,7 @@ public class SubgoalCapability extends Capability {
}
public SubgoalCapability() {
- super(new BeliefBase(), new PlanLibrary(getPlans()));
+ super(null, getPlans());
}
@Override