bdi4jade

getCapability() in plan bodies

8/27/2014 7:19:04 PM

Details

diff --git a/bdi-jade/src/bdi4jade/plan/planbody/AbstractPlanBody.java b/bdi-jade/src/bdi4jade/plan/planbody/AbstractPlanBody.java
index fd800b6..02ee1be 100644
--- a/bdi-jade/src/bdi4jade/plan/planbody/AbstractPlanBody.java
+++ b/bdi-jade/src/bdi4jade/plan/planbody/AbstractPlanBody.java
@@ -33,6 +33,7 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
 import bdi4jade.belief.BeliefBase;
+import bdi4jade.core.Capability;
 import bdi4jade.core.Intention;
 import bdi4jade.event.GoalEvent;
 import bdi4jade.event.GoalListener;
@@ -144,6 +145,13 @@ public abstract class AbstractPlanBody extends Behaviour implements PlanBody {
 	}
 
 	/**
+	 * @see PlanBody#getCapability()
+	 */
+	public Capability getCapability() {
+		return this.plan.getPlanLibrary().getCapability();
+	}
+
+	/**
 	 * Returns the end state of plan. A null value means that the plan is still
 	 * executing.
 	 * 
diff --git a/bdi-jade/src/bdi4jade/plan/planbody/FSMPlanBody.java b/bdi-jade/src/bdi4jade/plan/planbody/FSMPlanBody.java
index 8c564ab..e0769be 100644
--- a/bdi-jade/src/bdi4jade/plan/planbody/FSMPlanBody.java
+++ b/bdi-jade/src/bdi4jade/plan/planbody/FSMPlanBody.java
@@ -24,6 +24,7 @@ package bdi4jade.plan.planbody;
 
 import jade.core.behaviours.FSMBehaviour;
 import bdi4jade.belief.BeliefBase;
+import bdi4jade.core.Capability;
 import bdi4jade.core.Intention;
 import bdi4jade.event.GoalEvent;
 import bdi4jade.exception.PlanInstantiationException;
@@ -70,6 +71,10 @@ public class FSMPlanBody extends FSMBehaviour implements PlanBody {
 		return abstractPlanBody.getBeliefBase();
 	}
 
+	public Capability getCapability() {
+		return abstractPlanBody.getCapability();
+	}
+
 	public EndState getEndState() {
 		return abstractPlanBody.getEndState();
 	}
diff --git a/bdi-jade/src/bdi4jade/plan/planbody/ParallelActionPlanBody.java b/bdi-jade/src/bdi4jade/plan/planbody/ParallelActionPlanBody.java
index c2e00d4..a1804a5 100644
--- a/bdi-jade/src/bdi4jade/plan/planbody/ParallelActionPlanBody.java
+++ b/bdi-jade/src/bdi4jade/plan/planbody/ParallelActionPlanBody.java
@@ -24,6 +24,7 @@ package bdi4jade.plan.planbody;
 
 import jade.core.behaviours.ParallelBehaviour;
 import bdi4jade.belief.BeliefBase;
+import bdi4jade.core.Capability;
 import bdi4jade.core.Intention;
 import bdi4jade.event.GoalEvent;
 import bdi4jade.exception.PlanInstantiationException;
@@ -70,6 +71,10 @@ public class ParallelActionPlanBody extends ParallelBehaviour implements
 		return abstractPlanBody.getBeliefBase();
 	}
 
+	public Capability getCapability() {
+		return abstractPlanBody.getCapability();
+	}
+
 	public EndState getEndState() {
 		return abstractPlanBody.getEndState();
 	}
diff --git a/bdi-jade/src/bdi4jade/plan/planbody/PlanBody.java b/bdi-jade/src/bdi4jade/plan/planbody/PlanBody.java
index be312eb..dff3fb8 100644
--- a/bdi-jade/src/bdi4jade/plan/planbody/PlanBody.java
+++ b/bdi-jade/src/bdi4jade/plan/planbody/PlanBody.java
@@ -24,6 +24,7 @@ package bdi4jade.plan.planbody;
 
 import jade.core.behaviours.Behaviour;
 import bdi4jade.belief.BeliefBase;
+import bdi4jade.core.Capability;
 import bdi4jade.core.Intention;
 import bdi4jade.event.GoalEvent;
 import bdi4jade.event.GoalListener;
@@ -89,6 +90,13 @@ public interface PlanBody extends GoalListener {
 	public BeliefBase getBeliefBase();
 
 	/**
+	 * Returns the capability associated with the plan of this plan body.
+	 * 
+	 * @return the capability.
+	 */
+	public Capability getCapability();
+
+	/**
 	 * Returns the end state of the execution of this plan.
 	 * 
 	 * @return the end state of this plan, or null if it has not finished yet.
diff --git a/bdi-jade/src/bdi4jade/plan/planbody/SequentialActionPlanBody.java b/bdi-jade/src/bdi4jade/plan/planbody/SequentialActionPlanBody.java
index 526c1f4..cdcebb5 100644
--- a/bdi-jade/src/bdi4jade/plan/planbody/SequentialActionPlanBody.java
+++ b/bdi-jade/src/bdi4jade/plan/planbody/SequentialActionPlanBody.java
@@ -24,6 +24,7 @@ package bdi4jade.plan.planbody;
 
 import jade.core.behaviours.SequentialBehaviour;
 import bdi4jade.belief.BeliefBase;
+import bdi4jade.core.Capability;
 import bdi4jade.core.Intention;
 import bdi4jade.event.GoalEvent;
 import bdi4jade.exception.PlanInstantiationException;
@@ -70,6 +71,10 @@ public class SequentialActionPlanBody extends SequentialBehaviour implements
 		return abstractPlanBody.getBeliefBase();
 	}
 
+	public Capability getCapability() {
+		return abstractPlanBody.getCapability();
+	}
+
 	public EndState getEndState() {
 		return abstractPlanBody.getEndState();
 	}