|
From: <jom...@us...> - 2008-04-13 11:03:22
|
Revision: 1215
http://jason.svn.sourceforge.net/jason/?rev=1215&view=rev
Author: jomifred
Date: 2008-04-13 04:03:11 -0700 (Sun, 13 Apr 2008)
Log Message:
-----------
fig bug: add source(self) in goals without source
Modified Paths:
--------------
trunk/release-notes.txt
trunk/src/jason/asSemantics/TransitionSystem.java
Added Paths:
-----------
trunk/applications/as-unit-test/src/jason/tests/TestGoalSource.java
Added: trunk/applications/as-unit-test/src/jason/tests/TestGoalSource.java
===================================================================
--- trunk/applications/as-unit-test/src/jason/tests/TestGoalSource.java (rev 0)
+++ trunk/applications/as-unit-test/src/jason/tests/TestGoalSource.java 2008-04-13 11:03:11 UTC (rev 1215)
@@ -0,0 +1,30 @@
+package jason.tests;
+
+import jason.asunit.TestAgent;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class TestGoalSource {
+
+ TestAgent ag;
+
+ // initialisation of the agent test
+ @Before
+ public void setupAg() {
+ ag = new TestAgent();
+
+ // defines the agent's AgentSpeak code
+ ag.parseAScode(
+ "+!begin <- !g; !g[source(bob)]. "+
+ "+!g[source(A)] <- jason.asunit.print(A)."
+ );
+ }
+
+ @Test
+ public void testGoalSrouce() {
+ ag.addGoal("begin");
+ ag.assertPrint("self", 5);
+ ag.assertPrint("bob", 5);
+ }
+}
Property changes on: trunk/applications/as-unit-test/src/jason/tests/TestGoalSource.java
___________________________________________________________________
Name: svn:executable
+ *
Modified: trunk/release-notes.txt
===================================================================
--- trunk/release-notes.txt 2008-04-13 10:45:08 UTC (rev 1214)
+++ trunk/release-notes.txt 2008-04-13 11:03:11 UTC (rev 1215)
@@ -4,7 +4,9 @@
Bugs fixed:
. use nested source annotations in communication
+. add "source(self)" in goals without source
+
-------------
version 1.1.0
-------------
Modified: trunk/src/jason/asSemantics/TransitionSystem.java
===================================================================
--- trunk/src/jason/asSemantics/TransitionSystem.java 2008-04-13 10:45:08 UTC (rev 1214)
+++ trunk/src/jason/asSemantics/TransitionSystem.java 2008-04-13 11:03:11 UTC (rev 1215)
@@ -461,6 +461,11 @@
case achieve:
// free variables in an event cannot conflict with those in the plan
body = (Literal)body.clone();
+ if (!body.hasSource()) {
+ // do not add source(self) in case the
+ // programmer set some annotation
+ body.addAnnot(BeliefBase.TSelf);
+ }
body.makeVarsAnnon();
conf.C.addAchvGoal(body, conf.C.SI);
confP.step = State.StartRC;
@@ -469,6 +474,11 @@
// Rule Achieve as a New Focus (the !! operator)
case achieveNF:
body = (Literal)body.clone();
+ if (!body.hasSource()) {
+ // do not add source(self) in case the
+ // programmer set some annotation
+ body.addAnnot(BeliefBase.TSelf);
+ }
body.makeVarsAnnon();
conf.C.addAchvGoal(body, Intention.EmptyInt);
updateIntention();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|