bdi4jade

Annotations

8/15/2014 6:21:17 AM

Details

diff --git a/bdi-jade/src/bdi4jade/annotation/Belief.java b/bdi-jade/src/bdi4jade/annotation/Belief.java
index 3d3c766..67acb26 100644
--- a/bdi-jade/src/bdi4jade/annotation/Belief.java
+++ b/bdi-jade/src/bdi4jade/annotation/Belief.java
@@ -22,10 +22,24 @@
 
 package bdi4jade.annotation;
 
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import bdi4jade.core.Capability;
+
 /**
- * @author ingridnunes
- *
+ * This annotation allows to specify that an attribute of a {@link Capability}
+ * is a belief that should be added to the capability belief base. The annotated
+ * field should be of the type {@link bdi4jade.belief.Belief}.
+ * 
+ * @author Ingrid Nunes
  */
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
 public @interface Belief {
 
 }
diff --git a/bdi-jade/src/bdi4jade/annotation/CapabilityAssociation.java b/bdi-jade/src/bdi4jade/annotation/CapabilityAssociation.java
index 801143f..d6a6a4b 100644
--- a/bdi-jade/src/bdi4jade/annotation/CapabilityAssociation.java
+++ b/bdi-jade/src/bdi4jade/annotation/CapabilityAssociation.java
@@ -32,10 +32,10 @@ import bdi4jade.core.Capability;
 
 /**
  * This annotation allows to specify that an attribute of a {@link Capability}
- * is an association between capabilities.
- * 
- * @author ingridnunes
+ * is an association between capabilities. The annotated field should be of the
+ * type {@link Capability}.
  * 
+ * @author Ingrid Nunes
  */
 @Documented
 @Retention(RetentionPolicy.RUNTIME)
diff --git a/bdi-jade/src/bdi4jade/annotation/Plan.java b/bdi-jade/src/bdi4jade/annotation/Plan.java
index e9dc3f5..74d81ab 100644
--- a/bdi-jade/src/bdi4jade/annotation/Plan.java
+++ b/bdi-jade/src/bdi4jade/annotation/Plan.java
@@ -22,11 +22,24 @@
 
 package bdi4jade.annotation;
 
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import bdi4jade.core.Capability;
+
 /**
- * @author ingridnunes
- *
+ * This annotation allows to specify that an attribute of a {@link Capability}
+ * is a plan that should be added to the capability plan library. The annotated
+ * field should be of the type {@link bdi4jade.plan.Plan}.
+ * 
+ * @author Ingrid Nunes
  */
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
 public @interface Plan {
 
-	
 }
