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)

1  
static L<RuleEngine2_MatchedRule> ai_ruleEngine2_rulesForInput_5_allConditions(RuleEngine2 engine, SS inputsByType, O... _) {
2  
  L<RuleEngine2_MatchedRule> notDone = ai_ruleEngine2_rulesForInput_5(engine, inputsByType, _);
3  
  new L<RuleEngine2_MatchedRule> done;
4  
  bool debug = boolPar debug(_);
5  
  
6  
  while (nempty(notDone)) {
7  
    L<RuleEngine2_MatchedRule> l = notDone;
8  
    notDone = new L;
9  
    for (RuleEngine2_MatchedRule mr : l) {
10  
      if (!mr.moreConditions()) {
11  
        if (debug) print("Done: " + mr.ruleID());
12  
        done.add(mr);
13  
      }
14  
      else {
15  
        if (debug) print("Matching step " + mr.iCond + " in " + mr.ruleID());
16  
        if (ai_ruleEngine2_matchStep(mr, inputsByType, false)) {
17  
          if (debug) print("Step succeeded");
18  
          notDone.add(mr);
19  
        } else
20  
          done.add(mr); // keep partially applied rule
21  
      }
22  
    }
23  
  }
24  
  
25  
  ret done;
26  
}

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: 286 / 317
Version history: 9 change(s)
Referenced in: [show references]