Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

26
LINES

< > BotCompany Repo | #1021500 // ai_ruleEngine2_rulesForInput_5_allConditions

JavaX fragment (include)

static L<RuleEngine2_MatchedRule> ai_ruleEngine2_rulesForInput_5_allConditions(RuleEngine2 engine, SS inputsByType, O... _) {
  L<RuleEngine2_MatchedRule> notDone = ai_ruleEngine2_rulesForInput_5(engine, inputsByType, _);
  new L<RuleEngine2_MatchedRule> done;
  bool debug = boolPar debug(_);
  
  while (nempty(notDone)) {
    L<RuleEngine2_MatchedRule> l = notDone;
    notDone = new L;
    for (RuleEngine2_MatchedRule mr : l) {
      if (!mr.moreConditions()) {
        if (debug) print("Done: " + mr.ruleID());
        done.add(mr);
      }
      else {
        if (debug) print("Matching step " + mr.iCond + " in " + mr.ruleID());
        if (ai_ruleEngine2_matchStep(mr, inputsByType, false)) {
          if (debug) print("Step succeeded");
          notDone.add(mr);
        } else
          done.add(mr); // keep partially applied rule
      }
    }
  }
  
  ret done;
}

Author comment

Began life as a copy of #1021498

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1021500
Snippet name: ai_ruleEngine2_rulesForInput_5_allConditions
Eternal ID of this version: #1021500/10
Text MD5: 3d6b55418b0604bf4469606b7aac7032
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-02-18 16:50:02
Source code size: 905 bytes / 26 lines
Pitched / IR pitched: No / No
Views / Downloads: 401 / 429
Version history: 9 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)