diff --git a/bdi-jade/src/bdi4jade/annotation/TransientBelief.java b/bdi-jade/src/bdi4jade/annotation/TransientBelief.java
new file mode 100644
index 0000000..f62da01
--- /dev/null
+++ b/bdi-jade/src/bdi4jade/annotation/TransientBelief.java
@@ -0,0 +1,52 @@
+//----------------------------------------------------------------------------
+// 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/~ingridnunes/bdi4jade/
+//
+//----------------------------------------------------------------------------
+
+package bdi4jade.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import bdi4jade.core.Capability;
+
+/**
+ * This annotation allows to specify that an attribute of a {@link Capability}
+ * is a belief value that should be added to the capability belief base. A name
+ * for the belief may be given. If it is not provided, the field name is used.
+ * 
+ * @author Ingrid Nunes
+ */
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface TransientBelief {
+
+	/**
+	 * Returns the belief name.
+	 * 
+	 * @return the belief name.
+	 */
+	String name() default "";
+
+}
diff --git a/bdi-jade/src/bdi4jade/annotation/TransientBeliefSet.java b/bdi-jade/src/bdi4jade/annotation/TransientBeliefSet.java
new file mode 100644
index 0000000..cd22c59
--- /dev/null
+++ b/bdi-jade/src/bdi4jade/annotation/TransientBeliefSet.java
@@ -0,0 +1,54 @@
+//----------------------------------------------------------------------------
+// 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/~ingridnunes/bdi4jade/
+//
+//----------------------------------------------------------------------------
+
+package bdi4jade.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.util.Set;
+
+import bdi4jade.core.Capability;
+
+/**
+ * This annotation allows to specify that an attribute of a {@link Capability}
+ * is a belief set value that should be added to the capability belief base. A
+ * name for the belief may be given. If it is not provided, the field name is
+ * used. The annotated field should be of the type {@link Set}.
+ * 
+ * @author Ingrid Nunes
+ */
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface TransientBeliefSet {
+
+	/**
+	 * Returns the belief name.
+	 * 
+	 * @return the belief name.
+	 */
+	String name() default "";
+
+}
diff --git a/bdi-jade/src/bdi4jade/belief/PersistentBelief.java b/bdi-jade/src/bdi4jade/belief/PersistentBelief.java
index 14f2416..68c4d7a 100644
--- a/bdi-jade/src/bdi4jade/belief/PersistentBelief.java
+++ b/bdi-jade/src/bdi4jade/belief/PersistentBelief.java
@@ -53,7 +53,7 @@ public class PersistentBelief<T> extends AbstractBelief<T> {
 	 */
 	@Override
 	public T getValue() {
-		// TODO PersistentBelief.getValue()
+		// TODO Future: PersistentBelief.getValue()
 		throw new RuntimeException("Not implemented yet!");
 	}
 
@@ -63,7 +63,7 @@ public class PersistentBelief<T> extends AbstractBelief<T> {
 	 * @see bdi4jade.belief.Belief#setValue(java.lang.Object)
 	 */
 	protected void updateValue(T value) {
-		// TODO PersistentBelief.setValue(T value)
+		// TODO Future: PersistentBelief.setValue(T value)
 		throw new RuntimeException("Not implemented yet!");
 	}
 
diff --git a/bdi-jade/src/bdi4jade/plan/DefaultPlan.java b/bdi-jade/src/bdi4jade/plan/DefaultPlan.java
index a590b07..5418e8e 100644
--- a/bdi-jade/src/bdi4jade/plan/DefaultPlan.java
+++ b/bdi-jade/src/bdi4jade/plan/DefaultPlan.java
@@ -36,7 +36,7 @@ import bdi4jade.plan.planbody.PlanBody;
  * has the {@link Behaviour} class as superclass is provides and it is
  * instantiates in the {@link DefaultPlan#createPlanBody()} method.
  * 
- * @author ingrid
+ * @author Ingrid Nunes
  */
 public class DefaultPlan extends AbstractPlan {
 
diff --git a/bdi-jade/src/bdi4jade/plan/planbody/SequentialGoalPlanBody.java b/bdi-jade/src/bdi4jade/plan/planbody/SequentialGoalPlanBody.java
index 58773f4..c430731 100644
--- a/bdi-jade/src/bdi4jade/plan/planbody/SequentialGoalPlanBody.java
+++ b/bdi-jade/src/bdi4jade/plan/planbody/SequentialGoalPlanBody.java
@@ -39,7 +39,7 @@ import bdi4jade.util.ReflectionUtils;
  * This plan body provides the set of actions to achieve a
  * {@link SequentialGoal}.
  * 
- * @author ingrid
+ * @author Ingrid Nunes
  */
 public class SequentialGoalPlanBody extends AbstractPlanBody implements
 		OutputPlanBody {
diff --git a/bdi-jade/src/bdi4jade/plan/PlanLibrary.java b/bdi-jade/src/bdi4jade/plan/PlanLibrary.java
index 855d5ba..a534e9b 100644
--- a/bdi-jade/src/bdi4jade/plan/PlanLibrary.java
+++ b/bdi-jade/src/bdi4jade/plan/PlanLibrary.java
@@ -40,9 +40,9 @@ import bdi4jade.plan.planbody.SequentialGoalPlanBody;
  * This class represents the plan library of a capability. It aggregates the
  * plans that can be used to achieve goals.
  * 
- * @author ingrid
+ * @author Ingrid Nunes
  */
-// TODO PlanLibrary - create indexes to optimize plan matches
+// TODO Future: PlanLibrary - create indexes to optimize plan matches
 public class PlanLibrary implements Serializable {
 
 	private static final long serialVersionUID = 3038533629659859857L;
diff --git a/bdi-jade/src/bdi4jade/util/ReflectionUtils.java b/bdi-jade/src/bdi4jade/util/ReflectionUtils.java
index 5e9920f..e883998 100644
--- a/bdi-jade/src/bdi4jade/util/ReflectionUtils.java
+++ b/bdi-jade/src/bdi4jade/util/ReflectionUtils.java
@@ -50,7 +50,16 @@ public abstract class ReflectionUtils {
 	private static final Log log = LogFactory.getLog(ReflectionUtils.class);
 	private static final String SETTER_PREFIX = "set";
 
-	// TODO
+	/**
+	 * Adds to the goal owners map the capability classes that owns a goal to
+	 * the capability instance passed as parameter.
+	 * 
+	 * @param goalOwnersMap
+	 *            the goal owners map to which the owners of the given
+	 *            capability should be added.
+	 * @param capability
+	 *            the capability that should be added to the map.
+	 */
 	public static void addGoalOwner(
 			Map<Class<? extends Capability>, Set<Capability>> goalOwnersMap,
 			Capability capability) {
@@ -61,8 +70,7 @@ public abstract class ReflectionUtils {
 		}
 	}
 
-	// TODO
-	public static void addGoalOwner(
+	private static void addGoalOwner(
 			Map<Class<? extends Capability>, Set<Capability>> goalOwnersMap,
 			Class<? extends Capability> cababilityClass, Capability capability) {
 		Set<Capability> owners = goalOwnersMap.get(cababilityClass);