static bool ctxDoNextActionInRule(WoodyRule rule) { L actions = ctxCases(rule.body); if (nempty(actions)) { bool random = eqOneOf(rule.properties.get('ACTIONSELECTOR), 'RANDOMLOOP, 'RANDOM); // otherwise assume TILLEND S name = rule.longName(); BitSet bs = conversation->randomLoopMap.get(name); if (bs == null) { conversation->randomLoopMap.put(name, bs = new BitSet); conversation->change(); } new L candidates; for i over actions: if (!bs.get(i)) candidates.add(i); if (empty(candidates)) { bs.clear(); conversation->change(); for i over actions: candidates.add(i); } int idx = random ? random(candidates) : first(candidates); bs.set(idx); conversation->change(); CtxCase action = actions.get(idx); ctxProcessAction(action.action); S a = mapGet(action.properties, 'ANALYZER); print("doNextAction analyzer=" + a); if (a != null) ctxContext().activeAnalyzer = a; ctxContext().nextRule = rule.properties.get('GOTO); true; } false; }