You can subscribe to this list here.
2008 |
Jan
|
Feb
|
Mar
(35) |
Apr
(96) |
May
(39) |
Jun
(25) |
Jul
(7) |
Aug
(7) |
Sep
(44) |
Oct
(17) |
Nov
(14) |
Dec
(9) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2009 |
Jan
(5) |
Feb
(28) |
Mar
(26) |
Apr
(14) |
May
(3) |
Jun
(3) |
Jul
(13) |
Aug
(41) |
Sep
(12) |
Oct
|
Nov
(2) |
Dec
(17) |
2010 |
Jan
(9) |
Feb
(5) |
Mar
(11) |
Apr
(3) |
May
(4) |
Jun
(2) |
Jul
(3) |
Aug
(8) |
Sep
(2) |
Oct
(11) |
Nov
(3) |
Dec
(1) |
2011 |
Jan
|
Feb
(1) |
Mar
(8) |
Apr
(4) |
May
(4) |
Jun
(5) |
Jul
(3) |
Aug
(2) |
Sep
(7) |
Oct
(4) |
Nov
(4) |
Dec
(2) |
2012 |
Jan
|
Feb
|
Mar
(4) |
Apr
(11) |
May
(8) |
Jun
(2) |
Jul
(7) |
Aug
(6) |
Sep
(2) |
Oct
(2) |
Nov
|
Dec
(3) |
2013 |
Jan
|
Feb
(1) |
Mar
(7) |
Apr
(3) |
May
(1) |
Jun
(4) |
Jul
(8) |
Aug
(4) |
Sep
(4) |
Oct
(6) |
Nov
(8) |
Dec
(6) |
2014 |
Jan
|
Feb
|
Mar
(2) |
Apr
(4) |
May
(6) |
Jun
(10) |
Jul
|
Aug
(7) |
Sep
(15) |
Oct
(4) |
Nov
(1) |
Dec
(1) |
2015 |
Jan
|
Feb
(1) |
Mar
(10) |
Apr
(4) |
May
(6) |
Jun
(1) |
Jul
|
Aug
(2) |
Sep
(2) |
Oct
(5) |
Nov
(6) |
Dec
(12) |
2016 |
Jan
(1) |
Feb
(4) |
Mar
(7) |
Apr
(30) |
May
(5) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <jom...@us...> - 2013-07-18 00:44:07
|
Revision: 1740 http://sourceforge.net/p/jason/svn/1740 Author: jomifred Date: 2013-07-18 00:44:04 +0000 (Thu, 18 Jul 2013) Log Message: ----------- fix (again) the bug with .wait and timeout Modified Paths: -------------- trunk/src/jason/asSyntax/ListTermImpl.java trunk/src/jason/stdlib/wait.java Modified: trunk/src/jason/asSyntax/ListTermImpl.java =================================================================== --- trunk/src/jason/asSyntax/ListTermImpl.java 2013-07-16 21:12:30 UTC (rev 1739) +++ trunk/src/jason/asSyntax/ListTermImpl.java 2013-07-18 00:44:04 UTC (rev 1740) @@ -440,8 +440,10 @@ } public List<Term> next() { + if (next == null) + getNext(); List<Term> r = next; - getNext(); + next = null; return r; } Modified: trunk/src/jason/stdlib/wait.java =================================================================== --- trunk/src/jason/stdlib/wait.java 2013-07-16 21:12:30 UTC (rev 1739) +++ trunk/src/jason/stdlib/wait.java 2013-07-18 00:44:04 UTC (rev 1740) @@ -147,11 +147,13 @@ startTime = System.currentTimeMillis(); - ts.getAg().getScheduler().schedule(new Runnable() { - public void run() { - resume(true); - } - }, timeout, TimeUnit.MILLISECONDS); + if (timeout >= 0) { + ts.getAg().getScheduler().schedule(new Runnable() { + public void run() { + resume(true); + } + }, timeout, TimeUnit.MILLISECONDS); + } } void resume(final boolean stopByTimeout) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jom...@us...> - 2013-07-16 21:12:33
|
Revision: 1739 http://sourceforge.net/p/jason/svn/1739 Author: jomifred Date: 2013-07-16 21:12:30 +0000 (Tue, 16 Jul 2013) Log Message: ----------- fix bug in wait when arg is zero Modified Paths: -------------- trunk/applications/as-unit-test/src/jason/tests/TestAll.java trunk/src/jason/asSemantics/TransitionSystem.java trunk/src/jason/stdlib/wait.java Added Paths: ----------- trunk/applications/as-unit-test/src/jason/tests/TestCopyTerm.java Modified: trunk/applications/as-unit-test/src/jason/tests/TestAll.java =================================================================== --- trunk/applications/as-unit-test/src/jason/tests/TestAll.java 2013-07-14 00:40:37 UTC (rev 1738) +++ trunk/applications/as-unit-test/src/jason/tests/TestAll.java 2013-07-16 21:12:30 UTC (rev 1739) @@ -24,6 +24,7 @@ TestPlanbodyAsTerm.class, TestPlanFailure.class, TestVarInContext.class, - TestUnnamedVar.class + TestUnnamedVar.class, + TestCopyTerm.class }) public class TestAll { } Added: trunk/applications/as-unit-test/src/jason/tests/TestCopyTerm.java =================================================================== --- trunk/applications/as-unit-test/src/jason/tests/TestCopyTerm.java (rev 0) +++ trunk/applications/as-unit-test/src/jason/tests/TestCopyTerm.java 2013-07-16 21:12:30 UTC (rev 1739) @@ -0,0 +1,25 @@ +package jason.tests; + +import jason.asunit.TestAgent; + +import org.junit.Test; + +public class TestCopyTerm { + + @Test(timeout=2000) + public void testUnnamedVar() { + TestAgent ag = new TestAgent(); + + // defines the agent's AgentSpeak code + ag.parseAScode( + "copy_term(T,T). "+ + "+!test1 : copy_term(a(B),Y) <- jason.asunit.print(Y). "+ + "+!test2 : copy_term(a(B),Y) <- B=10; jason.asunit.print(Y). " + ); + ag.addGoal("test1"); + ag.assertPrint("a(_", 10); // cannot print(a(3) + ag.addGoal("test2"); + ag.assertPrint("a(10)", 10); // cannot print(a(3) + } + +} Modified: trunk/src/jason/asSemantics/TransitionSystem.java =================================================================== --- trunk/src/jason/asSemantics/TransitionSystem.java 2013-07-14 00:40:37 UTC (rev 1738) +++ trunk/src/jason/asSemantics/TransitionSystem.java 2013-07-16 21:12:30 UTC (rev 1739) @@ -1267,17 +1267,16 @@ if (failEvent != null) { failEvent.getTrigger().getLiteral().addAnnots(JasonException.createBasicErrorAnnots("deadline_reached", "")); ts.getC().addEvent(failEvent); - ts.getLogger().fine("'.fail_goal("+g+")' is generating a goal deletion event: " + failEvent.getTrigger()); + ts.getLogger().fine("'hard_deadline("+g+")' is generating a goal deletion event: " + failEvent.getTrigger()); return 2; } else { // i is finished or without failure plan - ts.getLogger().fine("'.fail_goal("+g+")' is removing the intention without event:\n" + i); + ts.getLogger().fine("'hard_deadline("+g+")' is removing the intention without event:\n" + i); return 3; } } } return 0; } - } public boolean canSleep() { Modified: trunk/src/jason/stdlib/wait.java =================================================================== --- trunk/src/jason/stdlib/wait.java 2013-07-14 00:40:37 UTC (rev 1738) +++ trunk/src/jason/stdlib/wait.java 2013-07-16 21:12:30 UTC (rev 1739) @@ -147,13 +147,11 @@ startTime = System.currentTimeMillis(); - if (timeout > 0) { - ts.getAg().getScheduler().schedule(new Runnable() { - public void run() { - resume(true); - } - }, timeout, TimeUnit.MILLISECONDS); - } + ts.getAg().getScheduler().schedule(new Runnable() { + public void run() { + resume(true); + } + }, timeout, TimeUnit.MILLISECONDS); } void resume(final boolean stopByTimeout) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jom...@us...> - 2013-07-14 00:40:42
|
Revision: 1738 http://sourceforge.net/p/jason/svn/1738 Author: jomifred Date: 2013-07-14 00:40:37 +0000 (Sun, 14 Jul 2013) Log Message: ----------- improve subset implementation Modified Paths: -------------- trunk/src/jason/asSyntax/ListTermImpl.java trunk/src/jason/asSyntax/Literal.java trunk/src/test/ListTermTest.java Modified: trunk/src/jason/asSyntax/ListTermImpl.java =================================================================== --- trunk/src/jason/asSyntax/ListTermImpl.java 2013-07-13 20:14:39 UTC (rev 1737) +++ trunk/src/jason/asSyntax/ListTermImpl.java 2013-07-14 00:40:37 UTC (rev 1738) @@ -418,16 +418,24 @@ } /** returns all subsets that take k elements of this list */ - public Iterator<List<Term>> subSets(int k) { - // DFS algorithm - final List<SubSetSearchState> open = new LinkedList<SubSetSearchState>(); // states to explore - open.add(new SubSetSearchState(new ArrayList<Term>(), getAsList(), k)); // initial state (root of search tree) + public Iterator<List<Term>> subSets(final int k) { + // based on a DFS algorithm return new Iterator<List<Term>>() { + LinkedList<SubSetSearchState> open = null; + Term[] thisAsArray = new Term[0]; + List<Term> next = null; public boolean hasNext() { - if (next == null) + if (open == null) { + open = new LinkedList<SubSetSearchState>(); // states to explore + //open.add(new SubSetSearchState(new ArrayList<Term>(), getAsList(), k)); // initial state (root of search tree) + thisAsArray = getAsList().toArray(thisAsArray); + open.add(new SubSetSearchState(0, k, null, null)); // initial state (root of search tree) + } + if (next == null) { getNext(); + } return next != null; } @@ -439,37 +447,71 @@ void getNext() { while (! open.isEmpty() ) { - SubSetSearchState s = open.remove(0); - if (s.k == 0) { - next = s.prefix; + SubSetSearchState s = open.removeFirst(); + if (s.d == 0) { + next = s.getAsList(); return; } else { - s.addNexts(open); + s.addNexts(); } } next = null; } public void remove() { } + + class SubSetSearchState { + int pos; + int d; + Term value = null; + SubSetSearchState f = null; + + SubSetSearchState(int pos, int d, Term t, SubSetSearchState father) { + this.pos = pos; this.d = d; this.value = t; this.f = father; + } + void addNexts() { + int pSize = (k-d)+thisAsArray.length; + for (int i = thisAsArray.length-1; i >= pos; i--) { + if (pSize-i >= k) { + open.addFirst(new SubSetSearchState(i+1, d-1, thisAsArray[i], this)); + } + } + } + + List<Term> getAsList() { + LinkedList<Term> np = new LinkedList<Term>(); + SubSetSearchState c = this; + while (c.value != null) { + np.addFirst(c.value); + c = c.f; + } + return np; + } + } + + /*// old code + class SubSetSearchState { + List<Term> prefix, elements; + int d; + SubSetSearchState(List<Term> p, List<Term> e, int d) { + prefix = p; elements = e; this.d = d; + } + void addNexts(List<SubSetSearchState> open) { + int esize = elements.size(); + int maxNextSize = prefix.size()+esize; + for (int i = esize-1; i >= 0; i--) { + if (maxNextSize-i >= k) { + List<Term> np = new ArrayList<Term>(prefix); + np.add(elements.get(i)); + open.add(0, new SubSetSearchState(np, elements.subList(i+1, esize), d-1)); + } + } + } + } + */ }; } - class SubSetSearchState { - List<Term> prefix, elements; - int k; - SubSetSearchState(List<Term> p, List<Term> e, int k) { - prefix = p; elements = e; this.k = k; - } - void addNexts(List<SubSetSearchState> open) { - int esize = elements.size(); - for (int i = esize-1; i >= 0; i--) { - List<Term> np = new ArrayList<Term>(prefix); - np.add(elements.get(i)); - open.add(0, new SubSetSearchState(np, elements.subList(i+1, esize), k-1)); - } - } - } - /* public List<List<Term>> subSets(int k) { List<List<Term>> result = new ArrayList<List<Term>>(); Modified: trunk/src/jason/asSyntax/Literal.java =================================================================== --- trunk/src/jason/asSyntax/Literal.java 2013-07-13 20:14:39 UTC (rev 1737) +++ trunk/src/jason/asSyntax/Literal.java 2013-07-14 00:40:37 UTC (rev 1738) @@ -351,7 +351,6 @@ if (annotsOptions != null) { while (annotsOptions.hasNext()) { Literal belToTry = belInBB.copy().setAnnots(null).addAnnots( annotsOptions.next() ); - Unifier u = un.clone(); if (u.unifiesNoUndo(Literal.this, belToTry)) { current = u; @@ -445,8 +444,6 @@ if (belInBB.hasAnnot()) { int nbAnnotsB = belInBB.getAnnots().size(); if (nbAnnotsB >= nbAnnots) { - if (nbAnnots > 5) - logger.warning("I am generating "+Math.pow(2, nbAnnots)+" subsets for the annotation backtracking consult of "+Literal.this); annotsOptions = belInBB.getAnnots().subSets( nbAnnots ); get(); if (current != null) // if it get a value Modified: trunk/src/test/ListTermTest.java =================================================================== --- trunk/src/test/ListTermTest.java 2013-07-13 20:14:39 UTC (rev 1737) +++ trunk/src/test/ListTermTest.java 2013-07-14 00:40:37 UTC (rev 1738) @@ -334,14 +334,17 @@ public void testSubSet() { ListTerm l3 = ListTermImpl.parseList("[a,b,c,8]"); - /*Set<PredicateIndicator> types = new HashSet<PredicateIndicator>(); - types.add( ((Literal)l3.get(1) ).getPredicateIndicator()); - types.add( ((Literal)l3.get(2) ).getPredicateIndicator()); - types.add( ((Literal)l3.get(3) ).getPredicateIndicator());*/ assertEquals("[[a], [b], [c], [8]]", iterator2list(l3.subSets(1)).toString()); assertEquals("[[a, b], [a, c], [a, 8], [b, c], [b, 8], [c, 8]]", iterator2list(l3.subSets(2)).toString()); assertEquals("[[a, b, c], [a, b, 8], [a, c, 8], [b, c, 8]]", iterator2list(l3.subSets(3)).toString()); assertEquals("[[a, b, c, 8]]", iterator2list(l3.subSets(4)).toString()); + + l3 = ListTermImpl.parseList("[a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20]"); + //for (int i=0; i< 20;i++) + // System.out.println(iterator2list(l3.subSets(i+1)).size()); + assertEquals("[[a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20]]",iterator2list(l3.subSets(20)).toString()); + assertEquals(38760, iterator2list(l3.subSets(6)).size()); + assertEquals(38760, iterator2list(l3.subSets(14)).size()); } public void testMkVarAn() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jom...@us...> - 2013-07-13 20:14:42
|
Revision: 1737 http://sourceforge.net/p/jason/svn/1737 Author: jomifred Date: 2013-07-13 20:14:39 +0000 (Sat, 13 Jul 2013) Log Message: ----------- improve delBel so that backtracking on annotations is avoided, if possible Modified Paths: -------------- trunk/src/jason/asSemantics/Agent.java trunk/src/jason/asSyntax/Literal.java Modified: trunk/src/jason/asSemantics/Agent.java =================================================================== --- trunk/src/jason/asSemantics/Agent.java 2013-07-12 14:01:11 UTC (rev 1736) +++ trunk/src/jason/asSemantics/Agent.java 2013-07-13 20:14:39 UTC (rev 1737) @@ -840,17 +840,22 @@ if (logger.isLoggable(Level.FINE)) logger.fine("Doing brf for " + beliefToDel + " in BB=" + believes(beliefToDel, u)); - if (believes(beliefToDel, u)) { - beliefToDel.apply(u); - if (getBB().remove(beliefToDel)) { - if (logger.isLoggable(Level.FINE)) logger.fine("Removed:" + beliefToDel); - if (result == null) { - result = new List[2]; - result[0] = Collections.emptyList(); - } - result[1] = Collections.singletonList(beliefToDel); + boolean removed = getBB().remove(beliefToDel); + if (!removed && !beliefToDel.isGround()) { // then try to unify the parameter with a belief in BB + if (believes(beliefToDel, u)) { + beliefToDel.apply(u); + removed = getBB().remove(beliefToDel); } } + + if (removed) { + if (logger.isLoggable(Level.FINE)) logger.fine("Removed:" + beliefToDel); + if (result == null) { + result = new List[2]; + result[0] = Collections.emptyList(); + } + result[1] = Collections.singletonList(beliefToDel); + } } } catch (Exception e) { logger.log(Level.WARNING, "Error at BRF.",e); Modified: trunk/src/jason/asSyntax/Literal.java =================================================================== --- trunk/src/jason/asSyntax/Literal.java 2013-07-12 14:01:11 UTC (rev 1736) +++ trunk/src/jason/asSyntax/Literal.java 2013-07-13 20:14:39 UTC (rev 1737) @@ -445,6 +445,8 @@ if (belInBB.hasAnnot()) { int nbAnnotsB = belInBB.getAnnots().size(); if (nbAnnotsB >= nbAnnots) { + if (nbAnnots > 5) + logger.warning("I am generating "+Math.pow(2, nbAnnots)+" subsets for the annotation backtracking consult of "+Literal.this); annotsOptions = belInBB.getAnnots().subSets( nbAnnots ); get(); if (current != null) // if it get a value This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jom...@us...> - 2013-07-12 14:01:14
|
Revision: 1736 http://sourceforge.net/p/jason/svn/1736 Author: jomifred Date: 2013-07-12 14:01:11 +0000 (Fri, 12 Jul 2013) Log Message: ----------- fix a minor comment error in hard deadline sources Modified Paths: -------------- trunk/build.xml trunk/demos/hard_deadline/bob.asl trunk/src/jason/asSemantics/TransitionSystem.java Modified: trunk/build.xml =================================================================== --- trunk/build.xml 2013-07-10 21:10:34 UTC (rev 1735) +++ trunk/build.xml 2013-07-12 14:01:11 UTC (rev 1736) @@ -19,7 +19,7 @@ <property name="jedit.install.dir" value="${basedir}/bin/jedit" /> <property name="plugin.jar.name" value="jason-jedit-plugin.jar" /> - <!-- define Maven coordinates --> + <!-- define Maven coordinates --> <property name="groupId" value="net.sf.jason" /> <property name="artifactId" value="jason" /> <!-- define artifacts' name, which follows the convention of Maven --> Modified: trunk/demos/hard_deadline/bob.asl =================================================================== --- trunk/demos/hard_deadline/bob.asl 2013-07-10 21:10:34 UTC (rev 1735) +++ trunk/demos/hard_deadline/bob.asl 2013-07-12 14:01:11 UTC (rev 1736) @@ -2,18 +2,18 @@ +!start <- .print(init); - !!g(9)[hard_deadline(7000)]; // creates a new intention for g with deadline of 9 seconds + !!g(9)[hard_deadline(7000)]; // creates a new intention for g with deadline of 7 seconds !g(4)[hard_deadline(3000)]; // creates a subgoal with deadline of 3 seconds !g(1)[hard_deadline(2000)]; .print(end1); !g(1); - !g(1); !g(1); !g(1); + !g(1); !g(1); .print(end2). +!g(V) <- .wait(V*1000); .print(g);. --!g(V)[error(ErrorId)] <- .print("failed by ",ErrorId," for g(",V,")"). +-!g(V)[error(ErrorId)] <- .print("failed, ",ErrorId," for g(",V,")"). Modified: trunk/src/jason/asSemantics/TransitionSystem.java =================================================================== --- trunk/src/jason/asSemantics/TransitionSystem.java 2013-07-10 21:10:34 UTC (rev 1735) +++ trunk/src/jason/asSemantics/TransitionSystem.java 2013-07-12 14:01:11 UTC (rev 1736) @@ -936,18 +936,20 @@ // get vars in the unifier that comes from makeVarAnnon (stored in renamedVars) - for (VarTerm ov: im.renamedVars.function.keySet()) { - UnnamedVar vt = (UnnamedVar)im.renamedVars.function.get(ov); - im.unif.unifiesNoUndo(ov, vt); // introduces the renaming in the current unif - // if vt has got a value from the top (a "return" value), include this value in the current unif - Term vl = topIM.unif.function.get(vt); - //System.out.println(ov+"="+vt+"="+vl); - if (vl != null) { // vt has value in top - vl = vl.clone(); - vl.apply(topIM.unif); - if (vl.isLiteral()) - ((Literal)vl).makeVarsAnnon(); - im.unif.bind(vt, vl); + if (im.renamedVars != null) { + for (VarTerm ov: im.renamedVars.function.keySet()) { + UnnamedVar vt = (UnnamedVar)im.renamedVars.function.get(ov); + im.unif.unifiesNoUndo(ov, vt); // introduces the renaming in the current unif + // if vt has got a value from the top (a "return" value), include this value in the current unif + Term vl = topIM.unif.function.get(vt); + //System.out.println(ov+"="+vt+"="+vl); + if (vl != null) { // vt has value in top + vl = vl.clone(); + vl.apply(topIM.unif); + if (vl.isLiteral()) + ((Literal)vl).makeVarsAnnon(); + im.unif.bind(vt, vl); + } } } //System.out.println("=> "+im.unif); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jom...@us...> - 2013-07-10 21:10:39
|
Revision: 1735 http://sourceforge.net/p/jason/svn/1735 Author: jomifred Date: 2013-07-10 21:10:34 +0000 (Wed, 10 Jul 2013) Log Message: ----------- implements hard deadline for (sub)goals Modified Paths: -------------- trunk/release-notes.txt trunk/src/jason/asSemantics/Intention.java trunk/src/jason/asSemantics/TransitionSystem.java trunk/src/jason/asSyntax/ASSyntax.java trunk/src/jason/asSyntax/Literal.java trunk/src/jason/asSyntax/Pred.java trunk/src/jason/stdlib/create_agent.java trunk/src/jason/stdlib/desire.java trunk/src/jason/stdlib/drop_intention.java trunk/src/jason/stdlib/fail_goal.java trunk/src/jason/stdlib/intend.java trunk/src/jason/stdlib/succeed_goal.java Added Paths: ----------- trunk/demos/hard_deadline/ trunk/demos/hard_deadline/bob.asl trunk/demos/hard_deadline/hard_deadline.mas2j Added: trunk/demos/hard_deadline/bob.asl =================================================================== --- trunk/demos/hard_deadline/bob.asl (rev 0) +++ trunk/demos/hard_deadline/bob.asl 2013-07-10 21:10:34 UTC (rev 1735) @@ -0,0 +1,19 @@ +!start. + ++!start + <- .print(init); + !!g(9)[hard_deadline(7000)]; // creates a new intention for g with deadline of 9 seconds + !g(4)[hard_deadline(3000)]; // creates a subgoal with deadline of 3 seconds + !g(1)[hard_deadline(2000)]; + .print(end1); + !g(1); + !g(1); + !g(1); + !g(1); + !g(1); + .print(end2). + ++!g(V) <- .wait(V*1000); .print(g);. + +-!g(V)[error(ErrorId)] <- .print("failed by ",ErrorId," for g(",V,")"). + Added: trunk/demos/hard_deadline/hard_deadline.mas2j =================================================================== --- trunk/demos/hard_deadline/hard_deadline.mas2j (rev 0) +++ trunk/demos/hard_deadline/hard_deadline.mas2j 2013-07-10 21:10:34 UTC (rev 1735) @@ -0,0 +1,6 @@ +/* This demo shows how to use goals with deadlines, see the bob.asl */ + +MAS hard_deadline { + agents: bob; +} + Modified: trunk/release-notes.txt =================================================================== --- trunk/release-notes.txt 2013-07-05 12:45:53 UTC (rev 1734) +++ trunk/release-notes.txt 2013-07-10 21:10:34 UTC (rev 1735) @@ -1,4 +1,16 @@ --------------------------- +version 1.3.10 + +revision XXX on SVN +--------------------------- + +New features +- (sub)goals can have a deadline, e.g. + ...; !g(4)[hard_deadline(3000)]; ... + if g(4) is not finished in 3 seconds, a failure event is produced. + + +--------------------------- version 1.3.9 revision 1721 on SVN Modified: trunk/src/jason/asSemantics/Intention.java =================================================================== --- trunk/src/jason/asSemantics/Intention.java 2013-07-05 12:45:53 UTC (rev 1734) +++ trunk/src/jason/asSemantics/Intention.java 2013-07-10 21:10:34 UTC (rev 1735) @@ -136,6 +136,10 @@ return null; } + public IntendedMeans getBottom() { + return intendedMeans.getLast(); + } + /** returns true if the intention has an IM where TE = g, using u to verify equality */ public boolean hasTrigger(Trigger g, Unifier u) { //return getIM(g,u) != null; Modified: trunk/src/jason/asSemantics/TransitionSystem.java =================================================================== --- trunk/src/jason/asSemantics/TransitionSystem.java 2013-07-05 12:45:53 UTC (rev 1734) +++ trunk/src/jason/asSemantics/TransitionSystem.java 2013-07-10 21:10:34 UTC (rev 1735) @@ -35,6 +35,7 @@ import jason.asSyntax.Literal; import jason.asSyntax.LiteralImpl; import jason.asSyntax.LogicalFormula; +import jason.asSyntax.NumberTerm; import jason.asSyntax.NumberTermImpl; import jason.asSyntax.Plan; import jason.asSyntax.PlanBody; @@ -52,6 +53,8 @@ import jason.bb.BeliefBase; import jason.runtime.Settings; import jason.stdlib.add_nested_source; +import jason.stdlib.desire; +import jason.stdlib.fail_goal; import java.util.ArrayList; import java.util.HashMap; @@ -61,9 +64,11 @@ import java.util.Map; import java.util.Queue; import java.util.concurrent.ConcurrentLinkedQueue; +import java.util.concurrent.TimeUnit; import java.util.logging.Level; import java.util.logging.Logger; + public class TransitionSystem { public enum State { StartRC, SelEv, RelPl, ApplPl, SelAppl, FindOp, AddIM, ProcAct, SelInt, ExecInt, ClrInt } @@ -684,14 +689,16 @@ // Rule Achieve case achieve: body = prepareBodyForEvent(body, u, conf.C.SI.peek()); - conf.C.addAchvGoal(body, conf.C.SI); + Event evt = conf.C.addAchvGoal(body, conf.C.SI); confP.step = State.StartRC; + checkHardDeadline(evt); break; // Rule Achieve as a New Focus (the !! operator) case achieveNF: body = prepareBodyForEvent(body, u, null); - conf.C.addAchvGoal(body, Intention.EmptyInt); + evt = conf.C.addAchvGoal(body, Intention.EmptyInt); + checkHardDeadline(evt); updateIntention(); break; @@ -707,7 +714,7 @@ body = prepareBodyForEvent(body, u, conf.C.SI.peek()); if (body.isLiteral()) { // in case body is a var with content that is not a literal (note the VarTerm pass in the instanceof Literal) Trigger te = new Trigger(TEOperator.add, TEType.test, body); - Event evt = new Event(te, conf.C.SI); + evt = new Event(te, conf.C.SI); if (ag.getPL().hasCandidatePlan(te)) { if (logger.isLoggable(Level.FINE)) logger.fine("Test Goal '" + h + "' failed as simple query. Generating internal event for it: "+te); conf.C.addEvent(evt); @@ -931,7 +938,7 @@ // get vars in the unifier that comes from makeVarAnnon (stored in renamedVars) for (VarTerm ov: im.renamedVars.function.keySet()) { UnnamedVar vt = (UnnamedVar)im.renamedVars.function.get(ov); - im.unif.unifiesNoUndo(ov, vt); // introduces the renameming in the current unif + im.unif.unifiesNoUndo(ov, vt); // introduces the renaming in the current unif // if vt has got a value from the top (a "return" value), include this value in the current unif Term vl = topIM.unif.function.get(vt); //System.out.println(ov+"="+vt+"="+vl); @@ -1164,18 +1171,113 @@ } // code - if (eventLiteral.getAnnots("code").isEmpty()) + if (eventLiteral.getAnnot("code") == null) eventLiteral.addAnnot(ASSyntax.createStructure("code", bodyterm.copy().makeVarsAnnon())); // ASL source - if (eventLiteral.getAnnots("code_src").isEmpty()) + if (eventLiteral.getAnnot("code_src") == null) eventLiteral.addAnnot(ASSyntax.createStructure("code_src", codesrc)); // line in the source - if (eventLiteral.getAnnots("code_line").isEmpty()) + if (eventLiteral.getAnnot("code_line") == null) eventLiteral.addAnnot(ASSyntax.createStructure("code_line", codeline)); } + /* + * check if the event is a goal addition with hard deadline, if so, schedule a verification after the deadline + */ + protected void checkHardDeadline(final Event evt) { + final Literal body = evt.getTrigger().getLiteral(); + Literal hdl = body.getAnnot(ASSyntax.hardDeadLineStr); + if (hdl == null) + return; + if (hdl.getArity() < 1) + return; + + // schedule the verification of deadline for the intention + final Intention intention = evt.getIntention(); + final int isize; + if (intention == null) + isize = 0; + else + isize = intention.size(); + int deadline = (int)((NumberTerm)hdl.getTerm(0)).solve(); + + getAg().getScheduler().schedule(new Runnable() { + public void run() { + runAtBeginOfNextCycle(new Runnable() { + public void run() { + boolean drop = false; + if (intention == null) { // deadline in !!g, test if the agent still desires it + drop = desire.allDesires(C, body, new Unifier()).hasNext(); + } else if (intention.size() >= isize && intention.hasTrigger(evt.getTrigger(), new Unifier())) { + drop = true; + } + if (drop) { + try { + FailWithDeadline ia = new FailWithDeadline(intention, evt.getTrigger()); + ia.drop(TransitionSystem.this, body, new Unifier()); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + }); + getUserAgArch().wake(); + } + }, deadline, TimeUnit.MILLISECONDS); + } + + class FailWithDeadline extends fail_goal { + Intention intToDrop; + Trigger te; + + public FailWithDeadline(Intention i, Trigger t) { + intToDrop = i; + te = t; + } + + /* returns: >0 the intention was changed + * 1 = intention must continue running + * 2 = fail event was generated and added in C.E + * 3 = simply removed without event + */ + @Override + public int dropIntention(Intention i, Trigger g, TransitionSystem ts, Unifier un) throws JasonException { + if (i != null) { + // only consider dropping if the intention is the one that created the deadline goal + if (intToDrop == null) { + if (te != i.getBottom().getTrigger()) { // no intention, then consider the bottom trigger + return 0; + } + } else if (!intToDrop.equals(i)) { + return 0; + } + + if (i.dropGoal(g, un)) { + // notify listener + if (ts.hasGoalListener()) + for (GoalListener gl: ts.getGoalListeners()) + gl.goalFailed(g); + + // generate failure event + Event failEvent = ts.findEventForFailure(i, g); // find fail event for the goal just dropped + if (failEvent != null) { + failEvent.getTrigger().getLiteral().addAnnots(JasonException.createBasicErrorAnnots("deadline_reached", "")); + ts.getC().addEvent(failEvent); + ts.getLogger().fine("'.fail_goal("+g+")' is generating a goal deletion event: " + failEvent.getTrigger()); + return 2; + } else { // i is finished or without failure plan + ts.getLogger().fine("'.fail_goal("+g+")' is removing the intention without event:\n" + i); + return 3; + } + } + } + return 0; + } + + } + public boolean canSleep() { return (C.isAtomicIntentionSuspended() && !conf.C.hasMsg()) || (!conf.C.hasEvent() && !conf.C.hasIntention() && Modified: trunk/src/jason/asSyntax/ASSyntax.java =================================================================== --- trunk/src/jason/asSyntax/ASSyntax.java 2013-07-05 12:45:53 UTC (rev 1734) +++ trunk/src/jason/asSyntax/ASSyntax.java 2013-07-10 21:10:34 UTC (rev 1735) @@ -58,6 +58,8 @@ */ public class ASSyntax { + public static final String hardDeadLineStr = "hard_deadline"; + // ---- // ---- createX methods // ---- Modified: trunk/src/jason/asSyntax/Literal.java =================================================================== --- trunk/src/jason/asSyntax/Literal.java 2013-07-05 12:45:53 UTC (rev 1734) +++ trunk/src/jason/asSyntax/Literal.java 2013-07-10 21:10:34 UTC (rev 1735) @@ -175,6 +175,10 @@ * in case that there is no such an annot, it returns an empty list. */ public ListTerm getAnnots(String functor) { return new ListTermImpl(); } + + /** returns the first annotation (literal) that has the <i>functor</i> */ + public Literal getAnnot(String functor) { return null; } + /** * returns the sources of this literal as a new list. e.g.: from annots * [source(a), source(b)], it returns [a,b] Modified: trunk/src/jason/asSyntax/Pred.java =================================================================== --- trunk/src/jason/asSyntax/Pred.java 2013-07-05 12:45:53 UTC (rev 1734) +++ trunk/src/jason/asSyntax/Pred.java 2013-07-10 21:10:34 UTC (rev 1735) @@ -210,7 +210,27 @@ } return false; //annots.contains(t); } + + @Override + public Literal getAnnot(String functor) { + if (annots == null) + return null; + // annots are ordered + for (Term t: annots) { + if (t.isLiteral()) { + Literal l = (Literal)t; + int c = functor.compareTo(l.getFunctor()); + if (c == 0) { // equals + return l; + } else if (c < 0) { + return null; + } + } + } + return null; + } + @Override public boolean hasAnnot() { return annots != null && !annots.isEmpty(); @@ -272,8 +292,8 @@ if (annots != null) { ListTerm tail = ls; for (Term ta : annots) { - if (ta.isStructure()) { - if (((Structure)ta).getFunctor().equals(functor)) { + if (ta.isLiteral()) { + if (((Literal)ta).getFunctor().equals(functor)) { tail = tail.append(ta); } } Modified: trunk/src/jason/stdlib/create_agent.java =================================================================== --- trunk/src/jason/stdlib/create_agent.java 2013-07-05 12:45:53 UTC (rev 1734) +++ trunk/src/jason/stdlib/create_agent.java 2013-07-10 21:10:34 UTC (rev 1735) @@ -77,7 +77,7 @@ <code>.create_agent(bob,"x.asl", [agentClass("myp.MyAgent"), agentArchClass("myp.MyArch"), beliefBaseClass("jason.bb.TextPersistentBB")])</code>: creates the - agent with agent, acrchitecture and belief base customised.</li> + agent with agent, architecture and belief base customised.</li> </ul> @@ -134,7 +134,6 @@ } } } - } RuntimeServicesInfraTier rs = ts.getUserAgArch().getRuntimeServices(); name = rs.createAgent(name, fSource.getAbsolutePath(), agClass, agArchClasses, bbPars, ts.getSettings()); Modified: trunk/src/jason/stdlib/desire.java =================================================================== --- trunk/src/jason/stdlib/desire.java 2013-07-05 12:45:53 UTC (rev 1734) +++ trunk/src/jason/stdlib/desire.java 2013-07-10 21:10:34 UTC (rev 1735) @@ -110,7 +110,7 @@ //private static Logger logger = Logger.getLogger(desire.class.getName()); - protected Iterator<Unifier> allDesires(final Circumstance C, final Literal l, final Unifier un) { + public static Iterator<Unifier> allDesires(final Circumstance C, final Literal l, final Unifier un) { final Trigger teFromL = new Trigger(TEOperator.add, TEType.achieve, l); return new Iterator<Unifier>() { Modified: trunk/src/jason/stdlib/drop_intention.java =================================================================== --- trunk/src/jason/stdlib/drop_intention.java 2013-07-05 12:45:53 UTC (rev 1734) +++ trunk/src/jason/stdlib/drop_intention.java 2013-07-10 21:10:34 UTC (rev 1735) @@ -87,7 +87,7 @@ return true; } - public void dropInt(Circumstance C, Literal l, Unifier un) { + public static void dropInt(Circumstance C, Literal l, Unifier un) { Unifier bak = un.clone(); Trigger g = new Trigger(TEOperator.add, TEType.achieve, l); Modified: trunk/src/jason/stdlib/fail_goal.java =================================================================== --- trunk/src/jason/stdlib/fail_goal.java 2013-07-05 12:45:53 UTC (rev 1734) +++ trunk/src/jason/stdlib/fail_goal.java 2013-07-10 21:10:34 UTC (rev 1735) @@ -88,7 +88,7 @@ * 3 = simply removed without event */ @Override - int dropIntention(Intention i, Trigger g, TransitionSystem ts, Unifier un) throws JasonException { + public int dropIntention(Intention i, Trigger g, TransitionSystem ts, Unifier un) throws JasonException { if (i != null) { if (i.dropGoal(g, un)) { // notify listener @@ -105,10 +105,10 @@ } if (failEvent != null) { ts.getC().addEvent(failEvent); - ts.getLogger().info("'.fail_goal("+g+")' is generating a goal deletion event: " + failEvent.getTrigger()); + ts.getLogger().fine("'.fail_goal("+g+")' is generating a goal deletion event: " + failEvent.getTrigger()); return 2; } else { // i is finished or without failure plan - ts.getLogger().info("'.fail_goal("+g+")' is removing the intention without event:\n" + i); + ts.getLogger().fine("'.fail_goal("+g+")' is removing the intention without event:\n" + i); return 3; } } Modified: trunk/src/jason/stdlib/intend.java =================================================================== --- trunk/src/jason/stdlib/intend.java 2013-07-05 12:45:53 UTC (rev 1734) +++ trunk/src/jason/stdlib/intend.java 2013-07-10 21:10:34 UTC (rev 1735) @@ -148,7 +148,7 @@ //private static Logger logger = Logger.getLogger(intend.class.getName()); - protected Iterator<Unifier> allIntentions(final Circumstance C, final Literal l, final Unifier un) { + public static Iterator<Unifier> allIntentions(final Circumstance C, final Literal l, final Unifier un) { final Trigger g = new Trigger(TEOperator.add, TEType.achieve, l); return new Iterator<Unifier>() { Modified: trunk/src/jason/stdlib/succeed_goal.java =================================================================== --- trunk/src/jason/stdlib/succeed_goal.java 2013-07-05 12:45:53 UTC (rev 1734) +++ trunk/src/jason/stdlib/succeed_goal.java 2013-07-10 21:10:34 UTC (rev 1735) @@ -194,7 +194,7 @@ * 2 = fail event was generated and added in C.E * 3 = simply removed without event */ - int dropIntention(Intention i, Trigger g, TransitionSystem ts, Unifier un) throws JasonException { + public int dropIntention(Intention i, Trigger g, TransitionSystem ts, Unifier un) throws JasonException { if (i != null && i.dropGoal(g, un)) { if (ts.hasGoalListener()) for (GoalListener gl: ts.getGoalListeners()) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jom...@us...> - 2013-07-05 12:45:57
|
Revision: 1734 http://sourceforge.net/p/jason/svn/1734 Author: jomifred Date: 2013-07-05 12:45:53 +0000 (Fri, 05 Jul 2013) Log Message: ----------- fix a bug in returned values from sub-goals Modified Paths: -------------- trunk/applications/as-unit-test/src/jason/tests/BugVarsAsArg.java trunk/src/jason/asSemantics/ConcurrentInternalAction.java trunk/src/jason/asSemantics/IntendedMeans.java trunk/src/jason/asSemantics/TransitionSystem.java trunk/src/jason/asSemantics/Unifier.java trunk/src/jason/asSyntax/Structure.java trunk/src/jason/asSyntax/UnnamedVar.java Modified: trunk/applications/as-unit-test/src/jason/tests/BugVarsAsArg.java =================================================================== --- trunk/applications/as-unit-test/src/jason/tests/BugVarsAsArg.java 2013-06-19 18:56:59 UTC (rev 1733) +++ trunk/applications/as-unit-test/src/jason/tests/BugVarsAsArg.java 2013-07-05 12:45:53 UTC (rev 1734) @@ -27,10 +27,13 @@ "+!pml0(L,L). "+ "+!pml(V1,V2,R) <- !pml0([V1,V2],R). "+ + "+!g(V1,V2) <- V2=p(V1,H). "+ + "+!test1 <- ?test_rule(T,A); A = a(V); T=45; jason.asunit.print(V). "+ "+!test2 <- ?ml(A,B,L); A=1; B=2; jason.asunit.print(L). "+ "+!test2p <- !pml(A,B,L); A=1; B=2; jason.asunit.print(L). "+ - "+!test3 <- L=[X,Y]; ?append(L, [Z], L2); Z=a; X=f; Y=i; jason.asunit.print(L2). " + "+!test3 <- L=[X,Y]; ?append(L, [Z], L2); Z=a; X=f; Y=i; jason.asunit.print(L2). " + + "+!test4 <- X=3; !g(X,R); H=6; jason.asunit.print(R)." // the H from !g should not mix the G here ); } @@ -58,4 +61,9 @@ ag.addGoal("test3"); ag.assertPrint("[f,i,a]", 10); } + @Test(timeout=2000) + public void testRule4() { + ag.addGoal("test4"); + ag.assertPrint("p(3,_", 10); + } } Modified: trunk/src/jason/asSemantics/ConcurrentInternalAction.java =================================================================== --- trunk/src/jason/asSemantics/ConcurrentInternalAction.java 2013-06-19 18:56:59 UTC (rev 1733) +++ trunk/src/jason/asSemantics/ConcurrentInternalAction.java 2013-07-05 12:45:53 UTC (rev 1734) @@ -151,7 +151,6 @@ ts.getUserAgArch().wake(); } - @Override public void destroy() throws Exception { } } Modified: trunk/src/jason/asSemantics/IntendedMeans.java =================================================================== --- trunk/src/jason/asSemantics/IntendedMeans.java 2013-06-19 18:56:59 UTC (rev 1733) +++ trunk/src/jason/asSemantics/IntendedMeans.java 2013-07-05 12:45:53 UTC (rev 1734) @@ -45,6 +45,8 @@ protected Plan plan; private Trigger trigger; // the trigger which created this IM + protected Unifier renamedVars = null; + public IntendedMeans(Option opt, Trigger te) { plan = opt.getPlan(); planBody = plan.getBody(); Modified: trunk/src/jason/asSemantics/TransitionSystem.java =================================================================== --- trunk/src/jason/asSemantics/TransitionSystem.java 2013-06-19 18:56:59 UTC (rev 1733) +++ trunk/src/jason/asSemantics/TransitionSystem.java 2013-07-05 12:45:53 UTC (rev 1734) @@ -46,6 +46,7 @@ import jason.asSyntax.Trigger; import jason.asSyntax.Trigger.TEOperator; import jason.asSyntax.Trigger.TEType; +import jason.asSyntax.UnnamedVar; import jason.asSyntax.VarTerm; import jason.asSyntax.parser.ParseException; import jason.bb.BeliefBase; @@ -682,14 +683,14 @@ // Rule Achieve case achieve: - body = prepareBodyForEvent(body, u); + body = prepareBodyForEvent(body, u, conf.C.SI.peek()); conf.C.addAchvGoal(body, conf.C.SI); confP.step = State.StartRC; break; // Rule Achieve as a New Focus (the !! operator) case achieveNF: - body = prepareBodyForEvent(body, u); + body = prepareBodyForEvent(body, u, null); conf.C.addAchvGoal(body, Intention.EmptyInt); updateIntention(); break; @@ -703,7 +704,7 @@ boolean fail = true; // generate event when using literal in the test (no events for log. expr. like ?(a & b)) if (f.isLiteral() && !(f instanceof BinaryStructure)) { - body = prepareBodyForEvent(body, u); + body = prepareBodyForEvent(body, u, conf.C.SI.peek()); if (body.isLiteral()) { // in case body is a var with content that is not a literal (note the VarTerm pass in the instanceof Literal) Trigger te = new Trigger(TEOperator.add, TEType.test, body); Event evt = new Event(te, conf.C.SI); @@ -726,7 +727,7 @@ case delAddBel: // -+a(1,X) ===> remove a(_,_), add a(1,X) // change all vars to anon vars to remove it - Literal b2 = prepareBodyForEvent(body, u); + Literal b2 = prepareBodyForEvent(body, u, conf.C.SI.peek()); b2.makeTermsAnnon(); // do not change body (but b2), to not interfere in addBel // to delete, create events as external to avoid that // remove/add create two events for the same intention @@ -750,13 +751,15 @@ case addBelBegin: case addBelEnd: case addBelNewFocus: - body = prepareBodyForEvent(body, u); - // calculate focus Intention newfocus = Intention.EmptyInt; boolean isSameFocus = setts.sameFocus() && h.getBodyType() != BodyType.addBelNewFocus; - if (isSameFocus) + if (isSameFocus) { newfocus = conf.C.SI; + body = prepareBodyForEvent(body, u, newfocus.peek()); + } else { + body = prepareBodyForEvent(body, u, null); + } // call BRF try { @@ -780,12 +783,14 @@ break; case delBel: - body = prepareBodyForEvent(body, u); newfocus = Intention.EmptyInt; - if (setts.sameFocus()) + if (setts.sameFocus()) { newfocus = conf.C.SI; - + body = prepareBodyForEvent(body, u, newfocus.peek()); + } else { + body = prepareBodyForEvent(body, u, null); + } // call BRF try { List<Literal>[] result = ag.brf(null, body, conf.C.SI); // the intention is not the new focus @@ -806,10 +811,14 @@ } // add the self source in the body in case no other source was given - private Literal prepareBodyForEvent(Literal body, Unifier u) { + private Literal prepareBodyForEvent(Literal body, Unifier u, IntendedMeans imRenamedVars) { body = body.copy(); body.apply(u); - body.makeVarsAnnon(u); // free variables in an event cannot conflict with those in the plan + Unifier renamedVars = new Unifier(); + if (imRenamedVars != null) + imRenamedVars.renamedVars = renamedVars; + body.makeVarsAnnon(renamedVars); // free variables in an event cannot conflict with those in the plan + //body.makeVarsAnnon(u); // free variables in an event cannot conflict with those in the plan body = body.forceFullLiteralImpl(); if (!body.hasSource()) { // do not add source(self) in case the programmer set the source body.addAnnot(BeliefBase.TSelf); @@ -878,8 +887,64 @@ if (!im.isFinished()) { // removes !b or ?s // unifies the final event with the body that called it - topLiteral.apply(topIM.unif); + + // old code: + /*topLiteral.apply(topIM.unif); + topLiteral.makeVarsAnnon(); im.unif.unifies(im.removeCurrentStep(), topLiteral); + */ + + // new code optimised: handle directly renamed vars for the call + //System.out.println("* "+topLiteral+topIM.unif+" "+im.unif+" "+im.renamedVars); + /*VarTerm[] lvt = null; + Term[] lvl = null; + int n = 0; + // get vars in the unifier that comes from makeVarAnnon + for (Term t: im.unif.function.values()) { + if (t instanceof UnnamedVar) { + UnnamedVar vt = (UnnamedVar)t; + if (vt.isFromMakeVarAnnon()) { + Term vl = topIM.unif.function.get(vt); + if (vl != null) { // vt has value in top + vl = vl.clone(); + vl.apply(topIM.unif); + if (vl.isLiteral()) + ((Literal)vl).makeVarsAnnon(); + if (lvt == null) { + int s = Math.max(im.unif.size(),topIM.unif.size()); + lvt = new VarTerm[s]; + lvl = new Term[s]; + } + lvt[n] = vt; + lvl[n] = vl; + n++; + } + } + } + } + for (int il=0; il<n; il++) { + im.unif.bind(lvt[il], lvl[il]); + } + */ + + + // get vars in the unifier that comes from makeVarAnnon (stored in renamedVars) + for (VarTerm ov: im.renamedVars.function.keySet()) { + UnnamedVar vt = (UnnamedVar)im.renamedVars.function.get(ov); + im.unif.unifiesNoUndo(ov, vt); // introduces the renameming in the current unif + // if vt has got a value from the top (a "return" value), include this value in the current unif + Term vl = topIM.unif.function.get(vt); + //System.out.println(ov+"="+vt+"="+vl); + if (vl != null) { // vt has value in top + vl = vl.clone(); + vl.apply(topIM.unif); + if (vl.isLiteral()) + ((Literal)vl).makeVarsAnnon(); + im.unif.bind(vt, vl); + } + } + //System.out.println("=> "+im.unif); + im.removeCurrentStep(); } } } Modified: trunk/src/jason/asSemantics/Unifier.java =================================================================== --- trunk/src/jason/asSemantics/Unifier.java 2013-06-19 18:56:59 UTC (rev 1733) +++ trunk/src/jason/asSemantics/Unifier.java 2013-07-05 12:45:53 UTC (rev 1734) @@ -38,6 +38,7 @@ import java.util.HashMap; import java.util.Iterator; +import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; @@ -48,7 +49,7 @@ private static Logger logger = Logger.getLogger(Unifier.class.getName()); - protected HashMap<VarTerm, Term> function = new HashMap<VarTerm, Term>(); + protected Map<VarTerm, Term> function = new HashMap<VarTerm, Term>(); /** * @deprecated use t.apply(un) instead. @@ -109,7 +110,7 @@ */ @SuppressWarnings({ "rawtypes", "unchecked" }) public boolean unifies(Term t1, Term t2) { - HashMap cfunction = (HashMap)function.clone(); + Map cfunction = cloneFunction(); if (unifiesNoUndo(t1,t2)) { return true; } else { @@ -117,6 +118,12 @@ return false; } } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + private Map<VarTerm, Term> cloneFunction() { + return (Map<VarTerm, Term>)((HashMap)function).clone(); + //return new HashMap<VarTerm, Term>(function); + } /** this version of unifies does not undo the variables' mapping in case of failure. It is however faster than the version with @@ -357,11 +364,10 @@ } } - @SuppressWarnings({ "unchecked", "rawtypes" }) public Unifier clone() { try { Unifier newUn = new Unifier(); - newUn.function = (HashMap)function.clone(); + newUn.function = cloneFunction(); //newUn.compose(this); return newUn; } catch (Exception e) { Modified: trunk/src/jason/asSyntax/Structure.java =================================================================== --- trunk/src/jason/asSyntax/Structure.java 2013-06-19 18:56:59 UTC (rev 1733) +++ trunk/src/jason/asSyntax/Structure.java 2013-07-05 12:45:53 UTC (rev 1734) @@ -317,7 +317,9 @@ // if the variable hasn't been renamed given the input unifier, then rename it. if (deref.equals(vt)) { // forget the name - VarTerm var = useShortUnnamedVars ? new UnnamedVar() : new UnnamedVar("_" + UnnamedVar.getUniqueId() + t); + UnnamedVar var = useShortUnnamedVars ? new UnnamedVar() : new UnnamedVar("_" + UnnamedVar.getUniqueId() + t); + //var.setFromMakeVarAnnon(); + // if deref has annotations then we need to replicate these in the new variable if (deref.hasAnnot()) { var.setAnnots(deref.getAnnots().cloneLT()); Modified: trunk/src/jason/asSyntax/UnnamedVar.java =================================================================== --- trunk/src/jason/asSyntax/UnnamedVar.java 2013-06-19 18:56:59 UTC (rev 1733) +++ trunk/src/jason/asSyntax/UnnamedVar.java 2013-07-05 12:45:53 UTC (rev 1734) @@ -34,6 +34,7 @@ private static int varCont = 1; private int myId; + //private boolean fromRename = false; public UnnamedVar() { super("_" + (varCont++)); @@ -54,12 +55,23 @@ return varCont++; } + /* + public void setFromMakeVarAnnon() { + fromRename = true; + } + + public boolean isFromMakeVarAnnon() { + return fromRename; + } + */ + public Term clone() { if (hasValue()) { return getValue().clone(); } else { UnnamedVar newv = new UnnamedVar(getFunctor()); newv.myId = this.myId; + //newv.fromRename = this.fromRename; if (hasAnnot()) newv.addAnnots(this.getAnnots().cloneLT()); return newv; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jom...@us...> - 2013-06-19 18:57:02
|
Revision: 1733 http://sourceforge.net/p/jason/svn/1733 Author: jomifred Date: 2013-06-19 18:56:59 +0000 (Wed, 19 Jun 2013) Log Message: ----------- fix a bug in JDBC Belief Base (reported by Giancarlo Rafael C?\195?\179rdova Oliden <gia...@ou...>) Modified Paths: -------------- trunk/src/jason/bb/JDBCPersistentBB.java Modified: trunk/src/jason/bb/JDBCPersistentBB.java =================================================================== --- trunk/src/jason/bb/JDBCPersistentBB.java 2013-06-15 22:04:24 UTC (rev 1732) +++ trunk/src/jason/bb/JDBCPersistentBB.java 2013-06-19 18:56:59 UTC (rev 1733) @@ -229,9 +229,16 @@ @Override public boolean add(Literal l) { + return add(0, l); + } + + @Override + public boolean add(int index, Literal l) { if (!isDB(l)) return nextBB.add(l); - + if (index != 0) + logger.severe("JDBC BB does not support insert index "+index+" for "+l+", using index = 0!"); + Literal bl = contains(l); Statement stmt = null; try { @@ -252,13 +259,16 @@ // store bl annots stmt = conn.createStatement(); - stmt.executeUpdate("update "+getTableName(bl)+" set "+COL_ANNOT+" = '"+bl.getAnnots()+"' "+getWhere(l)); + String q = "update "+getTableName(bl)+" set "+COL_ANNOT+" = '"+bl.getAnnots()+"' "+getWhere(l); + if (logger.isLoggable(Level.FINE)) logger.fine("query for update "+q); + stmt.executeUpdate(q); return true; } } } else { // create insert command stmt = conn.createStatement(); + if (logger.isLoggable(Level.FINE)) logger.fine("query for insert "+getInsert(l)); stmt.executeUpdate(getInsert(l)); // add it in the percepts list if (l.hasAnnot(TPercept)) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jom...@us...> - 2013-06-15 22:04:27
|
Revision: 1732 http://sourceforge.net/p/jason/svn/1732 Author: jomifred Date: 2013-06-15 22:04:24 +0000 (Sat, 15 Jun 2013) Log Message: ----------- fix some URL in the FAQ Modified Paths: -------------- trunk/doc/faq/faq.tex Modified: trunk/doc/faq/faq.tex =================================================================== --- trunk/doc/faq/faq.tex 2013-06-15 21:56:19 UTC (rev 1731) +++ trunk/doc/faq/faq.tex 2013-06-15 22:04:24 UTC (rev 1732) @@ -1184,7 +1184,7 @@ \end{verbatim} More information is available at -\htlink{SourceForge page}{http://sourceforge.net/svn/?group_id=98417}. +\htlink{SourceForge page}{https://sourceforge.net/p/jason/svn/HEAD/tree/}. \end{enumerate} @@ -1192,7 +1192,7 @@ No, Jason is also available as a plugin to Eclipse, developed mostly by Germano Fronza; click -\htlink{here}{http://jasonplugin.wikidot.com/} for more information, +\htlink{here}{http://jason.sourceforge.net/mini-tutorial/eclipse-plugin} for more information, including installation instructions. A command line option is also available. To compile a project: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jom...@us...> - 2013-06-15 21:56:21
|
Revision: 1731 http://sourceforge.net/p/jason/svn/1731 Author: jomifred Date: 2013-06-15 21:56:19 +0000 (Sat, 15 Jun 2013) Log Message: ----------- update FAQ (SVN URL) Modified Paths: -------------- trunk/doc/faq/faq.tex Modified: trunk/doc/faq/faq.tex =================================================================== --- trunk/doc/faq/faq.tex 2013-06-02 21:30:48 UTC (rev 1730) +++ trunk/doc/faq/faq.tex 2013-06-15 21:56:19 UTC (rev 1731) @@ -1159,7 +1159,7 @@ sources, so you will eventually need to build \jason from the SVN. To do this the following software is required: \begin{itemize} -\item an \htlink{SVN}{http://sourceforge.net/docs/B01} client program and +\item a SVN client program and \item \htlink{Ant}{http://ant.apache.org/} version >= 1.6.2. \end{itemize} @@ -1167,9 +1167,7 @@ \begin{enumerate} \item download the sources from SVN: \begin{verbatim} -mkdir Jason-svn -cd Jason-svn -svn co https://jason.svn.sourceforge.net/svnroot/jason/trunk . +svn checkout svn://svn.code.sf.net/p/jason/svn/trunk jason-svn \end{verbatim} %When prompted for a password for anonymous, simply press the Enter key. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jom...@us...> - 2013-06-02 21:30:51
|
Revision: 1730 http://sourceforge.net/p/jason/svn/1730 Author: jomifred Date: 2013-06-02 21:30:48 +0000 (Sun, 02 Jun 2013) Log Message: ----------- consider the infraEnv as null in the agent architecture Modified Paths: -------------- trunk/src/jason/bb/DefaultBeliefBase.java trunk/src/jason/infra/centralised/CentralisedAgArch.java trunk/src/jason/infra/centralised/CentralisedRuntimeServices.java Modified: trunk/src/jason/bb/DefaultBeliefBase.java =================================================================== --- trunk/src/jason/bb/DefaultBeliefBase.java 2013-05-08 21:25:42 UTC (rev 1729) +++ trunk/src/jason/bb/DefaultBeliefBase.java 2013-06-02 21:30:48 UTC (rev 1730) @@ -288,8 +288,8 @@ /** each predicate indicator has one BelEntry assigned to it */ final class BelEntry { - final private List<Literal> list = new LinkedList<Literal>(); // maintains the order of the bels - final private Map<LiteralWrapper,Literal> map = new HashMap<LiteralWrapper,Literal>(); // to fastly find contents, from literal do list index + final private List<Literal> list = new LinkedList<Literal>(); // maintains the order of the beliefs + final private Map<LiteralWrapper,Literal> map = new HashMap<LiteralWrapper,Literal>(); // to find content faster public void add(Literal l, boolean addInEnd) { map.put(new LiteralWrapper(l), l); Modified: trunk/src/jason/infra/centralised/CentralisedAgArch.java =================================================================== --- trunk/src/jason/infra/centralised/CentralisedAgArch.java 2013-05-08 21:25:42 UTC (rev 1729) +++ trunk/src/jason/infra/centralised/CentralisedAgArch.java 2013-06-02 21:30:48 UTC (rev 1730) @@ -233,6 +233,7 @@ // Default perception assumes Complete and Accurate sensing. public List<Literal> perceive() { + if (infraEnv == null) return null; List<Literal> percepts = infraEnv.getUserEnvironment().getPercepts(getAgName()); if (logger.isLoggable(Level.FINE) && percepts != null) logger.fine("percepts: " + percepts); return percepts; @@ -291,7 +292,7 @@ /** called by the TS to ask the execution of an action in the environment */ public void act(ActionExec action, List<ActionExec> feedback) { if (logger.isLoggable(Level.FINE)) logger.info("doing: " + action.getActionTerm()); - if (isRunning()) + if (isRunning() && infraEnv != null) infraEnv.act(getAgName(), action); } Modified: trunk/src/jason/infra/centralised/CentralisedRuntimeServices.java =================================================================== --- trunk/src/jason/infra/centralised/CentralisedRuntimeServices.java 2013-05-08 21:25:42 UTC (rev 1729) +++ trunk/src/jason/infra/centralised/CentralisedRuntimeServices.java 2013-06-02 21:30:48 UTC (rev 1730) @@ -18,7 +18,7 @@ private static Logger logger = Logger.getLogger(CentralisedRuntimeServices.class.getName()); - private RunCentralisedMAS masRunner; + protected RunCentralisedMAS masRunner; public CentralisedRuntimeServices(RunCentralisedMAS masRunner) { this.masRunner = masRunner; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jom...@us...> - 2013-05-08 21:25:48
|
Revision: 1729 http://sourceforge.net/p/jason/svn/1729 Author: jomifred Date: 2013-05-08 21:25:42 +0000 (Wed, 08 May 2013) Log Message: ----------- fix a bug in the Environment class as suggested by Yingke Chen <y....@qu...> Modified Paths: -------------- trunk/src/jason/asSemantics/Circumstance.java trunk/src/jason/environment/Environment.java trunk/src/jason/stdlib/desire.java trunk/src/jason/stdlib/drop_all_intentions.java trunk/src/jason/stdlib/drop_desire.java trunk/src/jason/stdlib/drop_intention.java trunk/src/jason/stdlib/intend.java trunk/src/jason/stdlib/succeed_goal.java trunk/src/jason/stdlib/suspend.java Modified: trunk/src/jason/asSemantics/Circumstance.java =================================================================== --- trunk/src/jason/asSemantics/Circumstance.java 2013-04-26 21:24:52 UTC (rev 1728) +++ trunk/src/jason/asSemantics/Circumstance.java 2013-05-08 21:25:42 UTC (rev 1729) @@ -118,7 +118,6 @@ public void addEvent(Event ev) { if (ev.isAtomic()) - //hasAtomicEvent = true; AE = ev; else E.add(ev); @@ -177,7 +176,7 @@ } /** get the all events (which include the atomic event, if it exists) */ - public Iterator<Event> getAllEvents() { + public Iterator<Event> getEventsPlusAtomic() { if (AE == null) { return E.iterator(); } else { @@ -264,7 +263,7 @@ } /** get the all intentions (which include the atomic intention, if it exists) */ - public Iterator<Intention> getAllIntentions() { + public Iterator<Intention> getIntentionsPlusAtomic() { if (AI == null) { return I.iterator(); } else { @@ -662,7 +661,7 @@ Element events = (Element) document.createElement("events"); add = false; if (E != null && hasEvent()) { - Iterator<Event> ie = getAllEvents(); + Iterator<Event> ie = getEventsPlusAtomic(); while (ie.hasNext()) { Event evt = ie.next(); @@ -740,7 +739,7 @@ selIntEle.setAttribute("selected", "true"); ints.appendChild(selIntEle); } - Iterator<Intention> itint = getAllIntentions(); + Iterator<Intention> itint = getIntentionsPlusAtomic(); while (itint.hasNext()) { Intention in = itint.next(); if (getSelectedIntention() != in) { Modified: trunk/src/jason/environment/Environment.java =================================================================== --- trunk/src/jason/environment/Environment.java 2013-04-26 21:24:52 UTC (rev 1728) +++ trunk/src/jason/environment/Environment.java 2013-05-08 21:25:42 UTC (rev 1729) @@ -277,10 +277,11 @@ agl = Collections.synchronizedList(new ArrayList<Literal>()); agPercepts.put( agName, agl); } - if (! agl.contains(per)) { - uptodateAgs.remove(agName); - for (Literal p: per) + for (Literal p: per) { + if (! agl.contains(p)) { + uptodateAgs.remove(agName); agl.add(p); + } } } } Modified: trunk/src/jason/stdlib/desire.java =================================================================== --- trunk/src/jason/stdlib/desire.java 2013-04-26 21:24:52 UTC (rev 1728) +++ trunk/src/jason/stdlib/desire.java 2013-05-08 21:25:42 UTC (rev 1729) @@ -146,7 +146,7 @@ if (C.getSelectedEvent() != null) { Trigger t = C.getSelectedEvent().getTrigger(); Intention i = C.getSelectedEvent().getIntention(); - if (i != Intention.EmptyInt && !i.isFinished()) { //i.size() > 0) { + if (i != Intention.EmptyInt && !i.isFinished()) { t = t.clone(); t.apply(i.peek().getUnif()); } @@ -160,13 +160,13 @@ case evt: if (evtIterator == null) - evtIterator = C.getAllEvents(); + evtIterator = C.getEventsPlusAtomic(); if (evtIterator.hasNext()) { Event ei = evtIterator.next(); Trigger t = ei.getTrigger(); Intention i = ei.getIntention(); - if (i != Intention.EmptyInt && !i.isFinished()) { //i.size() > 0) { + if (i != Intention.EmptyInt && !i.isFinished()) { t = t.clone(); t.apply(i.peek().getUnif()); } Modified: trunk/src/jason/stdlib/drop_all_intentions.java =================================================================== --- trunk/src/jason/stdlib/drop_all_intentions.java 2013-04-26 21:24:52 UTC (rev 1728) +++ trunk/src/jason/stdlib/drop_all_intentions.java 2013-05-08 21:25:42 UTC (rev 1729) @@ -81,7 +81,7 @@ C.clearPendingActions(); // drop intentions in E - Iterator<Event> ie = C.getAllEvents(); + Iterator<Event> ie = C.getEventsPlusAtomic(); while (ie.hasNext()) { Event e = ie.next(); if (e.isInternal()) { Modified: trunk/src/jason/stdlib/drop_desire.java =================================================================== --- trunk/src/jason/stdlib/drop_desire.java 2013-04-26 21:24:52 UTC (rev 1728) +++ trunk/src/jason/stdlib/drop_desire.java 2013-05-08 21:25:42 UTC (rev 1729) @@ -85,7 +85,7 @@ Trigger te = new Trigger(TEOperator.add, TEType.achieve, l); // search in E - dropEvt(te, un, C.getAllEvents()); + dropEvt(te, un, C.getEventsPlusAtomic()); // search in PE (only the event need to be checked, the related intention is handeled by dropInt) dropEvt(te, un, C.getPendingEvents().values().iterator()); Modified: trunk/src/jason/stdlib/drop_intention.java =================================================================== --- trunk/src/jason/stdlib/drop_intention.java 2013-04-26 21:24:52 UTC (rev 1728) +++ trunk/src/jason/stdlib/drop_intention.java 2013-05-08 21:25:42 UTC (rev 1729) @@ -93,7 +93,7 @@ Trigger g = new Trigger(TEOperator.add, TEType.achieve, l); // intention may be suspended in E or PE - Iterator<Event> ie = C.getAllEvents(); + Iterator<Event> ie = C.getEventsPlusAtomic(); while (ie.hasNext()) { Event e = ie.next(); Intention i = e.getIntention(); @@ -119,7 +119,7 @@ } } - Iterator<Intention> itint = C.getAllIntentions(); + Iterator<Intention> itint = C.getIntentionsPlusAtomic(); while (itint.hasNext()) { Intention i = itint.next(); if (i.hasTrigger(g, un)) { Modified: trunk/src/jason/stdlib/intend.java =================================================================== --- trunk/src/jason/stdlib/intend.java 2013-04-26 21:24:52 UTC (rev 1728) +++ trunk/src/jason/stdlib/intend.java 2013-05-08 21:25:42 UTC (rev 1729) @@ -206,7 +206,7 @@ case evt: if (evtIterator == null) - evtIterator = C.getAllEvents(); + evtIterator = C.getEventsPlusAtomic(); if (evtIterator.hasNext()) { solution = un.clone(); @@ -277,7 +277,7 @@ case intentions: if (intInterator == null) - intInterator = C.getAllIntentions(); + intInterator = C.getIntentionsPlusAtomic(); if (intInterator.hasNext()) { solution = un.clone(); Modified: trunk/src/jason/stdlib/succeed_goal.java =================================================================== --- trunk/src/jason/stdlib/succeed_goal.java 2013-04-26 21:24:52 UTC (rev 1728) +++ trunk/src/jason/stdlib/succeed_goal.java 2013-05-08 21:25:42 UTC (rev 1729) @@ -97,7 +97,7 @@ Circumstance C = ts.getC(); Unifier bak = un.clone(); - Iterator<Intention> itint = C.getAllIntentions(); + Iterator<Intention> itint = C.getIntentionsPlusAtomic(); while (itint.hasNext()) { Intention i = itint.next(); if (dropIntention(i, g, ts, un) > 1) { @@ -111,7 +111,7 @@ un = bak.clone(); // dropping G in Events - Iterator<Event> ie = C.getAllEvents(); + Iterator<Event> ie = C.getEventsPlusAtomic(); while (ie.hasNext()) { Event e = ie.next(); // test in the intention Modified: trunk/src/jason/stdlib/suspend.java =================================================================== --- trunk/src/jason/stdlib/suspend.java 2013-04-26 21:24:52 UTC (rev 1728) +++ trunk/src/jason/stdlib/suspend.java 2013-05-08 21:25:42 UTC (rev 1729) @@ -124,7 +124,7 @@ } } - Iterator<Intention> itint = C.getAllIntentions(); + Iterator<Intention> itint = C.getIntentionsPlusAtomic(); while (itint.hasNext()) { Intention i = itint.next(); if (i.hasTrigger(g, un)) { @@ -145,7 +145,7 @@ // suspending G in Events int c = 0; - Iterator<Event> ie = C.getAllEvents(); + Iterator<Event> ie = C.getEventsPlusAtomic(); while (ie.hasNext()) { Event e = ie.next(); i = e.getIntention(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jom...@us...> - 2013-04-26 21:24:55
|
Revision: 1728 http://sourceforge.net/p/jason/svn/1728 Author: jomifred Date: 2013-04-26 21:24:52 +0000 (Fri, 26 Apr 2013) Log Message: ----------- fix small bug in .intend Modified Paths: -------------- trunk/src/jason/asSemantics/IntendedMeans.java trunk/src/jason/stdlib/desire.java trunk/src/jason/stdlib/intend.java Modified: trunk/src/jason/asSemantics/IntendedMeans.java =================================================================== --- trunk/src/jason/asSemantics/IntendedMeans.java 2013-04-26 20:12:17 UTC (rev 1727) +++ trunk/src/jason/asSemantics/IntendedMeans.java 2013-04-26 21:24:52 UTC (rev 1728) @@ -126,7 +126,7 @@ } public String toString() { - return planBody + " / " + unif; + return trigger + " <- ... " + planBody + " / " + unif; } public Term getAsTerm() { Modified: trunk/src/jason/stdlib/desire.java =================================================================== --- trunk/src/jason/stdlib/desire.java 2013-04-26 20:12:17 UTC (rev 1727) +++ trunk/src/jason/stdlib/desire.java 2013-04-26 21:24:52 UTC (rev 1728) @@ -108,6 +108,8 @@ enum Step { selEvt, evt, useIntends, end } + //private static Logger logger = Logger.getLogger(desire.class.getName()); + protected Iterator<Unifier> allDesires(final Circumstance C, final Literal l, final Unifier un) { final Trigger teFromL = new Trigger(TEOperator.add, TEType.achieve, l); @@ -120,6 +122,8 @@ public boolean hasNext() { if (solution == null) // the first call of hasNext should find the first response find(); + //if (solution == null) + // logger.info("* no more solution for "+teFromL+C); return solution != null; } @@ -127,6 +131,7 @@ if (solution == null) find(); Unifier b = solution; find(); // find next response + //logger.info("* try "+b+" for "+teFromL); return b; } public void remove() {} @@ -185,6 +190,8 @@ } else { curStep = Step.end; // set next step } + + case end: } solution = null; // nothing found Modified: trunk/src/jason/stdlib/intend.java =================================================================== --- trunk/src/jason/stdlib/intend.java 2013-04-26 20:12:17 UTC (rev 1727) +++ trunk/src/jason/stdlib/intend.java 2013-04-26 21:24:52 UTC (rev 1728) @@ -146,6 +146,8 @@ enum Step { selEvt, selInt, evt, pendEvt, pendAct, pendInt, intentions, end } + //private static Logger logger = Logger.getLogger(intend.class.getName()); + protected Iterator<Unifier> allIntentions(final Circumstance C, final Literal l, final Unifier un) { final Trigger g = new Trigger(TEOperator.add, TEType.achieve, l); @@ -280,11 +282,17 @@ if (intInterator.hasNext()) { solution = un.clone(); Intention i = intInterator.next(); + //logger.info("* try "+i+"\n"+intInterator.hasNext()); if (i.hasTrigger(g, solution)) return; } else { curStep = Step.end; // set next step } + find(); + return; + + case end: + } solution = null; // nothing found } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jom...@us...> - 2013-04-26 20:12:18
|
Revision: 1727 http://sourceforge.net/p/jason/svn/1727 Author: jomifred Date: 2013-04-26 20:12:17 +0000 (Fri, 26 Apr 2013) Log Message: ----------- fix a small bug in self .suspend Modified Paths: -------------- trunk/src/jason/stdlib/create_agent.java trunk/src/jason/stdlib/suspend.java Modified: trunk/src/jason/stdlib/create_agent.java =================================================================== --- trunk/src/jason/stdlib/create_agent.java 2013-04-17 20:43:17 UTC (rev 1726) +++ trunk/src/jason/stdlib/create_agent.java 2013-04-26 20:12:17 UTC (rev 1727) @@ -107,8 +107,6 @@ name = ((StringTerm)args[0]).getString(); else name = args[0].toString(); - - StringTerm source = (StringTerm)args[1]; Modified: trunk/src/jason/stdlib/suspend.java =================================================================== --- trunk/src/jason/stdlib/suspend.java 2013-04-17 20:43:17 UTC (rev 1726) +++ trunk/src/jason/stdlib/suspend.java 2013-04-26 20:12:17 UTC (rev 1727) @@ -98,7 +98,7 @@ Intention i = C.getSelectedIntention(); suspendIntention = true; i.setSuspended(true); - C.addPendingIntention(SELF_SUSPENDED_INT, i); + C.addPendingIntention(SELF_SUSPENDED_INT+i.getId(), i); return true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jom...@us...> - 2013-04-17 20:43:22
|
Revision: 1726 http://sourceforge.net/p/jason/svn/1726 Author: jomifred Date: 2013-04-17 20:43:17 +0000 (Wed, 17 Apr 2013) Log Message: ----------- improve performance for atomic intentions and events Modified Paths: -------------- trunk/build.xml trunk/demos/suspend-resume/test.asl trunk/src/jason/architecture/AgArch.java trunk/src/jason/asSemantics/Circumstance.java trunk/src/jason/asSemantics/ConcurrentInternalAction.java trunk/src/jason/asSemantics/TransitionSystem.java trunk/src/jason/runtime/RuntimeServicesInfraTier.java trunk/src/jason/stdlib/desire.java trunk/src/jason/stdlib/drop_all_intentions.java trunk/src/jason/stdlib/drop_desire.java trunk/src/jason/stdlib/drop_intention.java trunk/src/jason/stdlib/intend.java trunk/src/jason/stdlib/succeed_goal.java trunk/src/jason/stdlib/suspend.java trunk/src/jason/stdlib/wait.java Modified: trunk/build.xml =================================================================== --- trunk/build.xml 2013-03-27 15:42:10 UTC (rev 1725) +++ trunk/build.xml 2013-04-17 20:43:17 UTC (rev 1726) @@ -133,7 +133,7 @@ <target name="compile" depends="init,parsers"> - <javac srcdir="src" destdir="${build.dir}" debug="true" deprecation="true" optimize="true" nowarn="true" source="1.5" target="1.5" includeantruntime="false"> + <javac srcdir="src" destdir="${build.dir}" debug="true" deprecation="true" optimize="true" nowarn="true" source="1.6" target="1.6" includeantruntime="false"> <classpath refid="project.classpath" /> </javac> </target> Modified: trunk/demos/suspend-resume/test.asl =================================================================== --- trunk/demos/suspend-resume/test.asl 2013-03-27 15:42:10 UTC (rev 1725) +++ trunk/demos/suspend-resume/test.asl 2013-04-17 20:43:17 UTC (rev 1726) @@ -17,6 +17,6 @@ <- .wait(30); .suspend(dots); // suspend the intention with goal dots .println; - .wait(200); + .wait(1000); .resume(dots); // resume it !!control. Modified: trunk/src/jason/architecture/AgArch.java =================================================================== --- trunk/src/jason/architecture/AgArch.java 2013-03-27 15:42:10 UTC (rev 1725) +++ trunk/src/jason/architecture/AgArch.java 2013-04-17 20:43:17 UTC (rev 1726) @@ -124,6 +124,8 @@ } public void createCustomArchs(List<String> archs) throws Exception { + if (archs == null) + return; for (String agArchClass: archs) { // user custom arch if (!agArchClass.equals(AgArch.class.getName()) && !agArchClass.equals(CentralisedAgArch.class.getName())) { Modified: trunk/src/jason/asSemantics/Circumstance.java =================================================================== --- trunk/src/jason/asSemantics/Circumstance.java 2013-03-27 15:42:10 UTC (rev 1725) +++ trunk/src/jason/asSemantics/Circumstance.java 2013-04-17 20:43:17 UTC (rev 1726) @@ -58,8 +58,9 @@ protected Option SO; protected Intention SI; private Intention AI; // Atomic Intention + private Event AE; // Atomic Event private boolean atomicIntSuspended = false; // whether the current atomic intention is suspended in PA or PI - private boolean hasAtomicEvent = false; + //private boolean hasAtomicEvent = false; private Map<Integer, ActionExec> PA; // Pending actions, waiting action execution (key is the intention id) private List<ActionExec> FA; // Feedback actions, those that are already executed @@ -115,10 +116,12 @@ /** Events */ public void addEvent(Event ev) { - E.add(ev); if (ev.isAtomic()) - hasAtomicEvent = true; + //hasAtomicEvent = true; + AE = ev; + else + E.add(ev); // notify listeners if (listeners != null) @@ -147,38 +150,58 @@ } public boolean removeEvent(Event ev) { - if (E.remove(ev)) { - if (hasAtomicEvent && !ev.isAtomic()) { - hasAtomicEvent = false; - } + if (ev.equals(AE)) { + AE = null; return true; - } else { - return false; } + return E.remove(ev); } public void clearEvents() { // notify listeners if (listeners != null) - for (CircumstanceListener el : listeners) + for (CircumstanceListener el : listeners) { for (Event ev: E) el.intentionDropped(ev.getIntention()); + if (AE != null) + el.intentionDropped(AE.getIntention()); + } E.clear(); - hasAtomicEvent = false; + AE = null; } + /** get the queue of events (which does not include the atomic event) */ public Queue<Event> getEvents() { return E; } + + /** get the all events (which include the atomic event, if it exists) */ + public Iterator<Event> getAllEvents() { + if (AE == null) { + return E.iterator(); + } else { + List<Event> l = new ArrayList<Event>(E.size()+1); + l.add(AE); + l.addAll(E); + return l.iterator(); + } + } public boolean hasEvent() { - return !E.isEmpty(); + return AE != null || !E.isEmpty(); } + public Event getAtomicEvent() { + return AE; + } + /** remove and returns the event with atomic intention, null if none */ public Event removeAtomicEvent() { - if (!hasAtomicEvent) + Event e = AE; + AE = null; + return e; + /*if (!hasAtomicEvent) return null; Iterator<Event> i = E.iterator(); @@ -192,7 +215,7 @@ } // there is no AtomicEvent! hasAtomicEvent = false; - return null; + return null;*/ } /** Listeners */ @@ -212,7 +235,6 @@ } public boolean hasListener() { - //return listeners != null && !listeners.isEmpty(); return !listeners.isEmpty(); } @@ -236,19 +258,36 @@ /** Intentions */ + /** get the queue of intention (which does not include atomic intention) */ public Queue<Intention> getIntentions() { return I; } + + /** get the all intentions (which include the atomic intention, if it exists) */ + public Iterator<Intention> getAllIntentions() { + if (AI == null) { + return I.iterator(); + } else { + List<Intention> l = new ArrayList<Intention>(I.size()+1); + l.add(AI); + l.addAll(I); + return l.iterator(); + } + } public boolean hasIntention() { - return I != null && !I.isEmpty(); + return (I != null && !I.isEmpty()) || AI != null; } + public boolean hasIntention(Intention i) { + return i == AI || I.contains(i); + } public void addIntention(Intention intention) { - I.offer(intention); if (intention.isAtomic()) setAtomicIntention(intention); - + else + I.offer(intention); + // notify if (listeners != null) for (CircumstanceListener el : listeners) @@ -268,8 +307,10 @@ public boolean removeIntention(Intention i) { if (i == AI) { setAtomicIntention(null); + return true; + } else { + return I.remove(i); } - return I.remove(i); } /** removes and produces events to signal that the intention was dropped */ @@ -313,6 +354,8 @@ } public boolean hasAtomicIntention() { + //String x = (AI != null ? ""+AI.size() : ""); + //System.out.println(E.size()+" "+I.size()+" "+(AI != null)+" "+(AE != null)+" "+ x); return AI != null; } @@ -554,7 +597,9 @@ /** clone E, I, MB, PA, PI, FA, and AI */ public Circumstance clone() { Circumstance c = new Circumstance(); - c.hasAtomicEvent = this.hasAtomicEvent; + //c.hasAtomicEvent = this.hasAtomicEvent; + if (this.AE != null) + c.AE = (Event)this.AE.clone(); c.atomicIntSuspended = this.atomicIntSuspended; for (Event e: this.E) { @@ -616,8 +661,11 @@ // events Element events = (Element) document.createElement("events"); add = false; - if (E != null && !E.isEmpty()) { - for (Event evt: E) { + if (E != null && hasEvent()) { + Iterator<Event> ie = getAllEvents(); + while (ie.hasNext()) { + Event evt = ie.next(); + add = true; e = evt.getAsDOM(document); events.appendChild(e); @@ -692,7 +740,9 @@ selIntEle.setAttribute("selected", "true"); ints.appendChild(selIntEle); } - for (Intention in : getIntentions()) { + Iterator<Intention> itint = getAllIntentions(); + while (itint.hasNext()) { + Intention in = itint.next(); if (getSelectedIntention() != in) { ints.appendChild(in.getAsDOM(document)); } @@ -788,6 +838,7 @@ s.append(" SO="+SO+"\n"); s.append(" SI="+SI+"\n"); s.append(" AI="+AI+"\n"); + s.append(" AE="+AE+"\n"); s.append(" PA="+PA+"\n"); s.append(" PI="+PI+"\n"); s.append(" FA="+FA+"."); Modified: trunk/src/jason/asSemantics/ConcurrentInternalAction.java =================================================================== --- trunk/src/jason/asSemantics/ConcurrentInternalAction.java 2013-03-27 15:42:10 UTC (rev 1725) +++ trunk/src/jason/asSemantics/ConcurrentInternalAction.java 2013-04-17 20:43:17 UTC (rev 1726) @@ -150,4 +150,8 @@ }); ts.getUserAgArch().wake(); } + + @Override + public void destroy() throws Exception { + } } Modified: trunk/src/jason/asSemantics/TransitionSystem.java =================================================================== --- trunk/src/jason/asSemantics/TransitionSystem.java 2013-03-27 15:42:10 UTC (rev 1725) +++ trunk/src/jason/asSemantics/TransitionSystem.java 2013-04-17 20:43:17 UTC (rev 1726) @@ -349,14 +349,14 @@ return; } + // Rule for atomic, events from atomic intention have priority + confP.C.SE = C.removeAtomicEvent(); + if (confP.C.SE != null) { + confP.step = State.RelPl; + return; + } + if (conf.C.hasEvent()) { - // Rule for atomic, events from atomic intention has priority - confP.C.SE = C.removeAtomicEvent(); - if (confP.C.SE != null) { - confP.step = State.RelPl; - return; - } - // Rule SelEv1 confP.C.SE = conf.ag.selectEvent(confP.C.getEvents()); if (logger.isLoggable(Level.FINE)) @@ -542,6 +542,7 @@ if (!conf.C.isAtomicIntentionSuspended() && conf.C.hasIntention()) { // the isAtomicIntentionSuspended is necessary because the atomic intention may be suspended (the above removeAtomicInt returns null in that case) // but no other intention could be selected confP.C.SI = conf.ag.selectIntention(conf.C.getIntentions()); + if (logger.isLoggable(Level.FINE)) logger.fine("Selected intention "+confP.C.SI); if (confP.C.SI != null) { // the selectIntention function returned null return; } @@ -619,6 +620,8 @@ switch (h.getBodyType()) { + case none: break; + // Rule Action case action: body = body.copy(); body.apply(u); Modified: trunk/src/jason/runtime/RuntimeServicesInfraTier.java =================================================================== --- trunk/src/jason/runtime/RuntimeServicesInfraTier.java 2013-03-27 15:42:10 UTC (rev 1725) +++ trunk/src/jason/runtime/RuntimeServicesInfraTier.java 2013-04-17 20:43:17 UTC (rev 1726) @@ -23,8 +23,7 @@ * class (default value is DefaultBeliefBase), and <i>stts</i> as * Settings (default value is new Settings()). * - * <p> Example: createAgent("bob", "bob.asl", "mypkg.MyAgent", - * null, null, null); + * <p> Example: createAgent("bob", "bob.asl", "mypkg.MyAgent", null, null, null); * * Returns the name of the agent */ Modified: trunk/src/jason/stdlib/desire.java =================================================================== --- trunk/src/jason/stdlib/desire.java 2013-03-27 15:42:10 UTC (rev 1725) +++ trunk/src/jason/stdlib/desire.java 2013-04-17 20:43:17 UTC (rev 1726) @@ -155,7 +155,7 @@ case evt: if (evtIterator == null) - evtIterator = C.getEvents().iterator(); + evtIterator = C.getAllEvents(); if (evtIterator.hasNext()) { Event ei = evtIterator.next(); Modified: trunk/src/jason/stdlib/drop_all_intentions.java =================================================================== --- trunk/src/jason/stdlib/drop_all_intentions.java 2013-03-27 15:42:10 UTC (rev 1725) +++ trunk/src/jason/stdlib/drop_all_intentions.java 2013-04-17 20:43:17 UTC (rev 1726) @@ -24,6 +24,8 @@ package jason.stdlib; +import java.util.Iterator; + import jason.asSemantics.Circumstance; import jason.asSemantics.DefaultInternalAction; import jason.asSemantics.Event; @@ -79,7 +81,9 @@ C.clearPendingActions(); // drop intentions in E - for (Event e: C.getEvents()) { + Iterator<Event> ie = C.getAllEvents(); + while (ie.hasNext()) { + Event e = ie.next(); if (e.isInternal()) { C.removeEvent(e); } Modified: trunk/src/jason/stdlib/drop_desire.java =================================================================== --- trunk/src/jason/stdlib/drop_desire.java 2013-03-27 15:42:10 UTC (rev 1725) +++ trunk/src/jason/stdlib/drop_desire.java 2013-04-17 20:43:17 UTC (rev 1726) @@ -85,7 +85,7 @@ Trigger te = new Trigger(TEOperator.add, TEType.achieve, l); // search in E - dropEvt(te, un, C.getEvents().iterator()); + dropEvt(te, un, C.getAllEvents()); // search in PE (only the event need to be checked, the related intention is handeled by dropInt) dropEvt(te, un, C.getPendingEvents().values().iterator()); Modified: trunk/src/jason/stdlib/drop_intention.java =================================================================== --- trunk/src/jason/stdlib/drop_intention.java 2013-03-27 15:42:10 UTC (rev 1725) +++ trunk/src/jason/stdlib/drop_intention.java 2013-04-17 20:43:17 UTC (rev 1726) @@ -24,6 +24,8 @@ package jason.stdlib; +import java.util.Iterator; + import jason.JasonException; import jason.asSemantics.ActionExec; import jason.asSemantics.Circumstance; @@ -91,7 +93,9 @@ Trigger g = new Trigger(TEOperator.add, TEType.achieve, l); // intention may be suspended in E or PE - for (Event e: C.getEvents()) { + Iterator<Event> ie = C.getAllEvents(); + while (ie.hasNext()) { + Event e = ie.next(); Intention i = e.getIntention(); if (i != null && i.hasTrigger(g, un)) { C.removeEvent(e); @@ -115,7 +119,9 @@ } } - for (Intention i: C.getIntentions()) { + Iterator<Intention> itint = C.getAllIntentions(); + while (itint.hasNext()) { + Intention i = itint.next(); if (i.hasTrigger(g, un)) { C.dropIntention(i); un = bak.clone(); Modified: trunk/src/jason/stdlib/intend.java =================================================================== --- trunk/src/jason/stdlib/intend.java 2013-03-27 15:42:10 UTC (rev 1725) +++ trunk/src/jason/stdlib/intend.java 2013-04-17 20:43:17 UTC (rev 1726) @@ -24,8 +24,6 @@ package jason.stdlib; -import java.util.Iterator; - import jason.JasonException; import jason.asSemantics.ActionExec; import jason.asSemantics.Circumstance; @@ -40,7 +38,9 @@ import jason.asSyntax.Trigger.TEOperator; import jason.asSyntax.Trigger.TEType; +import java.util.Iterator; + /** <p>Internal action: <b><code>.intend(<i>I</i>)</code></b>. @@ -204,7 +204,7 @@ case evt: if (evtIterator == null) - evtIterator = C.getEvents().iterator(); + evtIterator = C.getAllEvents(); if (evtIterator.hasNext()) { solution = un.clone(); @@ -275,7 +275,7 @@ case intentions: if (intInterator == null) - intInterator = C.getIntentions().iterator(); + intInterator = C.getAllIntentions(); if (intInterator.hasNext()) { solution = un.clone(); Modified: trunk/src/jason/stdlib/succeed_goal.java =================================================================== --- trunk/src/jason/stdlib/succeed_goal.java 2013-03-27 15:42:10 UTC (rev 1725) +++ trunk/src/jason/stdlib/succeed_goal.java 2013-04-17 20:43:17 UTC (rev 1726) @@ -38,6 +38,8 @@ import jason.asSyntax.Trigger.TEOperator; import jason.asSyntax.Trigger.TEType; +import java.util.Iterator; + /** <p>Internal action: <b><code>.succeed_goal(<i>G</i>)</code></b>. @@ -95,7 +97,9 @@ Circumstance C = ts.getC(); Unifier bak = un.clone(); - for (Intention i: C.getIntentions()) { + Iterator<Intention> itint = C.getAllIntentions(); + while (itint.hasNext()) { + Intention i = itint.next(); if (dropIntention(i, g, ts, un) > 1) { C.dropIntention(i); un = bak.clone(); @@ -107,7 +111,9 @@ un = bak.clone(); // dropping G in Events - for (Event e: C.getEvents()) { + Iterator<Event> ie = C.getAllEvents(); + while (ie.hasNext()) { + Event e = ie.next(); // test in the intention Intention i = e.getIntention(); int r = dropIntention(i, g, ts, un); Modified: trunk/src/jason/stdlib/suspend.java =================================================================== --- trunk/src/jason/stdlib/suspend.java 2013-03-27 15:42:10 UTC (rev 1725) +++ trunk/src/jason/stdlib/suspend.java 2013-04-17 20:43:17 UTC (rev 1726) @@ -23,6 +23,8 @@ package jason.stdlib; +import java.util.Iterator; + import jason.JasonException; import jason.asSemantics.ActionExec; import jason.asSemantics.Circumstance; @@ -122,7 +124,9 @@ } } - for (Intention i: C.getIntentions()) { + Iterator<Intention> itint = C.getAllIntentions(); + while (itint.hasNext()) { + Intention i = itint.next(); if (i.hasTrigger(g, un)) { i.setSuspended(true); C.removeIntention(i); @@ -141,7 +145,9 @@ // suspending G in Events int c = 0; - for (Event e: C.getEvents()) { + Iterator<Event> ie = C.getAllEvents(); + while (ie.hasNext()) { + Event e = ie.next(); i = e.getIntention(); if (un.unifies(g, e.getTrigger()) || (i != null && i.hasTrigger(g, un))) { C.removeEvent(e); Modified: trunk/src/jason/stdlib/wait.java =================================================================== --- trunk/src/jason/stdlib/wait.java 2013-03-27 15:42:10 UTC (rev 1725) +++ trunk/src/jason/stdlib/wait.java 2013-04-17 20:43:17 UTC (rev 1726) @@ -165,7 +165,7 @@ public void run() { try { // add SI again in C.I if it was not removed and this wait was not dropped - if (c.removePendingIntention(sTE) == si && !c.getIntentions().contains(si) && !dropped) { + if (c.removePendingIntention(sTE) == si && !c.hasIntention(si) && !dropped) { if (stopByTimeout && te != null && elapsedTimeTerm == null) { // fail the .wait by timeout if (si.isSuspended()) { // if the intention was suspended by .suspend This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jom...@us...> - 2013-03-27 15:42:13
|
Revision: 1725 http://sourceforge.net/p/jason/svn/1725 Author: jomifred Date: 2013-03-27 15:42:10 +0000 (Wed, 27 Mar 2013) Log Message: ----------- include the method "destroy" in the internal action interface Modified Paths: -------------- trunk/src/jason/asSemantics/Agent.java trunk/src/jason/asSemantics/DefaultInternalAction.java trunk/src/jason/asSemantics/InternalAction.java Added Paths: ----------- trunk/src/jason/stdlib/copy_term.java Modified: trunk/src/jason/asSemantics/Agent.java =================================================================== --- trunk/src/jason/asSemantics/Agent.java 2013-03-26 16:56:17 UTC (rev 1724) +++ trunk/src/jason/asSemantics/Agent.java 2013-03-27 15:42:10 UTC (rev 1725) @@ -246,6 +246,13 @@ if (scheduler != null) scheduler.shutdownNow(); + + for (InternalAction ia: internalActions.values()) + try { + ia.destroy(); + } catch (Exception e) { + e.printStackTrace(); + } } /** Modified: trunk/src/jason/asSemantics/DefaultInternalAction.java =================================================================== --- trunk/src/jason/asSemantics/DefaultInternalAction.java 2013-03-26 16:56:17 UTC (rev 1724) +++ trunk/src/jason/asSemantics/DefaultInternalAction.java 2013-03-27 15:42:10 UTC (rev 1725) @@ -41,4 +41,8 @@ public Object execute(TransitionSystem ts, Unifier un, Term[] args) throws Exception { return false; } + + public void destroy() throws Exception { + + } } Modified: trunk/src/jason/asSemantics/InternalAction.java =================================================================== --- trunk/src/jason/asSemantics/InternalAction.java 2013-03-26 16:56:17 UTC (rev 1724) +++ trunk/src/jason/asSemantics/InternalAction.java 2013-03-27 15:42:10 UTC (rev 1725) @@ -48,4 +48,6 @@ * successfully executed. An Iterator result means that there is * more than one answer for this IA (e.g. see member internal action). */ Object execute(TransitionSystem ts, Unifier un, Term[] args) throws Exception; + + public void destroy() throws Exception; } Added: trunk/src/jason/stdlib/copy_term.java =================================================================== --- trunk/src/jason/stdlib/copy_term.java (rev 0) +++ trunk/src/jason/stdlib/copy_term.java 2013-03-27 15:42:10 UTC (rev 1725) @@ -0,0 +1,25 @@ +package jason.stdlib; + +import jason.JasonException; +import jason.asSemantics.DefaultInternalAction; +import jason.asSemantics.TransitionSystem; +import jason.asSemantics.Unifier; +import jason.asSyntax.Literal; +import jason.asSyntax.Term; + +public class copy_term extends DefaultInternalAction { + + @Override public int getMinArgs() { return 2; } + @Override public int getMaxArgs() { return 2; } + + @Override protected void checkArguments(Term[] args) throws JasonException { + super.checkArguments(args); // check number of arguments + if (!args[0].isLiteral()) + throw JasonException.createWrongArgument(this,"first argument must be a literal"); + } + + @Override + public Object execute(TransitionSystem ts, Unifier un, Term[] args) throws Exception { + return un.unifies(args[1], ((Literal)args[0]).makeVarsAnnon()); + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jom...@us...> - 2013-03-26 16:56:21
|
Revision: 1724 http://sourceforge.net/p/jason/svn/1724 Author: jomifred Date: 2013-03-26 16:56:17 +0000 (Tue, 26 Mar 2013) Log Message: ----------- add files to release a maven dist of jason.jar Modified Paths: -------------- trunk/build.xml trunk/release-notes.txt Added Paths: ----------- trunk/pom.xml Modified: trunk/build.xml =================================================================== --- trunk/build.xml 2013-03-14 16:40:44 UTC (rev 1723) +++ trunk/build.xml 2013-03-26 16:56:17 UTC (rev 1724) @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<project basedir="." default="usage" name="Jason"> +<project basedir="." default="usage" name="Jason" xmlns:artifact="antlib:org.apache.maven.artifact.ant"> <property environment="env" /> @@ -19,6 +19,19 @@ <property name="jedit.install.dir" value="${basedir}/bin/jedit" /> <property name="plugin.jar.name" value="jason-jedit-plugin.jar" /> + <!-- define Maven coordinates --> + <property name="groupId" value="net.sf.jason" /> + <property name="artifactId" value="jason" /> + <!-- define artifacts' name, which follows the convention of Maven --> + <property name="maven-jar" value="${distDir}/../${artifactId}-${version}.${release}.jar" /> + <property name="maven-javadoc-jar" value="${distDir}/../${artifactId}-${version}.${release}-javadoc.jar" /> + <property name="maven-sources-jar" value="${distDir}/../${artifactId}-${version}.${release}-sources.jar" /> + <!-- defined maven snapshots and staging repository id and url --> + <property name="maven-snapshots-repository-id" value="sonatype-nexus-snapshots" /> + <property name="maven-snapshots-repository-url" value="https://oss.sonatype.org/content/repositories/snapshots/" /> + <property name="maven-staging-repository-id" value="sonatype-nexus-staging" /> + <property name="maven-staging-repository-url" value="https://oss.sonatype.org/service/local/staging/deploy/maven2/" /> + <target name="usage"> <echo> TARGETS: @@ -157,7 +170,7 @@ <target name="signjar" depends="jar"> <copy file="${jasonJar}" tofile="${jasonSJar}" /> - <signjar jar="${jasonSJar}" alias="jason" storepass="rbjhja" keypass="rbjhja" keystore="${basedir}/src/jasonKeystore" /> + <signjar jar="${jasonSJar}" alias="jason" storepass="rbjhja" keypass="rbjhja" keystore="${basedir}/src/jasonKeystore" /> </target> <target name="plugin" depends="compile, jar"> @@ -366,6 +379,62 @@ </tar> </target> + <target name="maven-init" depends="jar" description="prepare maven files"> + <mkdir dir="${distDir}" /> + <copy file="${jasonJar}" tofile="${maven-jar}" /> + <jar jarfile="${maven-javadoc-jar}"> + <fileset dir="doc/api" /> + </jar> + <jar jarfile="${maven-sources-jar}"> + <fileset dir="src" /> + </jar> + </target> + + <!--target name="maven-deploy" depends="maven-init" description="generate the maven distribution"> + <artifact:mvn> + <arg value="org.apache.maven.plugins:maven-deploy-plugin:2.6:deploy-file" /> + <arg value="-Durl=${maven-snapshots-repository-url}" /> + <arg value="-DrepositoryId=${maven-snapshots-repository-id}" /> + <arg value="-DpomFile=pom.xml" /> + <arg value="-Dfile=${maven-jar}" /> + </artifact:mvn> + </target--> + + <target name="maven-stage" depends="maven-init" description="generate the maven distribution"> + <!-- sign and deploy the main artifact --> + <artifact:mvn> + <arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" /> + <arg value="-Durl=${maven-staging-repository-url}" /> + <arg value="-DrepositoryId=${maven-staging-repository-id}" /> + <arg value="-DpomFile=pom.xml" /> + <arg value="-Dfile=${maven-jar}" /> + <arg value="-Pgpg" /> + </artifact:mvn> + + <!-- sign and deploy the sources artifact --> + <artifact:mvn> + <arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" /> + <arg value="-Durl=${maven-staging-repository-url}" /> + <arg value="-DrepositoryId=${maven-staging-repository-id}" /> + <arg value="-DpomFile=pom.xml" /> + <arg value="-Dfile=${maven-sources-jar}" /> + <arg value="-Dclassifier=sources" /> + <arg value="-Pgpg" /> + </artifact:mvn> + + <!-- sign and deploy the javadoc artifact --> + <artifact:mvn> + <arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" /> + <arg value="-Durl=${maven-staging-repository-url}" /> + <arg value="-DrepositoryId=${maven-staging-repository-id}" /> + <arg value="-DpomFile=pom.xml" /> + <arg value="-Dfile=${maven-javadoc-jar}" /> + <arg value="-Dclassifier=javadoc" /> + <arg value="-Pgpg" /> + </artifact:mvn> + <echo message="close and release the stage as documented at https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide#SonatypeOSSMavenRepositoryUsageGuide-8a.ReleaseIt"/> + </target> + <target name="all" depends="parsers,compile,apidoc" description="Build everything."> <echo message="Application built." /> </target> Added: trunk/pom.xml =================================================================== --- trunk/pom.xml (rev 0) +++ trunk/pom.xml 2013-03-26 16:56:17 UTC (rev 1724) @@ -0,0 +1,40 @@ +<project> + <modelVersion>4.0.0</modelVersion> + <groupId>net.sf.jason</groupId> + <artifactId>jason</artifactId> + <packaging>jar</packaging> + <name>Jason</name> + <version>1.3.9</version> + <description>Jason is a fully-fledged interpreter for an extended version of AgentSpeak, a BDI agent-oriented logic programming language, and is implemented in Java. Using JADE a multi-agent system can be distributed over a network effortlessly.</description> + <url>http://jason.sf.net</url> + <licenses> + <license> + <name>GNU Library or Lesser General Public License version 2.0 (LGPLv2)</name> + <url>http://www.gnu.org/licenses/gpl-2.0.html</url> + <distribution>repo</distribution> + </license> + </licenses> + <scm> + <url>svn://svn.code.sf.net/p/jason/svn/trunk</url> + <connection>svn://svn.code.sf.net/p/jason/svn/trunk</connection> + </scm> + <developers> + <developer> + <id>Jomi</id> + <name>Jomi F. Hubner</name> + <email>jom...@gm...</email> + </developer> + <developer> + <id>Rafael</id> + <name>Rafael H. Bordini</name> + <email>raf...@gm...</email> + </developer> + </developers> + <dependencies> + <!-- Jade 4.0.1/Ant dependency> + <groupId>...</groupId> + <artifactId>...</artifactId> + <version>...</version> + </dependency--> + </dependencies> +</project> Modified: trunk/release-notes.txt =================================================================== --- trunk/release-notes.txt 2013-03-14 16:40:44 UTC (rev 1723) +++ trunk/release-notes.txt 2013-03-26 16:56:17 UTC (rev 1724) @@ -1,7 +1,7 @@ --------------------------- version 1.3.9 -revision 1718 on SVN +revision 1721 on SVN --------------------------- New features This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <xsp...@us...> - 2013-03-14 16:40:46
|
Revision: 1723 http://sourceforge.net/p/jason/svn/1723 Author: xsplyter Date: 2013-03-14 16:40:44 +0000 (Thu, 14 Mar 2013) Log Message: ----------- Setting the new jason.jar Modified Paths: -------------- trunk/applications/jason-eclipse-plugin2/jasonide/META-INF/MANIFEST.MF trunk/applications/jason-eclipse-plugin2/jasonide/lib/jason.jar trunk/applications/jason-eclipse-plugin2/jasonide.xtext.asl/META-INF/MANIFEST.MF trunk/applications/jason-eclipse-plugin2/jasonide.xtext.asl.ui/META-INF/MANIFEST.MF trunk/applications/jason-eclipse-plugin2/jasonide.xtext.mas2j/META-INF/MANIFEST.MF trunk/applications/jason-eclipse-plugin2/jasonide.xtext.mas2j.ui/META-INF/MANIFEST.MF trunk/applications/jason-eclipse-plugin2/jasonide_feature/feature.xml trunk/applications/jason-eclipse-plugin2/jasonide_site/artifacts.jar trunk/applications/jason-eclipse-plugin2/jasonide_site/content.jar trunk/applications/jason-eclipse-plugin2/jasonide_site/logs.zip trunk/applications/jason-eclipse-plugin2/jasonide_site/site.xml Modified: trunk/applications/jason-eclipse-plugin2/jasonide/META-INF/MANIFEST.MF =================================================================== --- trunk/applications/jason-eclipse-plugin2/jasonide/META-INF/MANIFEST.MF 2013-03-14 14:51:08 UTC (rev 1722) +++ trunk/applications/jason-eclipse-plugin2/jasonide/META-INF/MANIFEST.MF 2013-03-14 16:40:44 UTC (rev 1723) @@ -2,7 +2,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Jasonide Bundle-SymbolicName: jasonide;singleton:=true -Bundle-Version: 1.0.9 +Bundle-Version: 1.0.10 Bundle-Activator: jasonide.Activator Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, Modified: trunk/applications/jason-eclipse-plugin2/jasonide/lib/jason.jar =================================================================== (Binary files differ) Modified: trunk/applications/jason-eclipse-plugin2/jasonide.xtext.asl/META-INF/MANIFEST.MF =================================================================== --- trunk/applications/jason-eclipse-plugin2/jasonide.xtext.asl/META-INF/MANIFEST.MF 2013-03-14 14:51:08 UTC (rev 1722) +++ trunk/applications/jason-eclipse-plugin2/jasonide.xtext.asl/META-INF/MANIFEST.MF 2013-03-14 16:40:44 UTC (rev 1723) @@ -2,7 +2,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: jasonide.xtext.asl Bundle-Vendor: Jason team -Bundle-Version: 1.0.9 +Bundle-Version: 1.0.10 Bundle-SymbolicName: jasonide.xtext.asl; singleton:=true Bundle-ActivationPolicy: lazy Require-Bundle: org.eclipse.xtext;bundle-version="2.0.0";visibility:=reexport, Modified: trunk/applications/jason-eclipse-plugin2/jasonide.xtext.asl.ui/META-INF/MANIFEST.MF =================================================================== --- trunk/applications/jason-eclipse-plugin2/jasonide.xtext.asl.ui/META-INF/MANIFEST.MF 2013-03-14 14:51:08 UTC (rev 1722) +++ trunk/applications/jason-eclipse-plugin2/jasonide.xtext.asl.ui/META-INF/MANIFEST.MF 2013-03-14 16:40:44 UTC (rev 1723) @@ -2,7 +2,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: jasonide.xtext.asl.ui Bundle-Vendor: Jason team -Bundle-Version: 1.0.9 +Bundle-Version: 1.0.10 Bundle-SymbolicName: jasonide.xtext.asl.ui; singleton:=true Bundle-ActivationPolicy: lazy Require-Bundle: jasonide.xtext.asl;visibility:=reexport, Modified: trunk/applications/jason-eclipse-plugin2/jasonide.xtext.mas2j/META-INF/MANIFEST.MF =================================================================== --- trunk/applications/jason-eclipse-plugin2/jasonide.xtext.mas2j/META-INF/MANIFEST.MF 2013-03-14 14:51:08 UTC (rev 1722) +++ trunk/applications/jason-eclipse-plugin2/jasonide.xtext.mas2j/META-INF/MANIFEST.MF 2013-03-14 16:40:44 UTC (rev 1723) @@ -2,7 +2,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: jasonide.xtext.mas2j Bundle-Vendor: Jason team -Bundle-Version: 1.0.9 +Bundle-Version: 1.0.10 Bundle-SymbolicName: jasonide.xtext.mas2j; singleton:=true Bundle-ActivationPolicy: lazy Require-Bundle: org.eclipse.xtext;bundle-version="2.0.0";visibility:=reexport, Modified: trunk/applications/jason-eclipse-plugin2/jasonide.xtext.mas2j.ui/META-INF/MANIFEST.MF =================================================================== --- trunk/applications/jason-eclipse-plugin2/jasonide.xtext.mas2j.ui/META-INF/MANIFEST.MF 2013-03-14 14:51:08 UTC (rev 1722) +++ trunk/applications/jason-eclipse-plugin2/jasonide.xtext.mas2j.ui/META-INF/MANIFEST.MF 2013-03-14 16:40:44 UTC (rev 1723) @@ -2,7 +2,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: jasonide.xtext.mas2j.ui Bundle-Vendor: Jason team -Bundle-Version: 1.0.9 +Bundle-Version: 1.0.10 Bundle-SymbolicName: jasonide.xtext.mas2j.ui; singleton:=true Bundle-ActivationPolicy: lazy Require-Bundle: jasonide.xtext.mas2j;visibility:=reexport, Modified: trunk/applications/jason-eclipse-plugin2/jasonide_feature/feature.xml =================================================================== --- trunk/applications/jason-eclipse-plugin2/jasonide_feature/feature.xml 2013-03-14 14:51:08 UTC (rev 1722) +++ trunk/applications/jason-eclipse-plugin2/jasonide_feature/feature.xml 2013-03-14 16:40:44 UTC (rev 1723) @@ -2,7 +2,7 @@ <feature id="jasonide_feature" label="Jasonide_feature" - version="1.0.9.qualifier"> + version="1.0.10.qualifier"> <description url="http://jason.sf.net"> Jason is an interpreter for an extended version of AgentSpeak Modified: trunk/applications/jason-eclipse-plugin2/jasonide_site/artifacts.jar =================================================================== (Binary files differ) Modified: trunk/applications/jason-eclipse-plugin2/jasonide_site/content.jar =================================================================== (Binary files differ) Modified: trunk/applications/jason-eclipse-plugin2/jasonide_site/logs.zip =================================================================== (Binary files differ) Modified: trunk/applications/jason-eclipse-plugin2/jasonide_site/site.xml =================================================================== --- trunk/applications/jason-eclipse-plugin2/jasonide_site/site.xml 2013-03-14 14:51:08 UTC (rev 1722) +++ trunk/applications/jason-eclipse-plugin2/jasonide_site/site.xml 2013-03-14 16:40:44 UTC (rev 1723) @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <site> - <feature url="features/jasonide_feature_1.0.9.201303131144.jar" id="jasonide_feature" version="1.0.9.201303131144"> + <feature url="features/jasonide_feature_1.0.10.201303132000.jar" id="jasonide_feature" version="1.0.10.201303132000"> <category name="jasonide"/> </feature> <category-def name="jasonide" label="jasonide"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jom...@us...> - 2013-03-14 14:51:16
|
Revision: 1722 http://jason.svn.sourceforge.net/jason/?rev=1722&view=rev Author: jomifred Date: 2013-03-14 14:51:08 +0000 (Thu, 14 Mar 2013) Log Message: ----------- version 1.3.9 Modified Paths: -------------- trunk/release-notes.txt trunk/src/jason/asSyntax/Structure.java Modified: trunk/release-notes.txt =================================================================== --- trunk/release-notes.txt 2013-03-14 14:03:03 UTC (rev 1721) +++ trunk/release-notes.txt 2013-03-14 14:51:08 UTC (rev 1722) @@ -1,7 +1,7 @@ --------------------------- version 1.3.9 -revision XXX on SVN +revision 1718 on SVN --------------------------- New features Modified: trunk/src/jason/asSyntax/Structure.java =================================================================== --- trunk/src/jason/asSyntax/Structure.java 2013-03-14 14:03:03 UTC (rev 1721) +++ trunk/src/jason/asSyntax/Structure.java 2013-03-14 14:51:08 UTC (rev 1722) @@ -306,7 +306,7 @@ return this; } - static boolean useShortUnnamedVars = Config.get().getBoolean(Config.SHORT_UNNAMED_VARS); + private final static boolean useShortUnnamedVars = Config.get().getBoolean(Config.SHORT_UNNAMED_VARS); protected VarTerm varToReplace(Term t, Unifier un) { VarTerm vt = (VarTerm)t; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jom...@us...> - 2013-03-14 14:03:15
|
Revision: 1721 http://jason.svn.sourceforge.net/jason/?rev=1721&view=rev Author: jomifred Date: 2013-03-14 14:03:03 +0000 (Thu, 14 Mar 2013) Log Message: ----------- add a new configuration parameter to enable short names for unnamed vars Modified Paths: -------------- trunk/build.xml trunk/release-notes.txt trunk/src/jason/asSemantics/TransitionSystem.java trunk/src/jason/asSyntax/Structure.java trunk/src/jason/jeditplugin/Config.java trunk/src/jason/util/ConfigGUI.java trunk/src/jeditPlugin/agentSpeak.xml Modified: trunk/build.xml =================================================================== --- trunk/build.xml 2013-03-13 15:12:02 UTC (rev 1720) +++ trunk/build.xml 2013-03-14 14:03:03 UTC (rev 1721) @@ -12,7 +12,7 @@ <property name="dist.properties" value="${basedir}/bin/dist.properties" /> <property name="version" value="1" /> - <property name="release" value="3.9-alpha" /> + <property name="release" value="3.9" /> <property name="distDir" value="${env.HOME}/tmp/x/Jason-${version}.${release}" /> <property name="distFile" value="${env.HOME}/Jason-${version}.${release}" /> Modified: trunk/release-notes.txt =================================================================== --- trunk/release-notes.txt 2013-03-13 15:12:02 UTC (rev 1720) +++ trunk/release-notes.txt 2013-03-14 14:03:03 UTC (rev 1721) @@ -5,6 +5,13 @@ --------------------------- New features +- new operators do add beliefs + "++" add a belief with new focus (a new intention is created for the + event produced by the addition) + "+<" add a belief in the begin of the belief base (it is the same as + the usual "+" operator) + '+>" add a belief in the end of the belief base + - new special achievement goal events +!jag_sleeping +!jag_awaking @@ -24,6 +31,21 @@ [qprofiling=yes]: it generates some statistical data related to queries and is used to measure the performance of the qcache option +- new general configuration parameter the define whether short names will be used + for unnamed variables (those starting with _). + Usually these vars may have quite long names. With this option enabled, the names + will be kept short. + + This parameter is stored in the ~/.jason/user.properties file and can be changed + either by editing the file or by running + + java -jar lib/jason.jar + + NB: If in the user.properties file doesn't exist the first time someone runs + Jason, the file + <jason install directory>/jason.properties + will be used for initial user's parameters. + - new internal action .shuffle to shuffle the elements of lists --------------------------- Modified: trunk/src/jason/asSemantics/TransitionSystem.java =================================================================== --- trunk/src/jason/asSemantics/TransitionSystem.java 2013-03-13 15:12:02 UTC (rev 1720) +++ trunk/src/jason/asSemantics/TransitionSystem.java 2013-03-14 14:03:03 UTC (rev 1721) @@ -761,7 +761,7 @@ if (h.getBodyType() == BodyType.addBelEnd) result = ag.brf(body,null,conf.C.SI, true); else - result = ag.brf(body,null,conf.C.SI); // use default (well documented and used) method in case someone has overriden it + result = ag.brf(body,null,conf.C.SI); // use default (well documented and used) method in case someone has overridden it if (result != null) { // really added something // generate events updateEvents(result,newfocus); Modified: trunk/src/jason/asSyntax/Structure.java =================================================================== --- trunk/src/jason/asSyntax/Structure.java 2013-03-13 15:12:02 UTC (rev 1720) +++ trunk/src/jason/asSyntax/Structure.java 2013-03-14 14:03:03 UTC (rev 1721) @@ -25,6 +25,7 @@ import jason.asSemantics.Unifier; import jason.asSyntax.parser.as2j; +import jason.jeditplugin.Config; import java.io.StringReader; import java.util.ArrayList; @@ -305,6 +306,8 @@ return this; } + static boolean useShortUnnamedVars = Config.get().getBoolean(Config.SHORT_UNNAMED_VARS); + protected VarTerm varToReplace(Term t, Unifier un) { VarTerm vt = (VarTerm)t; VarTerm deref = un.deref(vt); @@ -314,7 +317,7 @@ // if the variable hasn't been renamed given the input unifier, then rename it. if (deref.equals(vt)) { // forget the name - VarTerm var = new UnnamedVar("_" + UnnamedVar.getUniqueId() + t); + VarTerm var = useShortUnnamedVars ? new UnnamedVar() : new UnnamedVar("_" + UnnamedVar.getUniqueId() + t); // if deref has annotations then we need to replicate these in the new variable if (deref.hasAnnot()) { var.setAnnots(deref.getAnnots().cloneLT()); Modified: trunk/src/jason/jeditplugin/Config.java =================================================================== --- trunk/src/jason/jeditplugin/Config.java 2013-03-13 15:12:02 UTC (rev 1720) +++ trunk/src/jason/jeditplugin/Config.java 2013-03-14 14:03:03 UTC (rev 1721) @@ -78,6 +78,8 @@ public static final String jacamoHomeProp = "JaCaMoHome"; + public static final String SHORT_UNNAMED_VARS = "shortUnnamedVars"; + private static Config singleton = null; public static Config get() { Modified: trunk/src/jason/util/ConfigGUI.java =================================================================== --- trunk/src/jason/util/ConfigGUI.java 2013-03-13 15:12:02 UTC (rev 1720) +++ trunk/src/jason/util/ConfigGUI.java 2013-03-14 14:03:03 UTC (rev 1721) @@ -67,6 +67,8 @@ protected JCheckBox jadeSnifferCB; protected JCheckBox jadeRmaCB; + protected JCheckBox shortUnnamedVarCB; + protected static Config userProperties = Config.get(); static { @@ -162,6 +164,12 @@ wsvPanel.add(warnSingVarsCBox); jasonHomePanel.add(wsvPanel); + // unamed vars style + JPanel unvPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); + shortUnnamedVarCB = new JCheckBox("Use short names for unamed variables (those starting with _)", false); + unvPanel.add(shortUnnamedVarCB); + jasonHomePanel.add(unvPanel); + pop.add(jasonHomePanel); @@ -304,6 +312,7 @@ closeAllCBox.setSelected(userProperties.getBoolean(Config.CLOSEALL)); checkVersionCBox.setSelected(userProperties.getBoolean(Config.CHECK_VERSION)); warnSingVarsCBox.setSelected(userProperties.getBoolean(Config.WARN_SING_VAR)); + shortUnnamedVarCB.setSelected(userProperties.getBoolean(Config.SHORT_UNNAMED_VARS)); jadeSnifferCB.setSelected(userProperties.getBoolean(Config.JADE_SNIFFER)); jadeRmaCB.setSelected(userProperties.getBoolean(Config.JADE_RMA)); @@ -360,6 +369,7 @@ userProperties.put(Config.CLOSEALL, closeAllCBox.isSelected()+""); userProperties.put(Config.CHECK_VERSION, checkVersionCBox.isSelected()+""); userProperties.put(Config.WARN_SING_VAR, warnSingVarsCBox.isSelected()+""); + userProperties.put(Config.SHORT_UNNAMED_VARS, shortUnnamedVarCB.isSelected()+""); userProperties.put(Config.JADE_SNIFFER, jadeSnifferCB.isSelected()+""); userProperties.put(Config.JADE_RMA, jadeRmaCB.isSelected()+""); Modified: trunk/src/jeditPlugin/agentSpeak.xml =================================================================== --- trunk/src/jeditPlugin/agentSpeak.xml 2013-03-13 15:12:02 UTC (rev 1720) +++ trunk/src/jeditPlugin/agentSpeak.xml 2013-03-14 14:03:03 UTC (rev 1721) @@ -163,6 +163,9 @@ <SEQ TYPE="OPERATOR"><</SEQ> <SEQ TYPE="OPERATOR">+</SEQ> + <SEQ TYPE="OPERATOR">++</SEQ> + <SEQ TYPE="OPERATOR">+></SEQ> + <SEQ TYPE="OPERATOR">+<</SEQ> <SEQ TYPE="OPERATOR">-</SEQ> <SEQ TYPE="OPERATOR">/</SEQ> <SEQ TYPE="OPERATOR">*</SEQ> @@ -326,6 +329,9 @@ <SEQ TYPE="OPERATOR"><</SEQ> <SEQ TYPE="OPERATOR">+</SEQ> + <SEQ TYPE="OPERATOR">++</SEQ> + <SEQ TYPE="OPERATOR">+></SEQ> + <SEQ TYPE="OPERATOR">+<</SEQ> <SEQ TYPE="OPERATOR">-</SEQ> <SEQ TYPE="OPERATOR">/</SEQ> <SEQ TYPE="OPERATOR">*</SEQ> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <xsp...@us...> - 2013-03-13 15:12:15
|
Revision: 1720 http://jason.svn.sourceforge.net/jason/?rev=1720&view=rev Author: xsplyter Date: 2013-03-13 15:12:02 +0000 (Wed, 13 Mar 2013) Log Message: ----------- Update Jason plugin with the new operators ++ +< +> Modified Paths: -------------- trunk/applications/jason-eclipse-plugin2/jasonide/META-INF/MANIFEST.MF trunk/applications/jason-eclipse-plugin2/jasonide.xtext.asl/META-INF/MANIFEST.MF trunk/applications/jason-eclipse-plugin2/jasonide.xtext.asl/src/jasonide/xtext/asl/Asl.xtext trunk/applications/jason-eclipse-plugin2/jasonide.xtext.asl.ui/META-INF/MANIFEST.MF trunk/applications/jason-eclipse-plugin2/jasonide.xtext.asl.ui/src/jasonide/xtext/asl/ui/AslHighlightingCalculator.java trunk/applications/jason-eclipse-plugin2/jasonide.xtext.mas2j/META-INF/MANIFEST.MF trunk/applications/jason-eclipse-plugin2/jasonide.xtext.mas2j.ui/META-INF/MANIFEST.MF trunk/applications/jason-eclipse-plugin2/jasonide_feature/feature.xml trunk/applications/jason-eclipse-plugin2/jasonide_site/artifacts.jar trunk/applications/jason-eclipse-plugin2/jasonide_site/content.jar trunk/applications/jason-eclipse-plugin2/jasonide_site/logs.zip trunk/applications/jason-eclipse-plugin2/jasonide_site/site.xml Added Paths: ----------- trunk/applications/jason-eclipse-plugin2/jasonide_site/plugins/ trunk/applications/jason-eclipse-plugin2/jasonide_site/plugins/org.eclipse.xtext.logging_1.2.15.v201206120633.jar Modified: trunk/applications/jason-eclipse-plugin2/jasonide/META-INF/MANIFEST.MF =================================================================== --- trunk/applications/jason-eclipse-plugin2/jasonide/META-INF/MANIFEST.MF 2013-03-13 12:31:06 UTC (rev 1719) +++ trunk/applications/jason-eclipse-plugin2/jasonide/META-INF/MANIFEST.MF 2013-03-13 15:12:02 UTC (rev 1720) @@ -2,7 +2,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: Jasonide Bundle-SymbolicName: jasonide;singleton:=true -Bundle-Version: 1.0.8 +Bundle-Version: 1.0.9 Bundle-Activator: jasonide.Activator Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, Modified: trunk/applications/jason-eclipse-plugin2/jasonide.xtext.asl/META-INF/MANIFEST.MF =================================================================== --- trunk/applications/jason-eclipse-plugin2/jasonide.xtext.asl/META-INF/MANIFEST.MF 2013-03-13 12:31:06 UTC (rev 1719) +++ trunk/applications/jason-eclipse-plugin2/jasonide.xtext.asl/META-INF/MANIFEST.MF 2013-03-13 15:12:02 UTC (rev 1720) @@ -2,7 +2,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: jasonide.xtext.asl Bundle-Vendor: Jason team -Bundle-Version: 1.0.8 +Bundle-Version: 1.0.9 Bundle-SymbolicName: jasonide.xtext.asl; singleton:=true Bundle-ActivationPolicy: lazy Require-Bundle: org.eclipse.xtext;bundle-version="2.0.0";visibility:=reexport, Modified: trunk/applications/jason-eclipse-plugin2/jasonide.xtext.asl/src/jasonide/xtext/asl/Asl.xtext =================================================================== --- trunk/applications/jason-eclipse-plugin2/jasonide.xtext.asl/src/jasonide/xtext/asl/Asl.xtext 2013-03-13 12:31:06 UTC (rev 1719) +++ trunk/applications/jason-eclipse-plugin2/jasonide.xtext.asl/src/jasonide/xtext/asl/Asl.xtext 2013-03-13 15:12:02 UTC (rev 1720) @@ -53,7 +53,7 @@ ; Body_formula: - ( '!' | '!!' | '?' | '+' | ( '-' ( '+' )? ) )? log_expr=Log_expr + ( '!' | '!!' | '?' | '+' ('+' | '>' | '<')? | ( '-' ( '+' )? ) )? log_expr=Log_expr ; Plan_term:{Plan_term} Modified: trunk/applications/jason-eclipse-plugin2/jasonide.xtext.asl.ui/META-INF/MANIFEST.MF =================================================================== --- trunk/applications/jason-eclipse-plugin2/jasonide.xtext.asl.ui/META-INF/MANIFEST.MF 2013-03-13 12:31:06 UTC (rev 1719) +++ trunk/applications/jason-eclipse-plugin2/jasonide.xtext.asl.ui/META-INF/MANIFEST.MF 2013-03-13 15:12:02 UTC (rev 1720) @@ -2,7 +2,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: jasonide.xtext.asl.ui Bundle-Vendor: Jason team -Bundle-Version: 1.0.8 +Bundle-Version: 1.0.9 Bundle-SymbolicName: jasonide.xtext.asl.ui; singleton:=true Bundle-ActivationPolicy: lazy Require-Bundle: jasonide.xtext.asl;visibility:=reexport, Modified: trunk/applications/jason-eclipse-plugin2/jasonide.xtext.asl.ui/src/jasonide/xtext/asl/ui/AslHighlightingCalculator.java =================================================================== --- trunk/applications/jason-eclipse-plugin2/jasonide.xtext.asl.ui/src/jasonide/xtext/asl/ui/AslHighlightingCalculator.java 2013-03-13 12:31:06 UTC (rev 1719) +++ trunk/applications/jason-eclipse-plugin2/jasonide.xtext.asl.ui/src/jasonide/xtext/asl/ui/AslHighlightingCalculator.java 2013-03-13 15:12:02 UTC (rev 1720) @@ -99,7 +99,7 @@ } else if (ALL_RESERVED_WORDS.contains(k.getValue())) { setStyle( acceptor, node, RESERVED_WORD); - } else if (k.getValue().equals("+") && status == STATUS_BEGIN_BELIEF) { + } else if ((k.getValue().equals("+") || k.getValue().equals("-") || k.getValue().equals("<") || k.getValue().equals(">")) && status == STATUS_BEGIN_BELIEF) { setStyle( acceptor, node, BELIEF); } else if (k.getValue().equals("(")) { openedParentheses++; Modified: trunk/applications/jason-eclipse-plugin2/jasonide.xtext.mas2j/META-INF/MANIFEST.MF =================================================================== --- trunk/applications/jason-eclipse-plugin2/jasonide.xtext.mas2j/META-INF/MANIFEST.MF 2013-03-13 12:31:06 UTC (rev 1719) +++ trunk/applications/jason-eclipse-plugin2/jasonide.xtext.mas2j/META-INF/MANIFEST.MF 2013-03-13 15:12:02 UTC (rev 1720) @@ -2,7 +2,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: jasonide.xtext.mas2j Bundle-Vendor: Jason team -Bundle-Version: 1.0.8 +Bundle-Version: 1.0.9 Bundle-SymbolicName: jasonide.xtext.mas2j; singleton:=true Bundle-ActivationPolicy: lazy Require-Bundle: org.eclipse.xtext;bundle-version="2.0.0";visibility:=reexport, Modified: trunk/applications/jason-eclipse-plugin2/jasonide.xtext.mas2j.ui/META-INF/MANIFEST.MF =================================================================== --- trunk/applications/jason-eclipse-plugin2/jasonide.xtext.mas2j.ui/META-INF/MANIFEST.MF 2013-03-13 12:31:06 UTC (rev 1719) +++ trunk/applications/jason-eclipse-plugin2/jasonide.xtext.mas2j.ui/META-INF/MANIFEST.MF 2013-03-13 15:12:02 UTC (rev 1720) @@ -2,7 +2,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: jasonide.xtext.mas2j.ui Bundle-Vendor: Jason team -Bundle-Version: 1.0.8 +Bundle-Version: 1.0.9 Bundle-SymbolicName: jasonide.xtext.mas2j.ui; singleton:=true Bundle-ActivationPolicy: lazy Require-Bundle: jasonide.xtext.mas2j;visibility:=reexport, Modified: trunk/applications/jason-eclipse-plugin2/jasonide_feature/feature.xml =================================================================== --- trunk/applications/jason-eclipse-plugin2/jasonide_feature/feature.xml 2013-03-13 12:31:06 UTC (rev 1719) +++ trunk/applications/jason-eclipse-plugin2/jasonide_feature/feature.xml 2013-03-13 15:12:02 UTC (rev 1720) @@ -2,7 +2,7 @@ <feature id="jasonide_feature" label="Jasonide_feature" - version="1.0.8.qualifier"> + version="1.0.9.qualifier"> <description url="http://jason.sf.net"> Jason is an interpreter for an extended version of AgentSpeak Modified: trunk/applications/jason-eclipse-plugin2/jasonide_site/artifacts.jar =================================================================== (Binary files differ) Modified: trunk/applications/jason-eclipse-plugin2/jasonide_site/content.jar =================================================================== (Binary files differ) Modified: trunk/applications/jason-eclipse-plugin2/jasonide_site/logs.zip =================================================================== (Binary files differ) Added: trunk/applications/jason-eclipse-plugin2/jasonide_site/plugins/org.eclipse.xtext.logging_1.2.15.v201206120633.jar =================================================================== (Binary files differ) Property changes on: trunk/applications/jason-eclipse-plugin2/jasonide_site/plugins/org.eclipse.xtext.logging_1.2.15.v201206120633.jar ___________________________________________________________________ Added: svn:mime-type + application/zip Modified: trunk/applications/jason-eclipse-plugin2/jasonide_site/site.xml =================================================================== --- trunk/applications/jason-eclipse-plugin2/jasonide_site/site.xml 2013-03-13 12:31:06 UTC (rev 1719) +++ trunk/applications/jason-eclipse-plugin2/jasonide_site/site.xml 2013-03-13 15:12:02 UTC (rev 1720) @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <site> - <feature url="features/jasonide_feature_1.0.8.201209212003.jar" id="jasonide_feature" version="1.0.8.201209212003"> + <feature url="features/jasonide_feature_1.0.9.201303131144.jar" id="jasonide_feature" version="1.0.9.201303131144"> <category name="jasonide"/> </feature> <category-def name="jasonide" label="jasonide"/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jom...@us...> - 2013-03-13 12:31:18
|
Revision: 1719 http://jason.svn.sourceforge.net/jason/?rev=1719&view=rev Author: jomifred Date: 2013-03-13 12:31:06 +0000 (Wed, 13 Mar 2013) Log Message: ----------- initial implementation of new operators ++, +<, and +> Modified Paths: -------------- trunk/src/jason/asSemantics/Agent.java trunk/src/jason/asSemantics/Circumstance.java trunk/src/jason/asSemantics/TransitionSystem.java trunk/src/jason/asSyntax/Literal.java trunk/src/jason/asSyntax/PlanBody.java trunk/src/jason/asSyntax/parser/AS2JavaParser.jcc trunk/src/jason/asSyntax/parser/as2j.java trunk/src/jason/asSyntax/parser/as2jConstants.java trunk/src/jason/asSyntax/parser/as2jTokenManager.java trunk/src/jason/mas2j/parser/mas2jTokenManager.java Modified: trunk/src/jason/asSemantics/Agent.java =================================================================== --- trunk/src/jason/asSemantics/Agent.java 2013-02-17 14:05:54 UTC (rev 1718) +++ trunk/src/jason/asSemantics/Agent.java 2013-03-13 12:31:06 UTC (rev 1719) @@ -788,18 +788,35 @@ * this is used to generate the appropriate internal events. If * nothing change, returns null. */ + public List<Literal>[] brf(Literal beliefToAdd, Literal beliefToDel, Intention i) throws RevisionFailedException { + return brf(beliefToAdd, beliefToDel, i, false); + } + + /** + * This function should revise the belief base with the given literal to + * add, to remove, and the current intention that triggered the operation. + * + * <p>In its return, List[0] has the list of actual additions to + * the belief base, and List[1] has the list of actual deletions; + * this is used to generate the appropriate internal events. If + * nothing change, returns null. + */ @SuppressWarnings("unchecked") - public List<Literal>[] brf(Literal beliefToAdd, Literal beliefToDel, Intention i) throws RevisionFailedException { + public List<Literal>[] brf(Literal beliefToAdd, Literal beliefToDel, Intention i, boolean addEnd) throws RevisionFailedException { // This class does not implement belief revision! It // is supposed that a subclass will do it. // It simply add/del the belief. + int position = 0; // add in the begin + if (addEnd) + position = 1; + List<Literal>[] result = null; try { if (beliefToAdd != null) { if (logger.isLoggable(Level.FINE)) logger.fine("Adding belief " + beliefToAdd); - if (getBB().add(beliefToAdd)) { + if (getBB().add(position, beliefToAdd)) { result = new List[2]; result[0] = Collections.singletonList(beliefToAdd); result[1] = Collections.emptyList(); Modified: trunk/src/jason/asSemantics/Circumstance.java =================================================================== --- trunk/src/jason/asSemantics/Circumstance.java 2013-02-17 14:05:54 UTC (rev 1718) +++ trunk/src/jason/asSemantics/Circumstance.java 2013-03-13 12:31:06 UTC (rev 1719) @@ -115,8 +115,8 @@ /** Events */ public void addEvent(Event ev) { - E.add(ev); - + E.add(ev); + if (ev.isAtomic()) hasAtomicEvent = true; @@ -180,15 +180,18 @@ public Event removeAtomicEvent() { if (!hasAtomicEvent) return null; - + Iterator<Event> i = E.iterator(); while (i.hasNext()) { Event e = i.next(); if (e.isAtomic()) { i.remove(); + hasAtomicEvent = false; return e; } } + // there is no AtomicEvent! + hasAtomicEvent = false; return null; } Modified: trunk/src/jason/asSemantics/TransitionSystem.java =================================================================== --- trunk/src/jason/asSemantics/TransitionSystem.java 2013-02-17 14:05:54 UTC (rev 1718) +++ trunk/src/jason/asSemantics/TransitionSystem.java 2013-03-13 12:31:06 UTC (rev 1719) @@ -744,20 +744,28 @@ // Rule AddBel case addBel: + case addBelBegin: + case addBelEnd: + case addBelNewFocus: body = prepareBodyForEvent(body, u); // calculate focus Intention newfocus = Intention.EmptyInt; - if (setts.sameFocus()) + boolean isSameFocus = setts.sameFocus() && h.getBodyType() != BodyType.addBelNewFocus; + if (isSameFocus) newfocus = conf.C.SI; // call BRF try { - List<Literal>[] result = ag.brf(body,null,conf.C.SI); // the intention is not the new focus - if (result != null) { // really add something + List<Literal>[] result; + if (h.getBodyType() == BodyType.addBelEnd) + result = ag.brf(body,null,conf.C.SI, true); + else + result = ag.brf(body,null,conf.C.SI); // use default (well documented and used) method in case someone has overriden it + if (result != null) { // really added something // generate events updateEvents(result,newfocus); - if (!setts.sameFocus()) { + if (!isSameFocus) { updateIntention(); } } else { @@ -952,7 +960,7 @@ if (logger.isLoggable(Level.FINE)) logger.fine("Added event " + e); } } - + /** remove the top action and requeue the current intention */ private void updateIntention() { if (!conf.C.SI.isFinished()) { Modified: trunk/src/jason/asSyntax/Literal.java =================================================================== --- trunk/src/jason/asSyntax/Literal.java 2013-02-17 14:05:54 UTC (rev 1718) +++ trunk/src/jason/asSyntax/Literal.java 2013-03-13 12:31:06 UTC (rev 1719) @@ -504,7 +504,10 @@ if (tfunctor.isLiteral() && ((Literal)tfunctor).negated()) { pos = Literal.LNeg; } - + if (tfunctor.isString()) { + tfunctor = ASSyntax.parseTerm( ((StringTerm)tfunctor).getString() ); + } + Literal l = new LiteralImpl(pos,((Atom)tfunctor).getFunctor()); if (i.hasNext()) { Modified: trunk/src/jason/asSyntax/PlanBody.java =================================================================== --- trunk/src/jason/asSyntax/PlanBody.java 2013-02-17 14:05:54 UTC (rev 1718) +++ trunk/src/jason/asSyntax/PlanBody.java 2013-03-13 12:31:06 UTC (rev 1719) @@ -15,6 +15,9 @@ achieve { public String toString() { return "!"; }}, test { public String toString() { return "?"; }}, addBel { public String toString() { return "+"; }}, + addBelNewFocus { public String toString() { return "++"; }}, + addBelBegin { public String toString() { return "+<"; }}, // equivalent to simple + + addBelEnd { public String toString() { return "+>"; }}, delBel { public String toString() { return "-"; }}, delAddBel { public String toString() { return "-+"; }}, achieveNF { public String toString() { return "!!"; }}, Modified: trunk/src/jason/asSyntax/parser/AS2JavaParser.jcc =================================================================== --- trunk/src/jason/asSyntax/parser/AS2JavaParser.jcc 2013-02-17 14:05:54 UTC (rev 1718) +++ trunk/src/jason/asSyntax/parser/AS2JavaParser.jcc 2013-03-13 12:31:06 UTC (rev 1719) @@ -448,7 +448,13 @@ [ "!" { formType = BodyType.achieve; } | "!!" { formType = BodyType.achieveNF; } | "?" { formType = BodyType.test; } - | "+" { formType = BodyType.addBel; } + | ( "+" { formType = BodyType.addBel; } + [ ( "+" { formType = BodyType.addBelNewFocus; } + | "<" { formType = BodyType.addBel; } + | ">" { formType = BodyType.addBelEnd; } + ) + ] + ) | ( "-" { formType = BodyType.delBel; } ["+" { formType = BodyType.delAddBel; } ] Modified: trunk/src/jason/asSyntax/parser/as2j.java =================================================================== --- trunk/src/jason/asSyntax/parser/as2j.java 2013-02-17 14:05:54 UTC (rev 1718) +++ trunk/src/jason/asSyntax/parser/as2j.java 2013-03-13 12:31:06 UTC (rev 1719) @@ -628,6 +628,33 @@ case 37: jj_consume_token(37); formType = BodyType.addBel; + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 37: + case 45: + case 46: + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 37: + jj_consume_token(37); + formType = BodyType.addBelNewFocus; + break; + case 45: + jj_consume_token(45); + formType = BodyType.addBel; + break; + case 46: + jj_consume_token(46); + formType = BodyType.addBelEnd; + break; + default: + jj_la1[22] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + break; + default: + jj_la1[23] = jj_gen; + ; + } break; case 38: jj_consume_token(38); @@ -638,18 +665,18 @@ formType = BodyType.delAddBel; break; default: - jj_la1[22] = jj_gen; + jj_la1[24] = jj_gen; ; } break; default: - jj_la1[23] = jj_gen; + jj_la1[25] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; default: - jj_la1[24] = jj_gen; + jj_la1[26] = jj_gen; ; } B = log_expr(); @@ -683,7 +710,7 @@ pb = false; break; default: - jj_la1[25] = jj_gen; + jj_la1[27] = jj_gen; ; } T = trigger(); @@ -695,7 +722,7 @@ pb = false; break; default: - jj_la1[26] = jj_gen; + jj_la1[28] = jj_gen; ; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -711,13 +738,13 @@ if (!pb) {if (true) throw new ParseException(getSourceRef(T)+" Wrong place for ';'");} break; default: - jj_la1[27] = jj_gen; + jj_la1[29] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; default: - jj_la1[28] = jj_gen; + jj_la1[30] = jj_gen; ; } } else { @@ -747,7 +774,7 @@ B = plan_body(); break; default: - jj_la1[29] = jj_gen; + jj_la1[31] = jj_gen; ; } jj_consume_token(31); @@ -800,7 +827,7 @@ type = Literal.LNeg; break; default: - jj_la1[30] = jj_gen; + jj_la1[32] = jj_gen; ; } F = pred(); @@ -827,7 +854,7 @@ {if (true) return Literal.LFalse;} break; default: - jj_la1[31] = jj_gen; + jj_la1[33] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -848,7 +875,7 @@ K = jj_consume_token(TK_END); break; default: - jj_la1[32] = jj_gen; + jj_la1[34] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -862,7 +889,7 @@ p.setTerms(l); break; default: - jj_la1[33] = jj_gen; + jj_la1[35] = jj_gen; ; } label_9: @@ -872,19 +899,19 @@ ; break; default: - jj_la1[34] = jj_gen; + jj_la1[36] = jj_gen; break label_9; } b = plan_term(); p.addTerm(b); } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case 46: + case 48: lt = list(); p.setAnnots(lt); break; default: - jj_la1[35] = jj_gen; + jj_la1[37] = jj_gen; ; } {if (true) return p;} @@ -899,14 +926,14 @@ label_10: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case 45: + case 47: ; break; default: - jj_la1[36] = jj_gen; + jj_la1[38] = jj_gen; break label_10; } - jj_consume_token(45); + jj_consume_token(47); v = term(); listTerms.add(v); } @@ -918,7 +945,7 @@ final public Term term() throws ParseException { Object o; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case 46: + case 48: o = list(); break; case 30: @@ -941,7 +968,7 @@ o = log_expr(); break; default: - jj_la1[37] = jj_gen; + jj_la1[39] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -951,7 +978,7 @@ final public ListTermImpl list() throws ParseException { ListTermImpl lt = new ListTermImpl(); ListTerm last; Token K; Term f; - jj_consume_token(46); + jj_consume_token(48); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VAR: case TK_TRUE: @@ -967,26 +994,26 @@ case 37: case 38: case 42: - case 46: + case 48: f = term_in_list(); last = lt.append(f); lt.setSrcInfo(f.getSrcInfo()); label_11: while (true) { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case 45: + case 47: ; break; default: - jj_la1[38] = jj_gen; + jj_la1[40] = jj_gen; break label_11; } - jj_consume_token(45); + jj_consume_token(47); f = term_in_list(); last = last.append(f); } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case 47: - jj_consume_token(47); + case 49: + jj_consume_token(49); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case VAR: K = jj_consume_token(VAR); @@ -996,26 +1023,26 @@ K = jj_consume_token(UNNAMEDVAR); last.setNext(new UnnamedVar(K.image)); break; - case 46: + case 48: f = list(); last = last.concat((ListTerm)f); break; default: - jj_la1[39] = jj_gen; + jj_la1[41] = jj_gen; jj_consume_token(-1); throw new ParseException(); } break; default: - jj_la1[40] = jj_gen; + jj_la1[42] = jj_gen; ; } break; default: - jj_la1[41] = jj_gen; + jj_la1[43] = jj_gen; ; } - jj_consume_token(48); + jj_consume_token(50); {if (true) return lt;} throw new Error("Missing return statement in function"); } @@ -1024,7 +1051,7 @@ final public Term term_in_list() throws ParseException { Object o; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case 46: + case 48: o = list(); break; case VAR: @@ -1048,7 +1075,7 @@ o = plan_term(); break; default: - jj_la1[42] = jj_gen; + jj_la1[44] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -1061,13 +1088,13 @@ Object t1, t2; t1 = log_expr_trm(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case 47: - jj_consume_token(47); + case 49: + jj_consume_token(49); t2 = log_expr(); {if (true) return new LogExpr((LogicalFormula)t1,LogicalOp.or,(LogicalFormula)t2);} break; default: - jj_la1[43] = jj_gen; + jj_la1[45] = jj_gen; ; } {if (true) return t1;} @@ -1078,13 +1105,13 @@ Object t1, t2; t1 = log_expr_factor(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case 49: - jj_consume_token(49); + case 51: + jj_consume_token(51); t2 = log_expr_trm(); {if (true) return new LogExpr((LogicalFormula)t1,LogicalOp.and,(LogicalFormula)t2);} break; default: - jj_la1[44] = jj_gen; + jj_la1[46] = jj_gen; ; } {if (true) return t1;} @@ -1116,7 +1143,7 @@ {if (true) return t;} break; default: - jj_la1[45] = jj_gen; + jj_la1[47] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -1153,13 +1180,13 @@ op1 = string(); break; default: - jj_la1[46] = jj_gen; + jj_la1[48] = jj_gen; jj_consume_token(-1); throw new ParseException(); } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case 50: - case 51: + case 45: + case 46: case 52: case 53: case 54: @@ -1167,16 +1194,16 @@ case 56: case 57: switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case 50: - jj_consume_token(50); + case 45: + jj_consume_token(45); operator = RelationalOp.lt; break; - case 51: - jj_consume_token(51); + case 52: + jj_consume_token(52); operator = RelationalOp.lte; break; - case 52: - jj_consume_token(52); + case 46: + jj_consume_token(46); operator = RelationalOp.gt; break; case 53: @@ -1200,7 +1227,7 @@ operator = RelationalOp.literalBuilder; break; default: - jj_la1[47] = jj_gen; + jj_la1[49] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -1222,14 +1249,14 @@ case STRING: op2 = string(); break; - case 46: + case 48: op2 = list(); break; case 30: op2 = plan_term(); break; default: - jj_la1[48] = jj_gen; + jj_la1[50] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -1240,7 +1267,7 @@ {if (true) return new RelExpr((Term)op1, operator, (Term)op2);} break; default: - jj_la1[49] = jj_gen; + jj_la1[51] = jj_gen; ; } {if (true) return op1;} @@ -1260,7 +1287,7 @@ ; break; default: - jj_la1[50] = jj_gen; + jj_la1[52] = jj_gen; break label_12; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -1273,7 +1300,7 @@ op = ArithmeticOp.minus; break; default: - jj_la1[51] = jj_gen; + jj_la1[53] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -1304,7 +1331,7 @@ ; break; default: - jj_la1[52] = jj_gen; + jj_la1[54] = jj_gen; break label_13; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { @@ -1325,7 +1352,7 @@ op = ArithmeticOp.mod; break; default: - jj_la1[53] = jj_gen; + jj_la1[55] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -1360,7 +1387,7 @@ {if (true) return new ArithExpr((NumberTerm)t1, op, (NumberTerm)t2);} break; default: - jj_la1[54] = jj_gen; + jj_la1[56] = jj_gen; ; } {if (true) return t1;} @@ -1413,7 +1440,7 @@ {if (true) return t;} break; default: - jj_la1[55] = jj_gen; + jj_la1[57] = jj_gen; jj_consume_token(-1); throw new ParseException(); } @@ -1448,17 +1475,17 @@ v = new UnnamedVar(K.image); break; default: - jj_la1[56] = jj_gen; + jj_la1[58] = jj_gen; jj_consume_token(-1); throw new ParseException(); } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case 46: + case 48: lt = list(); v.setAnnots(lt); break; default: - jj_la1[57] = jj_gen; + jj_la1[59] = jj_gen; ; } {if (true) return v;} @@ -1539,6 +1566,11 @@ return false; } + final private boolean jj_3R_64() { + if (jj_scan_token(TK_NEG)) return true; + return false; + } + final private boolean jj_3R_67() { if (jj_3R_76()) return true; return false; @@ -1560,21 +1592,6 @@ return false; } - final private boolean jj_3R_64() { - if (jj_scan_token(TK_NEG)) return true; - return false; - } - - final private boolean jj_3R_32() { - if (jj_3R_46()) return true; - return false; - } - - final private boolean jj_3R_31() { - if (jj_3R_45()) return true; - return false; - } - final private boolean jj_3R_52() { Token xsp; xsp = jj_scanpos; @@ -1583,21 +1600,11 @@ return false; } - final private boolean jj_3R_44() { - if (jj_scan_token(40)) return true; - return false; - } - final private boolean jj_3R_85() { if (jj_3R_91()) return true; return false; } - final private boolean jj_3R_43() { - if (jj_scan_token(34)) return true; - return false; - } - final private boolean jj_3R_45() { Token xsp; xsp = jj_scanpos; @@ -1611,6 +1618,26 @@ return false; } + final private boolean jj_3R_32() { + if (jj_3R_46()) return true; + return false; + } + + final private boolean jj_3R_31() { + if (jj_3R_45()) return true; + return false; + } + + final private boolean jj_3R_44() { + if (jj_scan_token(40)) return true; + return false; + } + + final private boolean jj_3R_43() { + if (jj_scan_token(34)) return true; + return false; + } + final private boolean jj_3R_30() { Token xsp; xsp = jj_scanpos; @@ -1715,17 +1742,24 @@ return false; } - final private boolean jj_3R_41() { - if (jj_scan_token(34)) return true; - return false; - } - final private boolean jj_3R_16() { if (jj_scan_token(TK_LABEL_AT)) return true; if (jj_3R_14()) return true; return false; } + final private boolean jj_3_2() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_16()) jj_scanpos = xsp; + if (jj_3R_17()) return true; + xsp = jj_scanpos; + if (jj_3R_18()) jj_scanpos = xsp; + xsp = jj_scanpos; + if (jj_3R_19()) jj_scanpos = xsp; + return false; + } + final private boolean jj_3R_75() { Token xsp; xsp = jj_scanpos; @@ -1736,15 +1770,8 @@ return false; } - final private boolean jj_3_2() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_16()) jj_scanpos = xsp; - if (jj_3R_17()) return true; - xsp = jj_scanpos; - if (jj_3R_18()) jj_scanpos = xsp; - xsp = jj_scanpos; - if (jj_3R_19()) jj_scanpos = xsp; + final private boolean jj_3R_41() { + if (jj_scan_token(34)) return true; return false; } @@ -1789,6 +1816,11 @@ return false; } + final private boolean jj_3R_47() { + if (jj_3R_58()) return true; + return false; + } + final private boolean jj_3R_89() { if (jj_scan_token(37)) return true; return false; @@ -1799,13 +1831,13 @@ return false; } - final private boolean jj_3R_47() { - if (jj_3R_58()) return true; + final private boolean jj_3R_87() { + if (jj_scan_token(44)) return true; return false; } - final private boolean jj_3R_87() { - if (jj_scan_token(44)) return true; + final private boolean jj_3R_33() { + if (jj_3R_47()) return true; return false; } @@ -1841,29 +1873,11 @@ return false; } - final private boolean jj_3R_33() { - if (jj_3R_47()) return true; - return false; - } - - final private boolean jj_3_1() { - if (jj_scan_token(TK_BEGIN)) return true; - if (jj_3R_14()) return true; - if (jj_scan_token(31)) return true; - if (jj_3R_15()) return true; - return false; - } - final private boolean jj_3R_74() { if (jj_3R_37()) return true; return false; } - final private boolean jj_3R_39() { - if (jj_scan_token(30)) return true; - return false; - } - final private boolean jj_3R_73() { if (jj_3R_81()) return true; return false; @@ -1874,6 +1888,14 @@ return false; } + final private boolean jj_3_1() { + if (jj_scan_token(TK_BEGIN)) return true; + if (jj_3R_14()) return true; + if (jj_scan_token(31)) return true; + if (jj_3R_15()) return true; + return false; + } + final private boolean jj_3R_71() { if (jj_3R_38()) return true; return false; @@ -1895,13 +1917,13 @@ return false; } - final private boolean jj_3R_81() { - if (jj_scan_token(STRING)) return true; + final private boolean jj_3R_39() { + if (jj_scan_token(30)) return true; return false; } - final private boolean jj_3R_78() { - if (jj_scan_token(TK_WHILE)) return true; + final private boolean jj_3R_81() { + if (jj_scan_token(STRING)) return true; return false; } @@ -1910,6 +1932,11 @@ return false; } + final private boolean jj_3R_78() { + if (jj_scan_token(TK_WHILE)) return true; + return false; + } + final private boolean jj_3R_56() { if (jj_scan_token(UNNAMEDVAR)) return true; return false; @@ -1938,19 +1965,14 @@ } final private boolean jj_3R_38() { - if (jj_scan_token(46)) return true; + if (jj_scan_token(48)) return true; Token xsp; xsp = jj_scanpos; if (jj_3R_50()) jj_scanpos = xsp; - if (jj_scan_token(48)) return true; + if (jj_scan_token(50)) return true; return false; } - final private boolean jj_3R_77() { - if (jj_scan_token(TK_FOR)) return true; - return false; - } - final private boolean jj_3R_61() { if (jj_3R_33()) return true; return false; @@ -1966,6 +1988,11 @@ return false; } + final private boolean jj_3R_77() { + if (jj_scan_token(TK_FOR)) return true; + return false; + } + final private boolean jj_3R_48() { Token xsp; xsp = jj_scanpos; @@ -2004,18 +2031,13 @@ return false; } - final private boolean jj_3R_26() { - if (jj_3R_42()) return true; - return false; - } - final private boolean jj_3R_95() { if (jj_scan_token(37)) return true; return false; } - final private boolean jj_3R_25() { - if (jj_3R_41()) return true; + final private boolean jj_3R_26() { + if (jj_3R_42()) return true; return false; } @@ -2034,16 +2056,11 @@ return false; } - final private boolean jj_3R_24() { - if (jj_3R_40()) return true; + final private boolean jj_3R_25() { + if (jj_3R_41()) return true; return false; } - final private boolean jj_3R_76() { - if (jj_scan_token(TK_IF)) return true; - return false; - } - final private boolean jj_3R_93() { if (jj_scan_token(NUMBER)) return true; return false; @@ -2055,11 +2072,6 @@ return false; } - final private boolean jj_3R_23() { - if (jj_3R_39()) return true; - return false; - } - final private boolean jj_3R_92() { Token xsp; xsp = jj_scanpos; @@ -2082,6 +2094,21 @@ return false; } + final private boolean jj_3R_24() { + if (jj_3R_40()) return true; + return false; + } + + final private boolean jj_3R_76() { + if (jj_scan_token(TK_IF)) return true; + return false; + } + + final private boolean jj_3R_23() { + if (jj_3R_39()) return true; + return false; + } + final private boolean jj_3R_15() { Token xsp; while (true) { @@ -2113,7 +2140,7 @@ public boolean lookingAhead = false; private boolean jj_semLA; private int jj_gen; - final private int[] jj_la1 = new int[58]; + final private int[] jj_la1 = new int[60]; static private int[] jj_la1_0; static private int[] jj_la1_1; static { @@ -2121,10 +2148,10 @@ jj_la1_1(); } private static void jj_la1_0() { - jj_la1_0 = new int[] {0x40000000,0x80cb00,0x40000000,0x0,0x40000000,0x10000,0x80cb00,0x40000000,0x80c000,0x0,0x10000,0x0,0x0,0x0,0x0,0x0,0x180cb80,0x1facf80,0x0,0x1facf80,0x40000,0x40040000,0x0,0x0,0x0,0x10000,0x0,0x0,0x0,0x1facf80,0x800,0x80cb00,0x80c000,0x0,0x40000000,0x0,0x0,0x41e0cf80,0x0,0x1000080,0x0,0x41e0cb80,0x41e0cb80,0x0,0x0,0x1e0cf80,0x1e0cb80,0x0,0x41e0cb80,0x0,0x0,0x0,0x3000,0x3000,0x0,0x1a0cb80,0x1000080,0x0,}; + jj_la1_0 = new int[] {0x40000000,0x80cb00,0x40000000,0x0,0x40000000,0x10000,0x80cb00,0x40000000,0x80c000,0x0,0x10000,0x0,0x0,0x0,0x0,0x0,0x180cb80,0x1facf80,0x0,0x1facf80,0x40000,0x40040000,0x0,0x0,0x0,0x0,0x0,0x10000,0x0,0x0,0x0,0x1facf80,0x800,0x80cb00,0x80c000,0x0,0x40000000,0x0,0x0,0x41e0cf80,0x0,0x1000080,0x0,0x41e0cb80,0x41e0cb80,0x0,0x0,0x1e0cf80,0x1e0cb80,0x0,0x41e0cb80,0x0,0x0,0x0,0x3000,0x3000,0x0,0x1a0cb80,0x1000080,0x0,}; } private static void jj_la1_1() { - jj_la1_1 = new int[] {0x0,0x0,0x0,0x4,0x0,0xe0,0x0,0x0,0x0,0x1,0x0,0x8,0x10,0xe0,0x104,0x104,0x0,0x1564,0x200,0x1564,0x0,0x0,0x20,0x1164,0x1164,0x0,0x8,0x210,0x210,0x1564,0x0,0x0,0x0,0x400,0x0,0x4000,0x2000,0x4460,0x2000,0x4000,0x8000,0x4460,0x4460,0x8000,0x20000,0x460,0x460,0x3fc0000,0x4460,0x3fc0000,0x60,0x60,0xc000000,0xc000000,0x10000000,0x460,0x0,0x4000,}; + jj_la1_1 = new int[] {0x0,0x0,0x0,0x4,0x0,0xe0,0x0,0x0,0x0,0x1,0x0,0x8,0x10,0xe0,0x104,0x104,0x0,0x1564,0x200,0x1564,0x0,0x0,0x6020,0x6020,0x20,0x1164,0x1164,0x0,0x8,0x210,0x210,0x1564,0x0,0x0,0x0,0x400,0x0,0x10000,0x8000,0x10460,0x8000,0x10000,0x20000,0x10460,0x10460,0x20000,0x80000,0x460,0x460,0x3f06000,0x10460,0x3f06000,0x60,0x60,0xc000000,0xc000000,0x10000000,0x460,0x0,0x10000,}; } final private JJCalls[] jj_2_rtns = new JJCalls[2]; private boolean jj_rescan = false; @@ -2139,7 +2166,7 @@ token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 58; i++) jj_la1[i] = -1; + for (int i = 0; i < 60; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -2152,7 +2179,7 @@ token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 58; i++) jj_la1[i] = -1; + for (int i = 0; i < 60; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -2162,7 +2189,7 @@ token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 58; i++) jj_la1[i] = -1; + for (int i = 0; i < 60; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -2172,7 +2199,7 @@ token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 58; i++) jj_la1[i] = -1; + for (int i = 0; i < 60; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -2181,7 +2208,7 @@ token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 58; i++) jj_la1[i] = -1; + for (int i = 0; i < 60; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -2190,7 +2217,7 @@ token = new Token(); jj_ntk = -1; jj_gen = 0; - for (int i = 0; i < 58; i++) jj_la1[i] = -1; + for (int i = 0; i < 60; i++) jj_la1[i] = -1; for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); } @@ -2309,7 +2336,7 @@ la1tokens[jj_kind] = true; jj_kind = -1; } - for (int i = 0; i < 58; i++) { + for (int i = 0; i < 60; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { if ((jj_la1_0[i] & (1<<j)) != 0) { Modified: trunk/src/jason/asSyntax/parser/as2jConstants.java =================================================================== --- trunk/src/jason/asSyntax/parser/as2jConstants.java 2013-02-17 14:05:54 UTC (rev 1718) +++ trunk/src/jason/asSyntax/parser/as2jConstants.java 2013-03-13 12:31:06 UTC (rev 1719) @@ -76,14 +76,14 @@ "\"(\"", "\")\"", "\"!!\"", + "\"<\"", + "\">\"", "\",\"", "\"[\"", "\"|\"", "\"]\"", "\"&\"", - "\"<\"", "\"<=\"", - "\">\"", "\">=\"", "\"==\"", "\"\\\\==\"", Modified: trunk/src/jason/asSyntax/parser/as2jTokenManager.java =================================================================== --- trunk/src/jason/asSyntax/parser/as2jTokenManager.java 2013-02-17 14:05:54 UTC (rev 1718) +++ trunk/src/jason/asSyntax/parser/as2jTokenManager.java 2013-03-13 12:31:06 UTC (rev 1719) @@ -30,10 +30,10 @@ jjmatchedKind = 23; return 43; } + if ((active0 & 0x200000000L) != 0L) + return 44; if ((active0 & 0x800000000000000L) != 0L) return 14; - if ((active0 & 0x200000000L) != 0L) - return 44; return -1; case 1: if ((active0 & 0x20000L) != 0L) @@ -95,7 +95,7 @@ jjmatchedKind = 34; return jjMoveStringLiteralDfa1_0(0x100000000000L); case 38: - return jjStopAtPos(0, 49); + return jjStopAtPos(0, 51); case 40: return jjStopAtPos(0, 42); case 41: @@ -106,7 +106,7 @@ case 43: return jjStopAtPos(0, 37); case 44: - return jjStopAtPos(0, 45); + return jjStopAtPos(0, 47); case 45: return jjStopAtPos(0, 38); case 46: @@ -119,24 +119,24 @@ case 59: return jjStopAtPos(0, 41); case 60: - jjmatchedKind = 50; - return jjMoveStringLiteralDfa1_0(0x8001000000000L); + jjmatchedKind = 45; + return jjMoveStringLiteralDfa1_0(0x10001000000000L); case 61: jjmatchedKind = 56; return jjMoveStringLiteralDfa1_0(0x240000000000000L); case 62: - jjmatchedKind = 52; + jjmatchedKind = 46; return jjMoveStringLiteralDfa1_0(0x20000000000000L); case 63: return jjStopAtPos(0, 40); case 64: return jjStopAtPos(0, 16); case 91: - return jjStopAtPos(0, 46); + return jjStopAtPos(0, 48); case 92: return jjMoveStringLiteralDfa1_0(0x80000000000000L); case 93: - return jjStopAtPos(0, 48); + return jjStopAtPos(0, 50); case 94: return jjStopAtPos(0, 39); case 98: @@ -160,7 +160,7 @@ case 123: return jjStopAtPos(0, 30); case 124: - return jjStopAtPos(0, 47); + return jjStopAtPos(0, 49); case 125: return jjStopAtPos(0, 31); case 126: @@ -195,8 +195,8 @@ case 46: return jjMoveStringLiteralDfa2_0(active0, 0x200000000000000L); case 61: - if ((active0 & 0x8000000000000L) != 0L) - return jjStopAtPos(1, 51); + if ((active0 & 0x10000000000000L) != 0L) + return jjStopAtPos(1, 52); else if ((active0 & 0x20000000000000L) != 0L) return jjStopAtPos(1, 53); else if ((active0 & 0x40000000000000L) != 0L) @@ -399,19 +399,25 @@ jjCheckNAddTwoStates(28, 29); } break; + case 14: + if (curChar == 42) + jjCheckNAddTwoStates(20, 21); + else if (curChar == 47) + jjCheckNAddStates(0, 2); + break; case 0: if ((0x3ff000000000000L & l) != 0L) { if (kind > 21) kind = 21; - jjCheckNAddStates(0, 4); + jjCheckNAddStates(3, 7); } else if (curChar == 46) jjCheckNAddTwoStates(28, 32); else if (curChar == 47) - jjAddStates(5, 6); + jjAddStates(8, 9); else if (curChar == 34) - jjCheckNAddStates(7, 9); + jjCheckNAddStates(10, 12); if ((0x3ff000000000000L & l) != 0L) { if (kind > 25) @@ -428,19 +434,13 @@ else if (curChar == 46) jjCheckNAdd(32); break; - case 14: - if (curChar == 42) - jjCheckNAddTwoStates(20, 21); - else if (curChar == 47) - jjCheckNAddStates(10, 12); - break; case 1: if ((0xfffffffbffffdbffL & l) != 0L) - jjCheckNAddStates(7, 9); + jjCheckNAddStates(10, 12); break; case 3: if ((0x8400000000L & l) != 0L) - jjCheckNAddStates(7, 9); + jjCheckNAddStates(10, 12); break; case 4: if (curChar == 34 && kind > 22) @@ -452,7 +452,7 @@ break; case 6: if ((0xff000000000000L & l) != 0L) - jjCheckNAddStates(7, 9); + jjCheckNAddStates(10, 12); break; case 7: if ((0xf000000000000L & l) != 0L) @@ -475,11 +475,11 @@ break; case 13: if (curChar == 47) - jjAddStates(5, 6); + jjAddStates(8, 9); break; case 15: if ((0xffffffffffffdbffL & l) != 0L) - jjCheckNAddStates(10, 12); + jjCheckNAddStates(0, 2); break; case 16: if ((0x2400L & l) != 0L && kind > 5) @@ -562,7 +562,7 @@ break; if (kind > 21) kind = 21; - jjCheckNAddStates(0, 4); + jjCheckNAddStates(3, 7); break; case 36: if ((0x3ff000000000000L & l) == 0L) @@ -652,7 +652,7 @@ break; case 1: if ((0xffffffffefffffffL & l) != 0L) - jjCheckNAddStates(7, 9); + jjCheckNAddStates(10, 12); break; case 2: if (curChar == 92) @@ -660,7 +660,7 @@ break; case 3: if ((0x14404410000000L & l) != 0L) - jjCheckNAddStates(7, 9); + jjCheckNAddStates(10, 12); break; case 9: if (curChar != 95) @@ -685,7 +685,7 @@ kind = 26; break; case 15: - jjAddStates(10, 12); + jjAddStates(0, 2); break; case 20: jjCheckNAddTwoStates(20, 21); @@ -737,11 +737,11 @@ { case 1: if ((jjbitVec0[i2] & l2) != 0L) - jjAddStates(7, 9); + jjAddStates(10, 12); break; case 15: if ((jjbitVec0[i2] & l2) != 0L) - jjAddStates(10, 12); + jjAddStates(0, 2); break; case 20: if ((jjbitVec0[i2] & l2) != 0L) @@ -770,7 +770,7 @@ } } static final int[] jjnextStates = { - 36, 37, 38, 39, 40, 14, 19, 1, 2, 4, 15, 16, 18, 1, 2, 6, + 15, 16, 18, 36, 37, 38, 39, 40, 14, 19, 1, 2, 4, 1, 2, 6, 4, 21, 22, 24, 3, 5, 7, 30, 31, 41, 42, }; public static final String[] jjstrLiteralImages = { @@ -779,7 +779,7 @@ "\142\145\147\151\156", "\145\156\144", "\100", "\151\146", "\145\154\163\145", "\146\157\162", "\167\150\151\154\145", null, null, null, null, null, null, null, null, null, "\173", "\175", "\72\55", "\56", "\41", "\72", "\74\55", "\53", "\55", "\136", "\77", "\73", "\50", -"\51", "\41\41", "\54", "\133", "\174", "\135", "\46", "\74", "\74\75", "\76", +"\51", "\41\41", "\74", "\76", "\54", "\133", "\174", "\135", "\46", "\74\75", "\76\75", "\75\75", "\134\75\75", "\75", "\75\56\56", "\52", "\57", "\52\52", }; public static final String[] lexStateNames = { "DEFAULT", Modified: trunk/src/jason/mas2j/parser/mas2jTokenManager.java =================================================================== --- trunk/src/jason/mas2j/parser/mas2jTokenManager.java 2013-02-17 14:05:54 UTC (rev 1718) +++ trunk/src/jason/mas2j/parser/mas2jTokenManager.java 2013-03-13 12:31:06 UTC (rev 1719) @@ -16,6 +16,11 @@ switch (pos) { case 0: + if ((active0 & 0x712ff00L) != 0L) + { + jjmatchedKind = 29; + return 88; + } if ((active0 & 0x40000000000L) != 0L) return 45; if ((active0 & 0x400000L) != 0L) @@ -23,10 +28,10 @@ jjmatchedKind = 29; return 14; } - if ((active0 & 0x712ff00L) != 0L) + if ((active0 & 0x80000L) != 0L) { jjmatchedKind = 29; - return 88; + return 21; } if ((active0 & 0x80L) != 0L) { @@ -38,26 +43,19 @@ jjmatchedKind = 29; return 5; } - if ((active0 & 0x80000L) != 0L) - { - jjmatchedKind = 29; - return 21; - } return -1; case 1: - if ((active0 & 0x800L) != 0L) - return 90; - if ((active0 & 0x75af700L) != 0L) + if ((active0 & 0x200000L) != 0L) { jjmatchedKind = 29; jjmatchedPos = 1; - return 90; + return 4; } - if ((active0 & 0x200000L) != 0L) + if ((active0 & 0x75af700L) != 0L) { jjmatchedKind = 29; jjmatchedPos = 1; - return 4; + return 90; } if ((active0 & 0x80L) != 0L) { @@ -65,6 +63,8 @@ jjmatchedPos = 1; return 78; } + if ((active0 & 0x800L) != 0L) + return 90; return -1; case 2: if ((active0 & 0x77af700L) != 0L) @@ -85,24 +85,24 @@ } return -1; case 4: - if ((active0 & 0x80000L) != 0L) - return 90; if ((active0 & 0x772f700L) != 0L) { jjmatchedKind = 29; jjmatchedPos = 4; return 90; } + if ((active0 & 0x80000L) != 0L) + return 90; return -1; case 5: - if ((active0 & 0x8100L) != 0L) - return 90; if ((active0 & 0x7727600L) != 0L) { jjmatchedKind = 29; jjmatchedPos = 5; return 90; } + if ((active0 & 0x8100L) != 0L) + return 90; return -1; case 6: if ((active0 & 0x120000L) != 0L) @@ -123,14 +123,14 @@ } return -1; case 8: - if ((active0 & 0x2000L) != 0L) - return 90; if ((active0 & 0x7605600L) != 0L) { jjmatchedKind = 29; jjmatchedPos = 8; return 90; } + if ((active0 & 0x2000L) != 0L) + return 90; return -1; case 9: if ((active0 & 0x1200000L) != 0L) @@ -143,14 +143,14 @@ } return -1; case 10: - if ((active0 & 0x200L) != 0L) - return 90; if ((active0 & 0x6405400L) != 0L) { jjmatchedKind = 29; jjmatchedPos = 10; return 90; } + if ((active0 & 0x200L) != 0L) + return 90; return -1; case 11: if ((active0 & 0x400000L) != 0L) @@ -173,14 +173,14 @@ } return -1; case 13: - if ((active0 & 0x2001000L) != 0L) - return 90; if ((active0 & 0x4000400L) != 0L) { jjmatchedKind = 29; jjmatchedPos = 13; return 90; } + if ((active0 & 0x2001000L) != 0L) + return 90; return -1; case 14: if ((active0 & 0x4000000L) != 0L) @@ -823,7 +823,7 @@ jjCheckNAddTwoStates(46, 47); } break; - case 21: + case 89: if ((0x3ff000000000000L & l) != 0L) { if (kind > 30) @@ -835,14 +835,36 @@ if (kind > 32) kind = 32; } + if (curChar == 58) + { + if (kind > 31) + kind = 31; + jjCheckNAddTwoStates(46, 47); + } + break; + case 90: if ((0x3ff000000000000L & l) != 0L) { + if (kind > 30) + kind = 30; + jjCheckNAdd(78); + } + if ((0x3ff000000000000L & l) != 0L) + { if (kind > 29) kind = 29; jjCheckNAdd(76); } - else if (curChar == 58) + break; + case 45: + if ((0x3ff000000000000L & l) != 0L) { + if (kind > 27) + kind = 27; + jjCheckNAddTwoStates(32, 33); + } + else if (curChar == 47) + { if (kind > 31) kind = 31; jjCheckNAddTwoStates(46, 47); @@ -862,7 +884,7 @@ jjCheckNAdd(76); } break; - case 5: + case 14: if ((0x3ff000000000000L & l) != 0L) { if (kind > 30) @@ -887,7 +909,7 @@ jjCheckNAddTwoStates(46, 47); } break; - case 14: + case 5: if ((0x3ff000000000000L & l) != 0L) { if (kind > 30) @@ -934,48 +956,26 @@ else if (curChar == 46) jjCheckNAdd(32); break; - case 45: + case 21: if ((0x3ff000000000000L & l) != 0L) { - if (kind > 27) - kind = 27; - jjCheckNAddTwoStates(32, 33); - } - else if (curChar == 47) - { - if (kind > 31) - kind = 31; - jjCheckNAddTwoStates(46, 47); - } - break; - case 90: - if ((0x3ff000000000000L & l) != 0L) - { if (kind > 30) kind = 30; jjCheckNAdd(78); } + else if (curChar == 58) + { + if (kind > 32) + kind = 32; + } if ((0x3ff000000000000L & l) != 0L) { if (kind > 29) kind = 29; jjCheckNAdd(76); } - break; - case 89: - if ((0x3ff000000000000L & l) != 0L) - { - if (kind > 30) - kind = 30; - jjCheckNAdd(78); - } else if (curChar == 58) { - if (kind > 32) - kind = 32; - } - if (curChar == 58) - { if (kind > 31) kind = 31; jjCheckNAddTwoStates(46, 47); @@ -1181,7 +1181,15 @@ jjCheckNAdd(76); } break; - case 21: + case 89: + case 78: + if ((0x7fffffe87fffffeL & l) == 0L) + break; + if (kind > 30) + kind = 30; + jjCheckNAdd(78); + break; + case 90: if ((0x7fffffe87fffffeL & l) != 0L) { if (kind > 30) @@ -1194,8 +1202,6 @@ kind = 29; jjCheckNAdd(76); } - if (curChar == 101) - jjstateSet[jjnewStateCnt++] = 20; break; case 4: if ((0x7fffffe87fffffeL & l) != 0L) @@ -1213,7 +1219,7 @@ if (curChar == 115) jjstateSet[jjnewStateCnt++] = 3; break; - case 5: + case 14: if ((0x7fffffe87fffffeL & l) != 0L) { if (kind > 30) @@ -1226,10 +1232,10 @@ kind = 29; jjCheckNAdd(76); } - if (curChar == 105) - jjstateSet[jjnewStateCnt++] = 4; + if (curChar == 97) + jjstateSet[jjnewStateCnt++] = 13; break; - case 14: + case 5: if ((0x7fffffe87fffffeL & l) != 0L) { if (kind > 30) @@ -1242,8 +1248,8 @@ kind = 29; jjCheckNAdd(76); } - if (curChar == 97) - jjstateSet[jjnewStateCnt++] = 13; + if (curChar == 105) + jjstateSet[jjnewStateCnt++] = 4; break; case 6: if ((0x7fffffe07fffffeL & l) != 0L) @@ -1282,7 +1288,7 @@ else if (curChar == 100) jjstateSet[jjnewStateCnt++] = 5; break; - case 90: + case 21: if ((0x7fffffe87fffffeL & l) != 0L) { if (kind > 30) @@ -1295,15 +1301,9 @@ kind = 29; jjCheckNAdd(76); } + if (curChar == 101) + jjstateSet[jjnewStateCnt++] = 20; break; - case 89: - case 78: - if ((0x7fffffe87fffffeL & l) == 0L) - break; - if (kind > 30) - kind = 30; - jjCheckNAdd(78); - break; case 0: if (curChar == 100 && kind > 16) kind = 16; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jom...@us...> - 2013-02-17 14:06:06
|
Revision: 1718 http://jason.svn.sourceforge.net/jason/?rev=1718&view=rev Author: jomifred Date: 2013-02-17 14:05:54 +0000 (Sun, 17 Feb 2013) Log Message: ----------- add internal action .shuffle Modified Paths: -------------- trunk/release-notes.txt trunk/src/jason/stdlib/package.html Added Paths: ----------- trunk/src/jason/stdlib/shuffle.java Modified: trunk/release-notes.txt =================================================================== --- trunk/release-notes.txt 2012-12-14 14:59:42 UTC (rev 1717) +++ trunk/release-notes.txt 2013-02-17 14:05:54 UTC (rev 1718) @@ -24,6 +24,7 @@ [qprofiling=yes]: it generates some statistical data related to queries and is used to measure the performance of the qcache option +- new internal action .shuffle to shuffle the elements of lists --------------------------- version 1.3.8 Modified: trunk/src/jason/stdlib/package.html =================================================================== --- trunk/src/jason/stdlib/package.html 2012-12-14 14:59:42 UTC (rev 1717) +++ trunk/src/jason/stdlib/package.html 2013-02-17 14:05:54 UTC (rev 1718) @@ -67,6 +67,7 @@ <li>{@link jason.stdlib.delete delete}: delete members of a lists. </li> <li>{@link jason.stdlib.reverse reverse}: reverse lists. </li> + <li>{@link jason.stdlib.shuffle shuffle}: shuffle the elements of a list. </li> <li>{@link jason.stdlib.nth nth}: nth element of a lists. </li> <li>{@link jason.stdlib.max max}: maximum value of a lists. </li> <li>{@link jason.stdlib.min min}: minimum value of a lists. </li> Added: trunk/src/jason/stdlib/shuffle.java =================================================================== --- trunk/src/jason/stdlib/shuffle.java (rev 0) +++ trunk/src/jason/stdlib/shuffle.java 2013-02-17 14:05:54 UTC (rev 1718) @@ -0,0 +1,73 @@ +//---------------------------------------------------------------------------- +// Copyright (C) 2003 Rafael H. Bordini, Jomi F. Hubner, et al. +// +// 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://www.inf.ufrgs.br/~bordini +// http://www.das.ufsc.br/~jomi +// +//---------------------------------------------------------------------------- + +package jason.stdlib; + +import jason.JasonException; +import jason.asSemantics.DefaultInternalAction; +import jason.asSemantics.TransitionSystem; +import jason.asSemantics.Unifier; +import jason.asSyntax.ListTerm; +import jason.asSyntax.ListTermImpl; +import jason.asSyntax.Term; + +import java.util.Collections; +import java.util.List; + +/** + + <p>Internal action: <b><code>.shuffle(List,Result)</code></b>. + + <p>Description: shuffle the elements of the <i>List</i> and unifies the result in <i>Var</i>. + + <p>Parameters:<ul> + + <li>+ list: the list to be shuffled<br/> + + <li>- result (var): the list with the elements shuffled.<br/> + + </ul> + +*/ +public class shuffle extends DefaultInternalAction { + + @Override public int getMinArgs() { return 2; } + @Override public int getMaxArgs() { return 2; } + + @Override protected void checkArguments(Term[] args) throws JasonException { + super.checkArguments(args); // check number of arguments + if (! (args[0].isList())) + throw JasonException.createWrongArgument(this,"first argument must be a list"); + } + + @Override + public Object execute(TransitionSystem ts, Unifier un, Term[] args) throws Exception { + checkArguments(args); + + List<Term> lt = ((ListTerm)args[0]).getAsList(); + Collections.shuffle(lt); + ListTerm ls = new ListTermImpl(); + ls.addAll(lt); + return un.unifies(args[1], ls); + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jom...@us...> - 2012-12-14 14:59:49
|
Revision: 1717 http://jason.svn.sourceforge.net/jason/?rev=1717&view=rev Author: jomifred Date: 2012-12-14 14:59:42 +0000 (Fri, 14 Dec 2012) Log Message: ----------- Use master config file (jason.properties) if no user config is found (contribution from Felipe Meneguzzi) Modified Paths: -------------- trunk/src/jason/jeditplugin/Config.java Modified: trunk/src/jason/jeditplugin/Config.java =================================================================== --- trunk/src/jason/jeditplugin/Config.java 2012-12-11 16:18:22 UTC (rev 1716) +++ trunk/src/jason/jeditplugin/Config.java 2012-12-14 14:59:42 UTC (rev 1717) @@ -103,6 +103,10 @@ public File getUserConfFile() { return new File(System.getProperties().get("user.home") + File.separator + ".jason/user.properties"); } + + public File getMasterConfFile() { + return new File("jason.properties"); + } /** Returns true if the file is loaded correctly */ public boolean load() { @@ -111,6 +115,13 @@ if (f.exists()) { super.load(new FileInputStream(f)); return true; + } else { // load master configuration file + f = getMasterConfFile(); + if (f.exists()) { + System.out.println("User config file not found, loading master: "+f.getAbsolutePath()); + super.load(new FileInputStream(f)); + return true; + } } } catch (Exception e) { System.err.println("Error reading preferences"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jom...@us...> - 2012-12-11 16:18:33
|
Revision: 1716 http://jason.svn.sourceforge.net/jason/?rev=1716&view=rev Author: jomifred Date: 2012-12-11 16:18:22 +0000 (Tue, 11 Dec 2012) Log Message: ----------- fix small bug in jade custom bb Modified Paths: -------------- trunk/src/jason/asSyntax/LogExpr.java trunk/src/jason/infra/jade/JasonBridgeArch.java Modified: trunk/src/jason/asSyntax/LogExpr.java =================================================================== --- trunk/src/jason/asSyntax/LogExpr.java 2012-12-07 10:51:06 UTC (rev 1715) +++ trunk/src/jason/asSyntax/LogExpr.java 2012-12-11 16:18:22 UTC (rev 1716) @@ -24,8 +24,6 @@ package jason.asSyntax; import jason.asSemantics.Agent; -import jason.asSemantics.CacheKey; -import jason.asSemantics.QueryCacheAdv; import jason.asSemantics.Unifier; import jason.asSyntax.parser.as2j; Modified: trunk/src/jason/infra/jade/JasonBridgeArch.java =================================================================== --- trunk/src/jason/infra/jade/JasonBridgeArch.java 2012-12-07 10:51:06 UTC (rev 1715) +++ trunk/src/jason/infra/jade/JasonBridgeArch.java 2012-12-11 16:18:22 UTC (rev 1716) @@ -59,6 +59,12 @@ } @Override + public void stop() { + getTS().getAg().stopAg(); + super.stop(); + } + + @Override public String getAgName() { return jadeAg.getLocalName(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |