From: <jom...@us...> - 2016-04-06 16:26:07
|
Revision: 1885 http://sourceforge.net/p/jason/svn/1885 Author: jomifred Date: 2016-04-06 16:26:04 +0000 (Wed, 06 Apr 2016) Log Message: ----------- improved wake in the arch Modified Paths: -------------- trunk/src/jason/architecture/AgArch.java trunk/src/jason/stdlib/relevant_rules.java trunk/src/jason/stdlib/wait.java Modified: trunk/src/jason/architecture/AgArch.java =================================================================== --- trunk/src/jason/architecture/AgArch.java 2016-04-06 16:24:17 UTC (rev 1884) +++ trunk/src/jason/architecture/AgArch.java 2016-04-06 16:26:04 UTC (rev 1885) @@ -222,7 +222,20 @@ if (successor != null) successor.wake(); } + + public void wakeUpSense(boolean ts) { + wake(); + } + public void wakeUpDeliberate(boolean ts) { + wake(); + } + + public void wakeUpAct(boolean ts) { + wake(); + } + + public RuntimeServicesInfraTier getRuntimeServices() { if (successor == null) return null; Modified: trunk/src/jason/stdlib/relevant_rules.java =================================================================== --- trunk/src/jason/stdlib/relevant_rules.java 2016-04-06 16:24:17 UTC (rev 1884) +++ trunk/src/jason/stdlib/relevant_rules.java 2016-04-06 16:26:04 UTC (rev 1885) @@ -44,16 +44,18 @@ public Object execute(TransitionSystem ts, Unifier un, Term[] args) throws Exception { try { Literal pattern = (Literal)args[0]; - Iterator<Literal> i = ts.getAg().getBB().getCandidateBeliefs(pattern, un); ListTerm result = new ListTermImpl(); - while (i.hasNext()) { - Literal l = i.next(); - if (l.isRule()) { - if (un.clone().unifies(pattern, l)) { - l = l.copy(); - l.delSources(); - ((Rule)l).setAsTerm(true); - result.add(l); + synchronized (ts.getAg().getBB().getLock()) { + Iterator<Literal> i = ts.getAg().getBB().getCandidateBeliefs(pattern, un); + while (i.hasNext()) { + Literal l = i.next(); + if (l.isRule()) { + if (un.clone().unifies(pattern, l)) { + l = l.copy(); + l.delSources(); + ((Rule)l).setAsTerm(true); + result.add(l); + } } } } Modified: trunk/src/jason/stdlib/wait.java =================================================================== --- trunk/src/jason/stdlib/wait.java 2016-04-06 16:24:17 UTC (rev 1884) +++ trunk/src/jason/stdlib/wait.java 2016-04-06 16:26:04 UTC (rev 1885) @@ -208,7 +208,7 @@ } } }); - ts.getUserAgArch().wake(); + ts.getUserAgArch().wakeUpDeliberate(false); } public void eventAdded(Event e) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |