bdi4jade
Changes
bdi-jade/src/bdi4jade/belief/AbstractBelief.java 100(+74 -26)
bdi-jade/src/bdi4jade/belief/Belief.java 20(+13 -7)
bdi-jade/src/bdi4jade/belief/BeliefBase.java 118(+83 -35)
bdi-jade/src/bdi4jade/belief/BeliefSet.java 17(+10 -7)
Details
bdi-jade/src/bdi4jade/belief/AbstractBelief.java 100(+74 -26)
diff --git a/bdi-jade/src/bdi4jade/belief/AbstractBelief.java b/bdi-jade/src/bdi4jade/belief/AbstractBelief.java
index 5bce3f4..25c2b07 100644
--- a/bdi-jade/src/bdi4jade/belief/AbstractBelief.java
+++ b/bdi-jade/src/bdi4jade/belief/AbstractBelief.java
@@ -16,13 +16,12 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// To contact the authors:
-// http://inf.ufrgs.br/~ingridnunes/bdi4jade/
+// http://inf.ufrgs.br/prosoft/bdi4jade/
//
//----------------------------------------------------------------------------
package bdi4jade.belief;
-import java.security.InvalidParameterException;
import java.util.HashSet;
import java.util.Set;
@@ -31,8 +30,17 @@ import bdi4jade.event.BeliefEvent;
import bdi4jade.event.BeliefEvent.Action;
/**
- * @author ingrid
+ * This is an abstract class that implements the {@link Belief} interface. It
+ * implements some of the interface methods, leaving some implementations to the
+ * subclasses, mainly the choice of how the belief value is stored.
*
+ * It is class observable by belief bases ({@link BeliefBase}), allowing the
+ * observation on changes in the value of this belief.
+ *
+ * @author Ingrid Nunes
+ *
+ * @param <T>
+ * the type of the belief value.
*/
public abstract class AbstractBelief<T> extends MetadataElementImpl implements
Belief<T> {
@@ -40,7 +48,15 @@ public abstract class AbstractBelief<T> extends MetadataElementImpl implements
private static final long serialVersionUID = 5098122115249071355L;
private final Set<BeliefBase> beliefBases;
- protected final String name;
+ private String name;
+
+ /**
+ * The default constructor. It should be only used if persistence frameworks
+ * are used.
+ */
+ protected AbstractBelief() {
+ this.beliefBases = new HashSet<BeliefBase>();
+ }
/**
* Initializes a belief with its name.
@@ -56,7 +72,7 @@ public abstract class AbstractBelief<T> extends MetadataElementImpl implements
}
/**
- * Initializes a belief with its name.
+ * Initializes a belief with its name and an initial value.
*
* @param name
* the belief name.
@@ -65,22 +81,24 @@ public abstract class AbstractBelief<T> extends MetadataElementImpl implements
*/
public AbstractBelief(String name, T value) {
this(name);
- setValue(value);
+ updateValue(value);
}
/**
- * Adds a belief base that contains this belief. The agent whose capability
- * contains this belief in the belief base believes in this belief.
- *
- * @param beliefBase
- * the belief base to be added.
+ * @see Belief#addBeliefBase(BeliefBase)
*/
public void addBeliefBase(BeliefBase beliefBase) {
this.beliefBases.add(beliefBase);
}
/**
- * @see java.lang.Object#equals(java.lang.Object)
+ * Returns true of the object is a belief and has the same name of this
+ * belief.
+ *
+ * @param obj
+ * to object to be tested if it is equal to this belief.
+ *
+ * @see Object#equals(Object)
*/
@Override
public final boolean equals(Object obj) {
@@ -92,31 +110,39 @@ public abstract class AbstractBelief<T> extends MetadataElementImpl implements
}
/**
- * Returns the belief bases with which this belief is associated.
- *
- * @return the beliefBases.
+ * @see Belief#getBeliefBases()
*/
public Set<BeliefBase> getBeliefBases() {
return new HashSet<BeliefBase>(beliefBases);
}
/**
- * Gets the name of the Belief.
- *
- * @return the belief name.
+ * @see Belief#getName()
*/
public final String getName() {
return name;
}
/**
+ * Returns the hash code of this belief name.
+ *
+ * @return the hash code of this belief.
+ *
* @see java.lang.Object#hashCode()
*/
@Override
public final int hashCode() {
- return this.name.hashCode();
+ return name == null ? 0 : this.name.hashCode();
}
+ /**
+ * Notifies the belief bases with which this belief is associated that the
+ * value of this belief has changed.
+ *
+ * @param beliefEvent
+ * the {@link BeliefEvent} describing the change on this belief
+ * value
+ */
protected void notifyBeliefBases(BeliefEvent beliefEvent) {
for (BeliefBase beliefBase : beliefBases) {
beliefBase.notifyBeliefChanged(beliefEvent);
@@ -124,22 +150,32 @@ public abstract class AbstractBelief<T> extends MetadataElementImpl implements
}
/**
- * Removes a belief base that does not contain this belief anymore. The
- * agent whose capability does not contain this belief in the belief base
- * does not believe in this belief anymore.
- *
- * @param beliefBases
- * the belief base to be removed.
+ * @see Belief#removeBeliefBase(BeliefBase)
*/
public void removeBeliefBase(BeliefBase beliefBases) {
this.beliefBases.remove(beliefBases);
}
/**
- * Sets a new value to the belief.
+ * Sets a name to this belief. Ideally, a belief name should be final and
+ * initialized in the constructor. This method should be only used if
+ * persistence frameworks are used.
+ *
+ * @param name
+ * the name to set.
+ */
+ protected void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Sets a new value to the belief and notifies belief bases of changes on
+ * this belief value.
*
* @param value
* the new value.
+ *
+ * @see Belief#setValue(Object)
*/
public final void setValue(T value) {
Object oldValue = getValue();
@@ -148,6 +184,11 @@ public abstract class AbstractBelief<T> extends MetadataElementImpl implements
}
/**
+ * Returns this belief as a string in the form:
+ * "belief name = belief value".
+ *
+ * @return the string representation of this belief.
+ *
* @see java.lang.Object#toString()
*/
@Override
@@ -156,6 +197,13 @@ public abstract class AbstractBelief<T> extends MetadataElementImpl implements
.toString();
}
+ /**
+ * Sets the value of this belief. It is invoked by the
+ * {@link #setValue(Object)} method.
+ *
+ * @param value
+ * the value to set.
+ */
protected abstract void updateValue(T value);
}
diff --git a/bdi-jade/src/bdi4jade/belief/AbstractBeliefSet.java b/bdi-jade/src/bdi4jade/belief/AbstractBeliefSet.java
index 2ebe2ab..bf779b8 100644
--- a/bdi-jade/src/bdi4jade/belief/AbstractBeliefSet.java
+++ b/bdi-jade/src/bdi4jade/belief/AbstractBeliefSet.java
@@ -16,7 +16,7 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// To contact the authors:
-// http://inf.ufrgs.br/~ingridnunes/bdi4jade/
+// http://inf.ufrgs.br/prosoft/bdi4jade/
//
//----------------------------------------------------------------------------
@@ -29,8 +29,16 @@ import bdi4jade.event.BeliefEvent;
import bdi4jade.event.BeliefEvent.Action;
/**
- * @author ingrid
+ * This is an abstract class that implements the {@link BeliefSet} interface,
+ * and extends the {@link AbstractBeliefSet} class, parameterizing it with a
+ * parameterized {@link Set}. It implements some of the interface methods,
+ * leaving some implementations to the subclasses, mainly the choice of how the
+ * belief set values are stored.
*
+ * @author Ingrid Nunes
+ *
+ * @param <T>
+ * the type of the belief set values.
*/
public abstract class AbstractBeliefSet<T> extends AbstractBelief<Set<T>>
implements BeliefSet<T> {
@@ -38,7 +46,15 @@ public abstract class AbstractBeliefSet<T> extends AbstractBelief<Set<T>>
private static final long serialVersionUID = 8345025506647930L;
/**
- * Creates a new transient belief set with the provided name.
+ * The default constructor. It should be only used if persistence frameworks
+ * are used.
+ */
+ protected AbstractBeliefSet() {
+
+ }
+
+ /**
+ * Initializes a belief set with its name.
*
* @param name
* the name of this belief set.
@@ -48,7 +64,7 @@ public abstract class AbstractBeliefSet<T> extends AbstractBelief<Set<T>>
}
/**
- * Creates a transient belief set.
+ * Initializes a belief set with its name and an initial set of values.
*
* @param name
* the name of the belief set.
@@ -56,13 +72,27 @@ public abstract class AbstractBeliefSet<T> extends AbstractBelief<Set<T>>
* the initial values of this belief set.
*/
public AbstractBeliefSet(String name, Set<T> values) {
- super(name, values);
+ super(name);
+ updateValue(new HashSet<T>(values));
}
+ /**
+ * Adds a value of this belief set. It is invoked by the
+ * {@link #addValue(Object)} method.
+ *
+ * @param value
+ * the value to be added.
+ */
protected abstract void addSetValue(T value);
/**
- * @see bdi4jade.belief.BeliefSet#addValue(java.lang.Object)
+ * Adds a value to the belief set and notifies belief bases of the addition
+ * of this value.
+ *
+ * @param value
+ * the value to be added.
+ *
+ * @see BeliefSet#addValue(Object)
*/
@Override
public final void addValue(T value) {
@@ -73,10 +103,24 @@ public abstract class AbstractBeliefSet<T> extends AbstractBelief<Set<T>>
}
}
+ /**
+ * Removes a value of this belief set. It is invoked by the
+ * {@link #removeValue(Object)} method.
+ *
+ * @param value
+ * the value to be added.
+ * @return true if the value was removed, false otherwise.
+ */
protected abstract boolean removeSetValue(T value);
/**
- * @see bdi4jade.belief.BeliefSet#removeValue(java.lang.Object)
+ * Removes a value of the belief set and notifies belief bases of the
+ * removal of this value.
+ *
+ * @param value
+ * the value to be removed.
+ *
+ * @see BeliefSet#removeValue(Object)
*/
@Override
public final boolean removeValue(T value) {
bdi-jade/src/bdi4jade/belief/Belief.java 20(+13 -7)
diff --git a/bdi-jade/src/bdi4jade/belief/Belief.java b/bdi-jade/src/bdi4jade/belief/Belief.java
index 0e9566c..2694ce2 100644
--- a/bdi-jade/src/bdi4jade/belief/Belief.java
+++ b/bdi-jade/src/bdi4jade/belief/Belief.java
@@ -16,7 +16,7 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// To contact the authors:
-// http://inf.ufrgs.br/~ingridnunes/bdi4jade/
+// http://inf.ufrgs.br/prosoft/bdi4jade/
//
//----------------------------------------------------------------------------
@@ -30,10 +30,16 @@ import java.util.Set;
import bdi4jade.core.MetadataElement;
/**
- * Represents a belief of the belief base. It has a name and a value associate
- * with it.
+ * This interface represents a belief of the belief base. It has a name and a
+ * value associate with it. It is parameterized by the type of the belief value.
*
- * @author ingrid
+ * It extends the {@link MetadataElement} interface, allowing to associate
+ * metadata with beliefs.
+ *
+ * @param <T>
+ * the type of the belief value.
+ *
+ * @author Ingrid Nunes
*/
public interface Belief<T> extends MetadataElement, Serializable, Concept {
@@ -49,7 +55,7 @@ public interface Belief<T> extends MetadataElement, Serializable, Concept {
/**
* Returns the belief bases with which this belief is associated.
*
- * @return the beliefBases.
+ * @return the belief bases.
*/
public Set<BeliefBase> getBeliefBases();
@@ -61,7 +67,7 @@ public interface Belief<T> extends MetadataElement, Serializable, Concept {
public String getName();
/**
- * Gets the current value of the Belief.
+ * Gets the current value of the belief.
*
* @return the belief value.
*/
@@ -78,7 +84,7 @@ public interface Belief<T> extends MetadataElement, Serializable, Concept {
public void removeBeliefBase(BeliefBase beliefBase);
/**
- * Sets a new value to the belief.
+ * Sets the new value of the belief.
*
* @param value
* the new value.
bdi-jade/src/bdi4jade/belief/BeliefBase.java 118(+83 -35)
diff --git a/bdi-jade/src/bdi4jade/belief/BeliefBase.java b/bdi-jade/src/bdi4jade/belief/BeliefBase.java
index 8d5b988..ab6681a 100644
--- a/bdi-jade/src/bdi4jade/belief/BeliefBase.java
+++ b/bdi-jade/src/bdi4jade/belief/BeliefBase.java
@@ -16,7 +16,7 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// To contact the authors:
-// http://inf.ufrgs.br/~ingridnunes/bdi4jade/
+// http://inf.ufrgs.br/prosoft/bdi4jade/
//
//----------------------------------------------------------------------------
@@ -42,7 +42,7 @@ import bdi4jade.exception.BeliefAlreadyExistsException;
* This class represents a belief base of a capability. It aggregates its
* knowledge.
*
- * @author ingrid
+ * @author Ingrid Nunes
*/
public final class BeliefBase implements Serializable {
@@ -50,13 +50,22 @@ public final class BeliefBase implements Serializable {
private final Set<BeliefListener> beliefListeners;
private final Map<String, Belief<?>> beliefs;
- private final Capability capability;
+ private Capability capability;
+
+ /**
+ * The default constructor. It should be only used if persistence frameworks
+ * are used.
+ */
+ protected BeliefBase() {
+ this.beliefListeners = new HashSet<BeliefListener>();
+ this.beliefs = new HashMap<String, Belief<?>>();
+ }
/**
* Creates a belief base associated with a capability.
*
* @param capability
- * the capability to which this belief base belongs
+ * the capability to which this belief base belongs.
*/
public BeliefBase(final Capability capability) {
this(capability, null);
@@ -64,12 +73,12 @@ public final class BeliefBase implements Serializable {
/**
* Creates a belief base associated with a capability and adds the beliefs
- * in the provided belief set.
+ * in the provided belief set as the initial beliefs of this belief base.
*
* @param capability
- * the capability to which this belief base belongs
+ * the capability to which this belief base belongs.
* @param beliefs
- * the initial beliefs
+ * the initial beliefs.
*/
public BeliefBase(final Capability capability, Set<Belief<?>> beliefs) {
if (capability == null)
@@ -80,7 +89,7 @@ public final class BeliefBase implements Serializable {
this.beliefs = new HashMap<String, Belief<?>>();
if (beliefs != null) {
for (Belief<?> belief : beliefs) {
- addBelief(belief);
+ this.beliefs.put(belief.getName(), belief);
}
}
}
@@ -112,8 +121,8 @@ public final class BeliefBase implements Serializable {
}
/**
- * Adds a belief to the belief base. It overrides a belief, if it already
- * exists.
+ * Adds a belief to the belief base. It updates the belief value, if it
+ * already exists.
*
* @param belief
* the belief to be added or updated.
@@ -127,10 +136,10 @@ public final class BeliefBase implements Serializable {
}
/**
- * Gets all beliefs of this belief base and the belief bases of the parents
- * of the capability that this belief base belongs to.
+ * Gets all beliefs of this belief base and the belief bases of the
+ * whole-capabilities of the capability that this belief base belongs to.
*
- * @return the beliefs
+ * @return the beliefs of this capability and all of its whole-capabilities.
*/
public Collection<Belief<?>> getAllBeliefs() {
Collection<Belief<?>> beliefs = new LinkedList<Belief<?>>();
@@ -138,6 +147,13 @@ public final class BeliefBase implements Serializable {
return beliefs;
}
+ /**
+ * This is a recursive method to implement the {@link #getAllBeliefs()}
+ * method.
+ *
+ * @param beliefs
+ * the set to which beliefs are added.
+ */
private void getAllBeliefs(final Collection<Belief<?>> beliefs) {
beliefs.addAll(this.beliefs.values());
if (capability.getWholeCapability() != null) {
@@ -147,13 +163,13 @@ public final class BeliefBase implements Serializable {
}
/**
- * Retrieves a belief from the belief base. If this belief does not contain
- * it and this belief base is from a capability, it checks the common belief
- * based of the agent, and returns it if it exists.
+ * Retrieves a belief from the belief base. If this belief base does not
+ * contain it, the method checks whole-capabilities' belief base
+ * recursively.
*
* @param name
* the name of the belief to be retrieved.
- * @return the belief. Null if no belief is found.
+ * @return the belief, or null if no belief is found.
*/
public Belief<?> getBelief(String name) {
Belief<?> belief = this.beliefs.get(name);
@@ -165,14 +181,16 @@ public final class BeliefBase implements Serializable {
}
/**
- * @return the beliefListeners
+ * Returns all the current belief listeners of this belief base.
+ *
+ * @return the belief listeners.
*/
public Set<BeliefListener> getBeliefListeners() {
return new HashSet<BeliefListener>(beliefListeners);
}
/**
- * Gets all beliefs of this belief base.
+ * Gets all beliefs of this specific belief base.
*
* @return the beliefs
*/
@@ -181,7 +199,7 @@ public final class BeliefBase implements Serializable {
}
/**
- * Return a list of all belief values from this belief base.
+ * Returns a list of all belief values from this belief base.
*
* @return the beliefValues
*/
@@ -193,14 +211,18 @@ public final class BeliefBase implements Serializable {
}
/**
- * @return the capability
+ * Returns the capability with which this belief base is associated.
+ *
+ * @return the capability.
*/
public Capability getCapability() {
return capability;
}
/**
- * Checks if a belief is part of the belief base.
+ * Checks whether a belief is part of the belief base. If this belief base
+ * does not contain it, the method checks whole-capabilities' belief base
+ * recursively.
*
* @param name
* the belief to be checked
@@ -216,8 +238,9 @@ public final class BeliefBase implements Serializable {
}
/**
- * Notifies the capability associate with this BeliefBase that a belief was
- * modified.
+ * Notifies the capability associated with this belief base that a belief
+ * was modified. It also recursively notifies belief listeners of part
+ * capabilities.
*
* @param beliefChanged
* the belief that was changed
@@ -226,13 +249,15 @@ public final class BeliefBase implements Serializable {
for (BeliefListener beliefListener : beliefListeners) {
beliefListener.update(beliefChanged);
}
- for (Capability child : capability.getPartCapabilities()) {
- child.getBeliefBase().notifyBeliefChanged(beliefChanged);
+ for (Capability part : capability.getPartCapabilities()) {
+ part.getBeliefBase().notifyBeliefChanged(beliefChanged);
}
}
/**
- * Removes a belief from the belief base.
+ * Removes a belief from the belief base. If this belief base does not
+ * contain it, the method checks whole-capabilities' belief base recursively
+ * to remove this belief..
*
* @param name
* the name of the belief to be removed.
@@ -264,7 +289,19 @@ public final class BeliefBase implements Serializable {
}
/**
- * Gets the size of this belief base (the number of beliefs).
+ * Associates a capability with this belief base. Ideally, the capability
+ * should be final and initialized in the constructor. This method should be
+ * only used if persistence frameworks are used.
+ *
+ * @param capability
+ * the capability to set.
+ */
+ protected void setCapability(Capability capability) {
+ this.capability = capability;
+ }
+
+ /**
+ * Gets the size of this specific belief base (the number of beliefs).
*
* @return the size of this belief base.
*/
@@ -273,25 +310,36 @@ public final class BeliefBase implements Serializable {
}
/**
+ * Returns this belief base as a string in the form:
+ * "Belief base of Capability ID = [ BELIEFS ]".
+ *
+ * @return the string representation of this belief base.
+ *
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
- return new StringBuffer("BeliefBase = ").append(this.getBeliefs())
- .toString();
+ StringBuffer sb = new StringBuffer("Belief base of Capability ");
+ if (capability == null)
+ sb.append(" NO ID");
+ else
+ sb.append(capability.getId());
+ sb.append(" = ").append(beliefs);
+ return sb.toString();
}
/**
- * Update the value of a belief in the belief base. In case the belief is
- * not present in the belief base, nothing is performed and the method
- * returns false. If the type of the new value being provided, it is still
- * going to subscribe the previous value.
+ * Updates the value of a belief in the belief base. In case the belief is
+ * not present in the belief base (of in its whole-capabilities' belief
+ * bases), nothing is performed and the method returns false. If the type of
+ * the new value being provided does not match the current type, the method
+ * still subscribes the previous value.
*
* @param name
* the belief to be updated.
* @param value
* the new value to the belief.
- * @return true if the belief was update.
+ * @return true if the belief was updated.
*/
@SuppressWarnings("unchecked")
public boolean updateBelief(String name, Object value) {
bdi-jade/src/bdi4jade/belief/BeliefSet.java 17(+10 -7)
diff --git a/bdi-jade/src/bdi4jade/belief/BeliefSet.java b/bdi-jade/src/bdi4jade/belief/BeliefSet.java
index 886c5cb..7bf0fce 100644
--- a/bdi-jade/src/bdi4jade/belief/BeliefSet.java
+++ b/bdi-jade/src/bdi4jade/belief/BeliefSet.java
@@ -16,7 +16,7 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// To contact the authors:
-// http://inf.ufrgs.br/~ingridnunes/bdi4jade/
+// http://inf.ufrgs.br/prosoft/bdi4jade/
//
//----------------------------------------------------------------------------
@@ -29,7 +29,10 @@ import java.util.Set;
* This interface represents a belief that has a set of values associated with
* it.
*
- * @author ingrid
+ * @author Ingrid Nunes
+ *
+ * @param <T>
+ * the type of the belief set values.
*/
public interface BeliefSet<T> extends Belief<Set<T>> {
@@ -42,18 +45,18 @@ public interface BeliefSet<T> extends Belief<Set<T>> {
public void addValue(T value);
/**
- * Checks if this belief set has the provided value.
+ * Checks whether this belief set has the provided value.
*
* @param value
- * the value to be tested.
- * @return true if the belief set contains this value.
+ * the value to be checked.
+ * @return true if the belief set contains this value, false otherwise.
*/
public boolean hasValue(T value);
/**
* Returns an iterator for this belief set.
*
- * @return the iterator.
+ * @return the iterator to iterate the values of the belief set.
*/
public Iterator<T> iterator();
@@ -62,7 +65,7 @@ public interface BeliefSet<T> extends Belief<Set<T>> {
*
* @param value
* the value to be removed.
- * @return true if the value was removed.
+ * @return true if the value was removed, false otherwise.
*/
public boolean removeValue(T value);
diff --git a/bdi-jade/src/bdi4jade/belief/package-info.java b/bdi-jade/src/bdi4jade/belief/package-info.java
new file mode 100644
index 0000000..e684a43
--- /dev/null
+++ b/bdi-jade/src/bdi4jade/belief/package-info.java
@@ -0,0 +1,31 @@
+//----------------------------------------------------------------------------
+// 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/
+//
+//----------------------------------------------------------------------------
+
+/**
+ * This package contains interfaces and classes that allows representation of
+ * beliefs of an agent, which are stored in belief bases, part of agent
+ * capabilities.
+ *
+ * @author Ingrid Nunes
+ *
+ */
+package bdi4jade.belief;
\ No newline at end of file
diff --git a/bdi-jade/src/bdi4jade/belief/PersistentBelief.java b/bdi-jade/src/bdi4jade/belief/PersistentBelief.java
index e1fb04e..14f2416 100644
--- a/bdi-jade/src/bdi4jade/belief/PersistentBelief.java
+++ b/bdi-jade/src/bdi4jade/belief/PersistentBelief.java
@@ -16,14 +16,18 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// To contact the authors:
-// http://inf.ufrgs.br/~ingridnunes/bdi4jade/
+// http://inf.ufrgs.br/prosoft/bdi4jade/
//
//----------------------------------------------------------------------------
package bdi4jade.belief;
/**
- * @author ingrid
+ * This class extends the {@link Belief} and represents a persistent belief,
+ * which is persisted in a permanent memory. This class has not been implemented
+ * yet.
+ *
+ * @author Ingrid Nunes
*
*/
public class PersistentBelief<T> extends AbstractBelief<T> {
@@ -43,19 +47,23 @@ public class PersistentBelief<T> extends AbstractBelief<T> {
}
/**
+ * Not implemented yet.
+ *
* @see bdi4jade.belief.Belief#getValue()
*/
@Override
public T getValue() {
- // XXX PersistentBelief.getValue()
+ // TODO PersistentBelief.getValue()
throw new RuntimeException("Not implemented yet!");
}
/**
+ * Not implemented yet.
+ *
* @see bdi4jade.belief.Belief#setValue(java.lang.Object)
*/
protected void updateValue(T value) {
- // XXX PersistentBelief.setValue(T value)
+ // TODO PersistentBelief.setValue(T value)
throw new RuntimeException("Not implemented yet!");
}
diff --git a/bdi-jade/src/bdi4jade/belief/TransientBelief.java b/bdi-jade/src/bdi4jade/belief/TransientBelief.java
index 123319d..cd4080d 100644
--- a/bdi-jade/src/bdi4jade/belief/TransientBelief.java
+++ b/bdi-jade/src/bdi4jade/belief/TransientBelief.java
@@ -16,17 +16,20 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// To contact the authors:
-// http://inf.ufrgs.br/~ingridnunes/bdi4jade/
+// http://inf.ufrgs.br/prosoft/bdi4jade/
//
//----------------------------------------------------------------------------
package bdi4jade.belief;
/**
- * This class extends the {@link Belief} and represents a transient belief,
- * which is not persisted in a permanent memory.
+ * This class extends the {@link AbstractBelief} class and represents a
+ * transient belief, which is not persisted in a permanent memory.
*
- * @author ingrid
+ * @author Ingrid Nunes
+ *
+ * @param <T>
+ * the type of the belief value.
*/
public class TransientBelief<T> extends AbstractBelief<T> {
@@ -35,7 +38,15 @@ public class TransientBelief<T> extends AbstractBelief<T> {
protected T value;
/**
- * Initializes a belief with its name.
+ * The default constructor. It should be only used if persistence frameworks
+ * are used.
+ */
+ protected TransientBelief() {
+
+ }
+
+ /**
+ * Initializes a transient belief with its name.
*
* @param name
* the belief name.
@@ -45,7 +56,7 @@ public class TransientBelief<T> extends AbstractBelief<T> {
}
/**
- * Initializes a belief with its name and a initial value.
+ * Initializes a transient belief with its name and a initial value.
*
* @param name
* the belief name.
diff --git a/bdi-jade/src/bdi4jade/belief/TransientBeliefSet.java b/bdi-jade/src/bdi4jade/belief/TransientBeliefSet.java
index efe8e3f..99904a3 100644
--- a/bdi-jade/src/bdi4jade/belief/TransientBeliefSet.java
+++ b/bdi-jade/src/bdi4jade/belief/TransientBeliefSet.java
@@ -16,7 +16,7 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// To contact the authors:
-// http://inf.ufrgs.br/~ingridnunes/bdi4jade/
+// http://inf.ufrgs.br/prosoft/bdi4jade/
//
//----------------------------------------------------------------------------
@@ -27,11 +27,14 @@ import java.util.Iterator;
import java.util.Set;
/**
- * This class extends the {@link TransientBeliefSet} and implements
- * {@link BeliefSet} and represents a transient belief set, which is not
- * persisted in a permanent memory.
+ * This class extends the {@link AbstractBeliefSet} class and implements
+ * {@link BeliefSet} interface, representing a transient belief set, which is
+ * not persisted in a permanent memory.
*
- * @author ingrid
+ * @author Ingrid Nunes
+ *
+ * @param <T>
+ * the type of the belief set values.
*/
public class TransientBeliefSet<T> extends AbstractBeliefSet<T> implements
BeliefSet<T> {
@@ -41,7 +44,15 @@ public class TransientBeliefSet<T> extends AbstractBeliefSet<T> implements
private Set<T> value;
/**
- * Creates a new transient belief set with the provided name.
+ * The default constructor. It should be only used if persistence frameworks
+ * are used.
+ */
+ protected TransientBeliefSet() {
+
+ }
+
+ /**
+ * Initializes a belief set with its name.
*
* @param name
* the name of this belief set.
@@ -51,7 +62,7 @@ public class TransientBeliefSet<T> extends AbstractBeliefSet<T> implements
}
/**
- * Creates a transient belief set.
+ * Initializes a belief set with its name and an initial set of values.
*
* @param name
* the name of the belief set.