bdi4jade

Added methods for serialization

9/12/2014 7:03:28 PM

Details

diff --git a/bdi-jade/src/bdi4jade/belief/AbstractBelief.java b/bdi-jade/src/bdi4jade/belief/AbstractBelief.java
index 09842ec..b2be924 100644
--- a/bdi-jade/src/bdi4jade/belief/AbstractBelief.java
+++ b/bdi-jade/src/bdi4jade/belief/AbstractBelief.java
@@ -57,7 +57,7 @@ public abstract class AbstractBelief<K, V> extends MetadataElementImpl
 	 * The default constructor. It should be only used if persistence frameworks
 	 * are used.
 	 */
-	protected AbstractBelief() {
+	public AbstractBelief() {
 		this.beliefBases = new HashSet<>();
 	}
 
@@ -177,7 +177,7 @@ public abstract class AbstractBelief<K, V> extends MetadataElementImpl
 	 * @param name
 	 *            the name to set.
 	 */
-	protected void setName(K name) {
+	public void setName(K name) {
 		this.name = name;
 	}
 
diff --git a/bdi-jade/src/bdi4jade/belief/AbstractBeliefSet.java b/bdi-jade/src/bdi4jade/belief/AbstractBeliefSet.java
index 1c5a055..5fd98cc 100644
--- a/bdi-jade/src/bdi4jade/belief/AbstractBeliefSet.java
+++ b/bdi-jade/src/bdi4jade/belief/AbstractBeliefSet.java
@@ -52,7 +52,7 @@ public abstract class AbstractBeliefSet<K, V> extends AbstractBelief<K, Set<V>>
 	 * The default constructor. It should be only used if persistence frameworks
 	 * are used.
 	 */
-	protected AbstractBeliefSet() {
+	public AbstractBeliefSet() {
 
 	}
 
diff --git a/bdi-jade/src/bdi4jade/belief/Belief.java b/bdi-jade/src/bdi4jade/belief/Belief.java
index 7fa5bf1..a139b02 100644
--- a/bdi-jade/src/bdi4jade/belief/Belief.java
+++ b/bdi-jade/src/bdi4jade/belief/Belief.java
@@ -23,6 +23,7 @@
 package bdi4jade.belief;
 
 import jade.content.Concept;
+import jade.content.ContentElement;
 
 import java.io.Serializable;
 import java.util.Set;
@@ -47,8 +48,8 @@ import bdi4jade.core.MetadataElement;
  * 
  * @author Ingrid Nunes
  */
-public interface Belief<K, V> extends MetadataElement, Serializable, Concept,
-		Cloneable {
+public interface Belief<K, V> extends Serializable, Concept, ContentElement,
+		MetadataElement, Cloneable {
 
 	/**
 	 * Adds a belief base that contains this belief. The agent whose capability
diff --git a/bdi-jade/src/bdi4jade/belief/PersistentBelief.java b/bdi-jade/src/bdi4jade/belief/PersistentBelief.java
index 86c4e54..3d3d8b4 100644
--- a/bdi-jade/src/bdi4jade/belief/PersistentBelief.java
+++ b/bdi-jade/src/bdi4jade/belief/PersistentBelief.java
@@ -37,6 +37,14 @@ public class PersistentBelief<K, V> extends AbstractBelief<K, V> {
 	protected V value;
 
 	/**
+	 * The default constructor. It should be only used if persistence frameworks
+	 * are used.
+	 */
+	public PersistentBelief() {
+
+	}
+
+	/**
 	 * Initializes a belief with its name.
 	 * 
 	 * @param name
diff --git a/bdi-jade/src/bdi4jade/belief/TransientBelief.java b/bdi-jade/src/bdi4jade/belief/TransientBelief.java
index b2846ed..bdb3f47 100644
--- a/bdi-jade/src/bdi4jade/belief/TransientBelief.java
+++ b/bdi-jade/src/bdi4jade/belief/TransientBelief.java
@@ -41,7 +41,7 @@ public class TransientBelief<K, V> extends AbstractBelief<K, V> {
 	 * The default constructor. It should be only used if persistence frameworks
 	 * are used.
 	 */
-	protected TransientBelief() {
+	public TransientBelief() {
 
 	}
 
diff --git a/bdi-jade/src/bdi4jade/belief/TransientBeliefSet.java b/bdi-jade/src/bdi4jade/belief/TransientBeliefSet.java
index b662751..1e991c4 100644
--- a/bdi-jade/src/bdi4jade/belief/TransientBeliefSet.java
+++ b/bdi-jade/src/bdi4jade/belief/TransientBeliefSet.java
@@ -46,7 +46,7 @@ public class TransientBeliefSet<K, V> extends AbstractBeliefSet<K, V> {
 	 * The default constructor. It should be only used if persistence frameworks
 	 * are used.
 	 */
-	protected TransientBeliefSet() {
+	public TransientBeliefSet() {
 
 	}
 
diff --git a/bdi-jade/src/bdi4jade/belief/TransientPropositionalBelief.java b/bdi-jade/src/bdi4jade/belief/TransientPropositionalBelief.java
index 90e7bd1..34b954d 100644
--- a/bdi-jade/src/bdi4jade/belief/TransientPropositionalBelief.java
+++ b/bdi-jade/src/bdi4jade/belief/TransientPropositionalBelief.java
@@ -37,7 +37,7 @@ public class TransientPropositionalBelief<K> extends
 	 * The default constructor. It should be only used if persistence frameworks
 	 * are used.
 	 */
-	protected TransientPropositionalBelief() {
+	public TransientPropositionalBelief() {
 
 	}
 
diff --git a/bdi-jade/src/bdi4jade/goal/BeliefPresentGoal.java b/bdi-jade/src/bdi4jade/goal/BeliefPresentGoal.java
index 0eca79c..e5c9eb6 100644
--- a/bdi-jade/src/bdi4jade/goal/BeliefPresentGoal.java
+++ b/bdi-jade/src/bdi4jade/goal/BeliefPresentGoal.java
@@ -39,6 +39,13 @@ public class BeliefPresentGoal<K> implements BeliefGoal<K> {
 	private K beliefName;
 
 	/**
+	 * Default constructor.
+	 */
+	public BeliefPresentGoal() {
+
+	}
+
+	/**
 	 * Creates a new BeliefGoal with the provided belief name.
 	 * 
 	 * @param beliefName
@@ -95,6 +102,16 @@ public class BeliefPresentGoal<K> implements BeliefGoal<K> {
 	}
 
 	/**
+	 * Sets the name of the belief associated with this goal.
+	 * 
+	 * @param beliefName
+	 *            the belief name.
+	 */
+	public void setBeliefName(K beliefName) {
+		this.beliefName = beliefName;
+	}
+
+	/**
 	 * Returns a string representation of this goal, in the form
 	 * "BeliefGoal: belief name".
 	 * 
diff --git a/bdi-jade/src/bdi4jade/goal/BeliefSetHasValueGoal.java b/bdi-jade/src/bdi4jade/goal/BeliefSetHasValueGoal.java
index bfa3d09..c939318 100644
--- a/bdi-jade/src/bdi4jade/goal/BeliefSetHasValueGoal.java
+++ b/bdi-jade/src/bdi4jade/goal/BeliefSetHasValueGoal.java
@@ -47,6 +47,13 @@ public class BeliefSetHasValueGoal<K, V> implements BeliefGoal<K> {
 	private V value;
 
 	/**
+	 * Default constructor.
+	 */
+	public BeliefSetHasValueGoal() {
+
+	}
+
+	/**
 	 * Creates a new BeliefSetValueGoal with the provided belief name and a
 	 * value. This value represents the one that should be part of the belief
 	 * set.
@@ -135,6 +142,26 @@ public class BeliefSetHasValueGoal<K, V> implements BeliefGoal<K> {
 	}
 
 	/**
+	 * Sets the name of the belief associated with this goal.
+	 * 
+	 * @param beliefName
+	 *            the belief name.
+	 */
+	public void setBeliefName(K beliefName) {
+		this.beliefName = beliefName;
+	}
+
+	/**
+	 * Sets the value of this goal.
+	 * 
+	 * @param value
+	 *            the value.
+	 */
+	public void setValue(V value) {
+		this.value = value;
+	}
+
+	/**
 	 * Returns a string representation of this goal, in the form
 	 * "BeliefSetValueGoal: BELIEF NAME should have BELIEF VALUE".
 	 * 
diff --git a/bdi-jade/src/bdi4jade/goal/BeliefValueGoal.java b/bdi-jade/src/bdi4jade/goal/BeliefValueGoal.java
index b522bf6..5697633 100644
--- a/bdi-jade/src/bdi4jade/goal/BeliefValueGoal.java
+++ b/bdi-jade/src/bdi4jade/goal/BeliefValueGoal.java
@@ -47,6 +47,13 @@ public class BeliefValueGoal<K, V> implements BeliefGoal<K> {
 	private V value;
 
 	/**
+	 * Default constructor.
+	 */
+	public BeliefValueGoal() {
+
+	}
+
+	/**
 	 * Creates a new BeliefValueGoal with the provided belief name and a value.
 	 * This value represents the value that is aimed to be associated with the
 	 * belief.
@@ -139,6 +146,26 @@ public class BeliefValueGoal<K, V> implements BeliefGoal<K> {
 	}
 
 	/**
+	 * Sets the name of the belief associated with this goal.
+	 * 
+	 * @param beliefName
+	 *            the belief name.
+	 */
+	public void setBeliefName(K beliefName) {
+		this.beliefName = beliefName;
+	}
+
+	/**
+	 * Sets the value of this goal.
+	 * 
+	 * @param value
+	 *            the value.
+	 */
+	public void setValue(V value) {
+		this.value = value;
+	}
+
+	/**
 	 * Returns a string representation of this goal, in the form
 	 * "BeliefValueGoal: BELIEF NAME should be BELIEF VALUE".
 	 * 
@@ -149,8 +176,7 @@ public class BeliefValueGoal<K, V> implements BeliefGoal<K> {
 	@Override
 	public String toString() {
 		return new StringBuffer(getClass().getName()).append(": ")
-				.append(getBeliefName()).append("=").append(value)
-				.toString();
+				.append(getBeliefName()).append("=").append(value).toString();
 	}
 
 }
\ No newline at end of file
diff --git a/bdi-jade/src/bdi4jade/goal/Goal.java b/bdi-jade/src/bdi4jade/goal/Goal.java
index 4a2078d..7077148 100644
--- a/bdi-jade/src/bdi4jade/goal/Goal.java
+++ b/bdi-jade/src/bdi4jade/goal/Goal.java
@@ -24,6 +24,9 @@ package bdi4jade.goal;
 
 import jade.content.Concept;
 import jade.content.ContentElement;
+
+import java.io.Serializable;
+
 import bdi4jade.annotation.GoalOwner;
 
 /**
@@ -36,6 +39,6 @@ import bdi4jade.annotation.GoalOwner;
  * 
  * @author Ingrid Nunes
  */
-public interface Goal extends ContentElement, Concept {
+public interface Goal extends Serializable, Concept, ContentElement {
 
 }
diff --git a/bdi-jade/src/bdi4jade/goal/PropositionalBeliefValueGoal.java b/bdi-jade/src/bdi4jade/goal/PropositionalBeliefValueGoal.java
index c6440aa..f7dab64 100644
--- a/bdi-jade/src/bdi4jade/goal/PropositionalBeliefValueGoal.java
+++ b/bdi-jade/src/bdi4jade/goal/PropositionalBeliefValueGoal.java
@@ -37,6 +37,23 @@ public class PropositionalBeliefValueGoal<K> extends
 
 	private static final long serialVersionUID = -6711494133447825608L;
 
+	/**
+	 * Default constructor.
+	 */
+	public PropositionalBeliefValueGoal() {
+
+	}
+
+	/**
+	 * Creates a new PropositionalBeliefValueGoal with the provided belief name
+	 * and a boolean value. This value represents the value that is aimed to be
+	 * associated with the belief.
+	 * 
+	 * @param beliefName
+	 *            the belief name.
+	 * @param value
+	 *            the boolean value that is target of this goal.
+	 */
 	public PropositionalBeliefValueGoal(K beliefName, Boolean value) {
 		super(beliefName, value);
 	}
diff --git a/bdi-jade/src/bdi4jade/goal/Softgoal.java b/bdi-jade/src/bdi4jade/goal/Softgoal.java
index 90c722d..caef671 100644
--- a/bdi-jade/src/bdi4jade/goal/Softgoal.java
+++ b/bdi-jade/src/bdi4jade/goal/Softgoal.java
@@ -25,6 +25,8 @@ package bdi4jade.goal;
 import jade.content.Concept;
 import jade.content.ContentElement;
 
+import java.io.Serializable;
+
 /**
  * This interface defines the abstraction of an agent softgoal. Softgoals are
  * not used in the default BDI reasoning cycle, but can be used in the process
@@ -32,6 +34,6 @@ import jade.content.ContentElement;
  * 
  * @author Ingrid Nunes
  */
-public interface Softgoal extends ContentElement, Concept {
+public interface Softgoal extends Serializable, Concept, ContentElement {
 
 }
\ No newline at end of file