|
From: <jom...@us...> - 2008-08-10 11:06:43
|
Revision: 1353
http://jason.svn.sourceforge.net/jason/?rev=1353&view=rev
Author: jomifred
Date: 2008-08-10 11:06:39 +0000 (Sun, 10 Aug 2008)
Log Message:
-----------
automatically add source(self) in del bel (-) operator when no other source is provided.
previously, it is added only no annotation is provided.
Modified Paths:
--------------
trunk/src/jason/asSemantics/TransitionSystem.java
trunk/src/jason/asSyntax/Atom.java
trunk/src/jason/bb/DefaultBeliefBase.java
trunk/src/jason/stdlib/package.html
Modified: trunk/src/jason/asSemantics/TransitionSystem.java
===================================================================
--- trunk/src/jason/asSemantics/TransitionSystem.java 2008-07-17 09:16:19 UTC (rev 1352)
+++ trunk/src/jason/asSemantics/TransitionSystem.java 2008-08-10 11:06:39 UTC (rev 1353)
@@ -517,9 +517,8 @@
case delAddBel:
// -+a(1,X) ===> remove a(_,_), add a(1,X)
// change all vars to anon vars to remove it
- if (!body.hasAnnot()) {
- // do not add source(self) in case the
- // programmer set some annotation
+ if (!body.hasSource()) {
+ // do not add source(self) in case the programmer set a source
body.addAnnot(BeliefBase.TSelf);
}
Literal bc = (Literal)body.clone();
@@ -574,9 +573,8 @@
break;
case delBel:
- if (!body.hasAnnot()) {
- // do not add source(self) in case the
- // programmer set some annotation
+ if (!body.hasSource()) {
+ // do not add source(self) in case the programmer set a source
body.addAnnot(BeliefBase.TSelf);
}
Modified: trunk/src/jason/asSyntax/Atom.java
===================================================================
--- trunk/src/jason/asSyntax/Atom.java 2008-07-17 09:16:19 UTC (rev 1352)
+++ trunk/src/jason/asSyntax/Atom.java 2008-08-10 11:06:39 UTC (rev 1353)
@@ -35,7 +35,7 @@
/**
* Represents an atom (a structure with no arguments, e.g. "tell", "a"), it is an
* immutable object. It extends Literal, so can be used in place of a
- * Literal, but does not allow operations on terms/atoms and can not be negated.
+ * Literal, but does not allow operations on terms/annots and can not be negated.
*/
public final class Atom extends Literal {
Modified: trunk/src/jason/bb/DefaultBeliefBase.java
===================================================================
--- trunk/src/jason/bb/DefaultBeliefBase.java 2008-07-17 09:16:19 UTC (rev 1352)
+++ trunk/src/jason/bb/DefaultBeliefBase.java 2008-08-10 11:06:39 UTC (rev 1353)
@@ -163,7 +163,9 @@
}
private boolean removeFromEntry(Literal l) {
- if (!l.hasSource()) {
+ if (l.hasSource()) {
+ return false;
+ } else {
PredicateIndicator key = l.getPredicateIndicator();
BelEntry entry = belsMap.get(key);
entry.remove(l);
@@ -172,8 +174,6 @@
}
size--;
return true;
- } else {
- return false;
}
}
Modified: trunk/src/jason/stdlib/package.html
===================================================================
--- trunk/src/jason/stdlib/package.html 2008-07-17 09:16:19 UTC (rev 1352)
+++ trunk/src/jason/stdlib/package.html 2008-08-10 11:06:39 UTC (rev 1353)
@@ -96,12 +96,13 @@
<h2>Meta programming</h2>
<ul>
- <li>{@link jason.stdlib.atom}: check whether an argument is an atom.</li>
+ <li>{@link jason.stdlib.atom}: check whether an argument is an atom (p).</li>
+ <li>{@link jason.stdlib.structure}: check whether an argument is a structure (p(t1,t2), [a,b]).</li>
+ <li>{@link jason.stdlib.literal}: check whether an argument is a literal (p(t1,t2), ~p(t1,t2), p(t1,t2)[a1,a2]).</li>
+ <li>{@link jason.stdlib.list}: check whether an argument is a list ([a,b]).</li>
<li>{@link jason.stdlib.ground}: check whether an argument is ground.</li>
- <li>{@link jason.stdlib.literal}: check whether an argument is a literal.</li>
- <li>{@link jason.stdlib.list}: check whether an argument is a list.</li>
- <li>{@link jason.stdlib.number}: check whether an argument is a number.</li>
- <li>{@link jason.stdlib.string}: check whether an argument is a string.</li>
+ <li>{@link jason.stdlib.number}: check whether an argument is a number (1, 2.3).</li>
+ <li>{@link jason.stdlib.string}: check whether an argument is a string ("s").</li>
<li>{@link jason.stdlib.ground}: check whether an argument is ground.</li>
<li>{@link jason.stdlib.add_annot}: add an annotation in a literal.</li>
<li>{@link jason.stdlib.add_nested_source}: add a source in a literal.</li>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|