bdi4jade
Changes
bdi-jade/src/bdi4jade/core/Capability.java 33(+25 -8)
bdi-jade/src/bdi4jade/plan/DefaultPlan.java 32(+26 -6)
Details
diff --git a/bdi-jade/src/bdi4jade/core/AbstractBDIAgent.java b/bdi-jade/src/bdi4jade/core/AbstractBDIAgent.java
index d046eef..8dd8548 100644
--- a/bdi-jade/src/bdi4jade/core/AbstractBDIAgent.java
+++ b/bdi-jade/src/bdi4jade/core/AbstractBDIAgent.java
@@ -631,33 +631,23 @@ public abstract class AbstractBDIAgent extends Agent implements BDIAgent {
final void resetAllCapabilities() {
synchronized (aggregatedCapabilities) {
+ Set<Capability> oldCapabilities = this.capabilities;
Set<Capability> allCapabilities = new HashSet<>();
- Set<Capability> capabilitiesToBeProcessed = new HashSet<>(
- aggregatedCapabilities);
-
- while (!capabilitiesToBeProcessed.isEmpty()) {
- Capability current = capabilitiesToBeProcessed.iterator()
- .next();
- capabilitiesToBeProcessed.remove(current);
- allCapabilities.add(current);
- for (Capability part : current.getPartCapabilities()) {
- if (!allCapabilities.contains(part))
- capabilitiesToBeProcessed.add(part);
- }
- for (Capability target : current.getAssociatedCapabilities()) {
- if (!allCapabilities.contains(target))
- capabilitiesToBeProcessed.add(target);
- }
+ for (Capability capability : aggregatedCapabilities) {
+ allCapabilities.add(capability);
+ capability.addRelatedCapabilities(allCapabilities);
}
+ this.capabilities = allCapabilities;
+ log.debug("Capabilities: " + this.capabilities);
- Set<Capability> removedCapabilities = new HashSet<>(capabilities);
+ Set<Capability> removedCapabilities = new HashSet<>(oldCapabilities);
removedCapabilities.removeAll(allCapabilities);
for (Capability capability : removedCapabilities) {
capability.setMyAgent(null);
}
Set<Capability> addedCapabilities = new HashSet<>(allCapabilities);
- addedCapabilities.removeAll(capabilities);
+ addedCapabilities.removeAll(oldCapabilities);
for (Capability capability : addedCapabilities) {
if (capability.getMyAgent() != null) {
throw new IllegalArgumentException(
@@ -666,9 +656,6 @@ public abstract class AbstractBDIAgent extends Agent implements BDIAgent {
}
capability.setMyAgent(this);
}
-
- this.capabilities = allCapabilities;
- log.debug("Capabilities: " + this.capabilities);
}
}
bdi-jade/src/bdi4jade/core/Capability.java 33(+25 -8)
diff --git a/bdi-jade/src/bdi4jade/core/Capability.java b/bdi-jade/src/bdi4jade/core/Capability.java
index 8b26c24..75b38bd 100644
--- a/bdi-jade/src/bdi4jade/core/Capability.java
+++ b/bdi-jade/src/bdi4jade/core/Capability.java
@@ -148,16 +148,17 @@ public class Capability implements Serializable {
this.log = LogFactory.getLog(getClass());
this.intentions = new LinkedList<>();
this.parentCapabilities = generateParentCapabilities();
+ log.debug("Parent capabilities: " + parentCapabilities);
this.started = false;
// Id initialization
if (id == null) {
if (this.getClass().getCanonicalName() == null
|| Capability.class.equals(this.getClass())) {
- this.id = Capability.class.getSimpleName()
+ this.id = Capability.class.getName()
+ System.currentTimeMillis();
} else {
- this.id = this.getClass().getSimpleName();
+ this.id = this.getClass().getName();
}
} else {
this.id = id;
@@ -182,10 +183,6 @@ public class Capability implements Serializable {
this.planSelectionStrategy = new DefaultPlanSelectionStrategy();
computeGoalOwnersMap();
-
- log.debug("Parent capabilities: " + parentCapabilities);
- log.debug("Full access owners: " + fullAccessOwnersMap);
- log.debug("Restricted access owners: " + restrictedAccessOwnersMap);
}
/**
@@ -295,7 +292,8 @@ public class Capability implements Serializable {
public final void addAssociatedCapability(Capability capability) {
this.associationTargets.add(capability);
capability.associationSources.add(this);
- computeGoalOwnersMap();
+ this.computeGoalOwnersMap();
+ capability.computeGoalOwnersMap();
resetAgentCapabilities();
}
@@ -340,10 +338,27 @@ public class Capability implements Serializable {
partCapability.wholeCapability = this;
this.partCapabilities.add(partCapability);
- computeGoalOwnersMap();
+ partCapability.computeGoalOwnersMap();
+ this.computeGoalOwnersMap();
resetAgentCapabilities();
}
+ final Set<Capability> addRelatedCapabilities(Set<Capability> capabilities) {
+ for (Capability part : partCapabilities) {
+ if (!capabilities.contains(part)) {
+ capabilities.add(part);
+ part.addRelatedCapabilities(capabilities);
+ }
+ }
+ for (Capability target : associationTargets) {
+ if (!capabilities.contains(target)) {
+ capabilities.add(target);
+ target.addRelatedCapabilities(capabilities);
+ }
+ }
+ return capabilities;
+ }
+
/**
* Checks if this capability has a plan that can process the given message.
* It checks the plan library of this capabilities and, if cannot handle it,
@@ -380,6 +395,8 @@ public class Capability implements Serializable {
for (Capability capability : partCapabilities) {
ReflectionUtils.addGoalOwner(restrictedAccessOwnersMap, capability);
}
+ log.debug("Full access owners: " + fullAccessOwnersMap);
+ log.debug("Restricted access owners: " + restrictedAccessOwnersMap);
}
/**
diff --git a/bdi-jade/src/bdi4jade/core/Intention.java b/bdi-jade/src/bdi4jade/core/Intention.java
index fe62bc3..dec4efd 100644
--- a/bdi-jade/src/bdi4jade/core/Intention.java
+++ b/bdi-jade/src/bdi4jade/core/Intention.java
@@ -121,9 +121,8 @@ public class Intention {
if (owners.isEmpty()) {
throw new IllegalAccessException("Capability " + dispatcher
+ " has no access to goal "
- + goal.getClass().getSimpleName()
- + " of capability "
- + owner.getClass().getSimpleName());
+ + goal.getClass().getName() + " of capability "
+ + owner.getClass().getName());
}
}
}
diff --git a/bdi-jade/src/bdi4jade/goal/GoalTemplateFactory.java b/bdi-jade/src/bdi4jade/goal/GoalTemplateFactory.java
index a279d7f..b7ef629 100644
--- a/bdi-jade/src/bdi4jade/goal/GoalTemplateFactory.java
+++ b/bdi-jade/src/bdi4jade/goal/GoalTemplateFactory.java
@@ -49,6 +49,10 @@ public abstract class GoalTemplateFactory {
}
return false;
}
+
+ public String toString() {
+ return "belief(" + beliefName + ")";
+ }
};
}
@@ -76,6 +80,11 @@ public abstract class GoalTemplateFactory {
}
return false;
}
+
+ public String toString() {
+ return "beliefSet<" + beliefValueClass.getName() + ">("
+ + beliefName + "(?))";
+ }
};
}
@@ -102,6 +111,10 @@ public abstract class GoalTemplateFactory {
}
return false;
}
+
+ public String toString() {
+ return "beliefSet(" + beliefName + "(" + beliefValue + "))";
+ }
};
}
@@ -129,6 +142,11 @@ public abstract class GoalTemplateFactory {
}
return false;
}
+
+ public String toString() {
+ return "belief<" + beliefValueClass.getName() + ">("
+ + beliefName + "(?))";
+ }
};
}
@@ -155,6 +173,10 @@ public abstract class GoalTemplateFactory {
}
return false;
}
+
+ public String toString() {
+ return "belief(" + beliefName + "(" + beliefValue + "))";
+ }
};
}
@@ -171,6 +193,10 @@ public abstract class GoalTemplateFactory {
public boolean match(Goal goal) {
return goalClass.isInstance(goal);
}
+
+ public String toString() {
+ return "goal(" + goalClass.getName() + ")";
+ }
};
}
@@ -194,6 +220,10 @@ public abstract class GoalTemplateFactory {
}
return false;
}
+
+ public String toString() {
+ return "belief(" + beliefName + "(null))";
+ }
};
}
bdi-jade/src/bdi4jade/plan/DefaultPlan.java 32(+26 -6)
diff --git a/bdi-jade/src/bdi4jade/plan/DefaultPlan.java b/bdi-jade/src/bdi4jade/plan/DefaultPlan.java
index 5f8eae4..1947006 100644
--- a/bdi-jade/src/bdi4jade/plan/DefaultPlan.java
+++ b/bdi-jade/src/bdi4jade/plan/DefaultPlan.java
@@ -40,6 +40,24 @@ import bdi4jade.plan.planbody.PlanBody;
*/
public class DefaultPlan extends AbstractPlan {
+ private static String generateId(Class<? extends Goal> goalClass,
+ GoalTemplate goalTemplate, MessageTemplate messageTemplate,
+ Class<? extends PlanBody> planBodyClass) {
+ StringBuffer sb = new StringBuffer("[");
+ if (goalClass != null) {
+ sb.append(" ").append(goalClass.getName());
+ }
+ if (goalTemplate != null) {
+ sb.append(" ").append(goalTemplate);
+ }
+ if (messageTemplate != null) {
+ sb.append(" ").append(messageTemplate);
+ }
+ sb.append(" ] :: ");
+ sb.append(planBodyClass.getName());
+ return sb.toString();
+ }
+
protected final Class<? extends PlanBody> planBodyClass;
/**
@@ -54,8 +72,8 @@ public class DefaultPlan extends AbstractPlan {
*/
public DefaultPlan(Class<? extends Goal> goalClass,
Class<? extends PlanBody> planBodyClass) {
- super(planBodyClass.getSimpleName(), GoalTemplateFactory
- .goalType(goalClass));
+ super(generateId(goalClass, null, null, planBodyClass),
+ GoalTemplateFactory.goalType(goalClass));
this.planBodyClass = planBodyClass;
}
@@ -68,7 +86,7 @@ public class DefaultPlan extends AbstractPlan {
* the class of this plan body.
*/
public DefaultPlan(Class<? extends PlanBody> planBodyClass) {
- super(planBodyClass.getSimpleName());
+ super(generateId(null, null, null, planBodyClass));
this.planBodyClass = planBodyClass;
}
@@ -87,7 +105,7 @@ public class DefaultPlan extends AbstractPlan {
*/
public DefaultPlan(GoalTemplate goalTemplate,
Class<? extends PlanBody> planBodyClass) {
- super(planBodyClass.getSimpleName(), goalTemplate);
+ super(generateId(null, goalTemplate, null, planBodyClass), goalTemplate);
this.planBodyClass = planBodyClass;
}
@@ -114,7 +132,8 @@ public class DefaultPlan extends AbstractPlan {
public DefaultPlan(GoalTemplate goalTemplate,
MessageTemplate messageTemplate,
Class<? extends PlanBody> planBodyClass) {
- super(planBodyClass.getSimpleName(), goalTemplate, messageTemplate);
+ super(generateId(null, goalTemplate, messageTemplate, planBodyClass),
+ goalTemplate, messageTemplate);
this.planBodyClass = planBodyClass;
}
@@ -134,7 +153,8 @@ public class DefaultPlan extends AbstractPlan {
*/
public DefaultPlan(MessageTemplate messageTemplate,
Class<? extends PlanBody> planBodyClass) {
- super(planBodyClass.getSimpleName(), messageTemplate);
+ super(generateId(null, null, messageTemplate, planBodyClass),
+ messageTemplate);
this.planBodyClass = planBodyClass;
}
diff --git a/bdi-jade-test/src/bdi4jade/examples/BDI4JADEExamplesPanel.java b/bdi-jade-test/src/bdi4jade/examples/BDI4JADEExamplesPanel.java
index fb0111b..6dfe1d4 100644
--- a/bdi-jade-test/src/bdi4jade/examples/BDI4JADEExamplesPanel.java
+++ b/bdi-jade-test/src/bdi4jade/examples/BDI4JADEExamplesPanel.java
@@ -13,6 +13,7 @@ import javax.swing.JOptionPane;
import javax.swing.JPanel;
import bdi4jade.core.AbstractBDIAgent;
+import bdi4jade.core.MultipleCapabilityAgent;
import bdi4jade.core.SingleCapabilityAgent;
import bdi4jade.event.GoalEvent;
import bdi4jade.event.GoalListener;
@@ -23,6 +24,8 @@ import bdi4jade.examples.bdicycle.CompositeGoalCapability.MyGoal3;
import bdi4jade.examples.bdicycle.PlanFailureCapability;
import bdi4jade.examples.bdicycle.PlanFailureCapability.MyGoal;
import bdi4jade.examples.bdicycle.SubgoalCapability;
+import bdi4jade.examples.capabilities.Middle1Capability;
+import bdi4jade.examples.capabilities.TopCapability;
import bdi4jade.examples.helloworld.HelloWorldAgent;
import bdi4jade.examples.helloworld.HelloWorldAnnotatedCapability;
import bdi4jade.examples.ping.PingPongCapability;
@@ -150,6 +153,30 @@ public class BDI4JADEExamplesPanel extends JPanel {
}
+ private class MultiCapabilityAgentAction extends BDI4JADEExamplesAction {
+ private static final long serialVersionUID = 2100583035268414082L;
+
+ private final MultipleCapabilityAgent multiCapabilityAgent;
+
+ public MultiCapabilityAgentAction() {
+ super.putValue(Action.NAME, "Multi-capability Agent");
+ this.multiCapabilityAgent = new MultipleCapabilityAgent(
+ new TopCapability());
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ multiCapabilityAgent.addGoal(new Middle1Capability.TestGoal());
+ }
+
+ @Override
+ public Set<AbstractBDIAgent> getAgents() {
+ Set<AbstractBDIAgent> agents = new HashSet<>();
+ agents.add(multiCapabilityAgent);
+ return agents;
+ }
+ }
+
private class PingPongAction extends BDI4JADEExamplesAction {
public static final String AGENT_1 = "Alice";
@@ -266,13 +293,11 @@ public class BDI4JADEExamplesPanel extends JPanel {
private final BDI4JADEExamplesAction[] actions;
- // new NestedCapabilitiesAgent());
-
public BDI4JADEExamplesPanel() {
this.actions = new BDI4JADEExamplesAction[] { new HelloWorldAction(),
new HelloWorldAnnotatedAction(), new PingPongAction(),
new CompositeGoalAction(), new PlanFailureAction(),
- new SubgoalCapabilityAction() };
+ new SubgoalCapabilityAction(), new MultiCapabilityAgentAction() };
this.setLayout(new GridLayout(actions.length, 1));
for (BDI4JADEExamplesAction action : actions) {
this.add(new JButton(action));
diff --git a/bdi-jade-test/src/bdi4jade/examples/capabilities/BottomCapability.java b/bdi-jade-test/src/bdi4jade/examples/capabilities/BottomCapability.java
new file mode 100644
index 0000000..071525d
--- /dev/null
+++ b/bdi-jade-test/src/bdi4jade/examples/capabilities/BottomCapability.java
@@ -0,0 +1,60 @@
+//----------------------------------------------------------------------------
+// Copyright (C) 2011 Ingrid Nunes
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// To contact the authors:
+// http://inf.ufrgs.br/prosoft/bdi4jade/
+//
+//----------------------------------------------------------------------------
+
+package bdi4jade.examples.capabilities;
+
+import bdi4jade.annotation.GoalOwner;
+import bdi4jade.annotation.TransientBelief;
+import bdi4jade.core.Capability;
+import bdi4jade.goal.Goal;
+import bdi4jade.plan.DefaultPlan;
+import bdi4jade.plan.Plan;
+
+/**
+ * @author Ingrid Nunes
+ */
+public class BottomCapability extends Capability {
+
+ @GoalOwner(capability = BottomCapability.class, internal = false)
+ public static class BottomExternalGoal implements Goal {
+ private static final long serialVersionUID = 7656633869373580240L;
+ }
+
+ @GoalOwner(capability = BottomCapability.class, internal = true)
+ public static class BottomInternalGoal implements Goal {
+ private static final long serialVersionUID = 7656633869373580240L;
+ }
+
+ private static final long serialVersionUID = 377413312476720846L;
+
+ @TransientBelief
+ private String bottomBelief = "BOTTOM_BELIEF";
+
+ @bdi4jade.annotation.Plan
+ private Plan externalGoalPlan = new DefaultPlan(BottomExternalGoal.class,
+ SuccessPlanBody.class);
+
+ @bdi4jade.annotation.Plan
+ private Plan internalGoalPlan = new DefaultPlan(BottomInternalGoal.class,
+ SuccessPlanBody.class);
+
+}
diff --git a/bdi-jade-test/src/bdi4jade/examples/capabilities/Middle1Capability.java b/bdi-jade-test/src/bdi4jade/examples/capabilities/Middle1Capability.java
new file mode 100644
index 0000000..da1162d
--- /dev/null
+++ b/bdi-jade-test/src/bdi4jade/examples/capabilities/Middle1Capability.java
@@ -0,0 +1,72 @@
+//----------------------------------------------------------------------------
+// Copyright (C) 2011 Ingrid Nunes
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// To contact the authors:
+// http://inf.ufrgs.br/prosoft/bdi4jade/
+//
+//----------------------------------------------------------------------------
+
+package bdi4jade.examples.capabilities;
+
+import bdi4jade.annotation.GoalOwner;
+import bdi4jade.annotation.PartCapability;
+import bdi4jade.annotation.TransientBelief;
+import bdi4jade.core.Capability;
+import bdi4jade.goal.Goal;
+import bdi4jade.plan.DefaultPlan;
+import bdi4jade.plan.Plan;
+
+/**
+ * @author Ingrid Nunes
+ */
+public class Middle1Capability extends Capability {
+
+ @GoalOwner(capability = Middle1Capability.class, internal = false)
+ public static class Middle1ExternalGoal implements Goal {
+ private static final long serialVersionUID = -5054184951317760743L;
+ }
+
+ @GoalOwner(capability = Middle1Capability.class, internal = true)
+ public static class Middle1InternalGoal implements Goal {
+ private static final long serialVersionUID = -5054184951317760743L;
+ }
+
+ @GoalOwner(capability = Middle1Capability.class, internal = false)
+ public static class TestGoal implements Goal {
+ private static final long serialVersionUID = -5054184951317760743L;
+ }
+
+ private static final long serialVersionUID = -2281419044730158505L;
+
+ @PartCapability
+ private Capability bottomCapability = new BottomCapability();
+
+ @bdi4jade.annotation.Plan
+ private Plan externalGoalPlan = new DefaultPlan(Middle1ExternalGoal.class,
+ SuccessPlanBody.class);
+
+ @bdi4jade.annotation.Plan
+ private Plan internalGoalPlan = new DefaultPlan(Middle1InternalGoal.class,
+ SuccessPlanBody.class);
+
+ @TransientBelief
+ private String middle1Belief = "MIDDLE1_BELIEF";
+
+ @bdi4jade.annotation.Plan
+ private Plan testPlan = new DefaultPlan(TestGoal.class, TestPlanBody.class);
+
+}
diff --git a/bdi-jade-test/src/bdi4jade/examples/capabilities/Middle2Capability.java b/bdi-jade-test/src/bdi4jade/examples/capabilities/Middle2Capability.java
new file mode 100644
index 0000000..2e5f39d
--- /dev/null
+++ b/bdi-jade-test/src/bdi4jade/examples/capabilities/Middle2Capability.java
@@ -0,0 +1,60 @@
+//----------------------------------------------------------------------------
+// Copyright (C) 2011 Ingrid Nunes
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// To contact the authors:
+// http://inf.ufrgs.br/prosoft/bdi4jade/
+//
+//----------------------------------------------------------------------------
+
+package bdi4jade.examples.capabilities;
+
+import bdi4jade.annotation.GoalOwner;
+import bdi4jade.annotation.TransientBelief;
+import bdi4jade.core.Capability;
+import bdi4jade.goal.Goal;
+import bdi4jade.plan.DefaultPlan;
+import bdi4jade.plan.Plan;
+
+/**
+ * @author Ingrid Nunes
+ */
+public class Middle2Capability extends Capability {
+
+ @GoalOwner(capability = Middle2Capability.class, internal = false)
+ public static class Middle2ExternalGoal implements Goal {
+ private static final long serialVersionUID = 7250708504253085098L;
+ }
+
+ @GoalOwner(capability = Middle2Capability.class, internal = true)
+ public static class Middle2InternalGoal implements Goal {
+ private static final long serialVersionUID = 7250708504253085098L;
+ }
+
+ private static final long serialVersionUID = -8219916691667990451L;
+
+ @bdi4jade.annotation.Plan
+ private Plan externalGoalPlan = new DefaultPlan(Middle2ExternalGoal.class,
+ SuccessPlanBody.class);
+
+ @bdi4jade.annotation.Plan
+ private Plan internalGoalPlan = new DefaultPlan(Middle2InternalGoal.class,
+ SuccessPlanBody.class);
+
+ @TransientBelief
+ private String middle2Belief = "MIDDLE2_BELIEF";
+
+}
diff --git a/bdi-jade-test/src/bdi4jade/examples/capabilities/TopCapability.java b/bdi-jade-test/src/bdi4jade/examples/capabilities/TopCapability.java
new file mode 100644
index 0000000..b1de9f0
--- /dev/null
+++ b/bdi-jade-test/src/bdi4jade/examples/capabilities/TopCapability.java
@@ -0,0 +1,67 @@
+//----------------------------------------------------------------------------
+// Copyright (C) 2011 Ingrid Nunes
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// To contact the authors:
+// http://inf.ufrgs.br/prosoft/bdi4jade/
+//
+//----------------------------------------------------------------------------
+
+package bdi4jade.examples.capabilities;
+
+import bdi4jade.annotation.GoalOwner;
+import bdi4jade.annotation.PartCapability;
+import bdi4jade.annotation.TransientBelief;
+import bdi4jade.core.Capability;
+import bdi4jade.goal.Goal;
+import bdi4jade.plan.DefaultPlan;
+import bdi4jade.plan.Plan;
+
+/**
+ * @author Ingrid Nunes
+ */
+public class TopCapability extends Capability {
+
+ @GoalOwner(capability = TopCapability.class, internal = false)
+ public static class TopExternalGoal implements Goal {
+ private static final long serialVersionUID = 1371943799864265143L;
+ }
+
+ @GoalOwner(capability = TopCapability.class, internal = true)
+ public static class TopInternalGoal implements Goal {
+ private static final long serialVersionUID = 1371943799864265143L;
+ }
+
+ private static final long serialVersionUID = -8981563986693758609L;
+
+ @bdi4jade.annotation.Plan
+ private Plan externalGoalPlan = new DefaultPlan(TopExternalGoal.class,
+ SuccessPlanBody.class);
+
+ @bdi4jade.annotation.Plan
+ private Plan internalGoalPlan = new DefaultPlan(TopInternalGoal.class,
+ SuccessPlanBody.class);
+
+ @PartCapability
+ private Capability middle1Capability = new Middle1Capability();
+
+ @PartCapability
+ private Capability middle2Capability = new Middle2Capability();
+
+ @TransientBelief
+ private String topBelief = "TOP_BELIEF";
+
+}
diff --git a/bdi-jade-test/src/bdi4jade/examples/log4j.properties b/bdi-jade-test/src/bdi4jade/examples/log4j.properties
index 0a27ef3..ccea3e4 100644
--- a/bdi-jade-test/src/bdi4jade/examples/log4j.properties
+++ b/bdi-jade-test/src/bdi4jade/examples/log4j.properties
@@ -29,6 +29,6 @@ log4j.logger.org.apache.struts2=FATAL
# Spring Stuff
log4j.logger.org.springframework=FATAL
-log4j.logger.bdi4jade=WARN
+log4j.logger.bdi4jade=DEBUG
log4j.logger.bdi4jade.examples=DEBUG