From: <jom...@us...> - 2014-09-19 01:51:14
|
Revision: 1805 http://sourceforge.net/p/jason/svn/1805 Author: jomifred Date: 2014-09-19 01:51:08 +0000 (Fri, 19 Sep 2014) Log Message: ----------- fix bug related to atomic intention suspended by PA Modified Paths: -------------- trunk/src/jason/asSemantics/Circumstance.java trunk/src/jason/asSemantics/TransitionSystem.java trunk/src/jason/runtime/MASConsoleColorGUI.java trunk/src/jason/runtime/MASConsoleGUI.java Modified: trunk/src/jason/asSemantics/Circumstance.java =================================================================== --- trunk/src/jason/asSemantics/Circumstance.java 2014-09-18 21:20:47 UTC (rev 1804) +++ trunk/src/jason/asSemantics/Circumstance.java 2014-09-19 01:51:08 UTC (rev 1805) @@ -341,7 +341,7 @@ public Intention removeAtomicIntention() { if (AI != null) { - if (atomicIntSuspended) { + if (atomicIntSuspended) { //throw new JasonException("Internal error: trying to remove the atomic intention, but it is suspended! it should be removed only when back to I!"); return null; } @@ -369,7 +369,7 @@ } public boolean hasPendingIntention() { - return PI != null && PI.size() > 0; + return PI != null && !PI.isEmpty(); } public void clearPendingIntentions() { @@ -499,10 +499,11 @@ if (act.getIntention() != null) { synchronized (FA) { FA.add(act); + /*if (act.getIntention().isAtomic()) { + ts.getLogger().info("feedback atomic "+act.getIntention().getId()); + //atomicIntSuspended = false; // TODO: here is the bug (reported by Olivier @ ALTISSIMO) + }*/ } - if (act.getIntention().isAtomic()) { - atomicIntSuspended = false; - } } } @@ -537,7 +538,7 @@ } public boolean hasPendingAction() { - return PA != null && PA.size() > 0; + return PA != null && !PA.isEmpty(); } Modified: trunk/src/jason/asSemantics/TransitionSystem.java =================================================================== --- trunk/src/jason/asSemantics/TransitionSystem.java 2014-09-18 21:20:47 UTC (rev 1804) +++ trunk/src/jason/asSemantics/TransitionSystem.java 2014-09-19 01:51:08 UTC (rev 1805) @@ -552,10 +552,13 @@ private void applyProcAct() throws JasonException { confP.step = State.SelInt; // default next step if (conf.C.hasFeedbackAction()) { - ActionExec a = conf.ag.selectAction(conf.C.getFeedbackActions()); + ActionExec a = null; + synchronized (conf.C.getFeedbackActions()) { + a = conf.ag.selectAction(conf.C.getFeedbackActions()); + } if (a != null) { confP.C.SI = a.getIntention(); - + // remove the intention from PA (PA has all pending action, including those in FA; // but, if the intention is not in PA, it means that the intention was dropped // and should not return to I) @@ -1315,7 +1318,7 @@ } public boolean canSleep() { - return (C.isAtomicIntentionSuspended() && !conf.C.hasMsg()) + return (C.isAtomicIntentionSuspended() && !C.hasFeedbackAction() && !conf.C.hasMsg()) || (!conf.C.hasEvent() && !conf.C.hasIntention() && !conf.C.hasFeedbackAction() && !conf.C.hasMsg() && Modified: trunk/src/jason/runtime/MASConsoleColorGUI.java =================================================================== --- trunk/src/jason/runtime/MASConsoleColorGUI.java 2014-09-18 21:20:47 UTC (rev 1804) +++ trunk/src/jason/runtime/MASConsoleColorGUI.java 2014-09-19 01:51:08 UTC (rev 1805) @@ -106,10 +106,12 @@ } synchronized (this) { output.append(c, s); - output.setCaretPosition(l); + try { + output.setCaretPosition(l); + } catch (IllegalArgumentException e) {} } } catch (Exception e) { - close(); + //close(); System.out.println(e); e.printStackTrace(); } Modified: trunk/src/jason/runtime/MASConsoleGUI.java =================================================================== --- trunk/src/jason/runtime/MASConsoleGUI.java 2014-09-18 21:20:47 UTC (rev 1804) +++ trunk/src/jason/runtime/MASConsoleGUI.java 2014-09-19 01:51:08 UTC (rev 1805) @@ -210,10 +210,12 @@ } synchronized (this) { output.append(s); - output.setCaretPosition(l); + try { + output.setCaretPosition(l); + } catch (java.lang.IllegalArgumentException e) {} } } catch (Exception e) { - close(); + //close(); System.out.println(e); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |