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

25
LINES

< > BotCompany Repo | #1021403 // ai_ruleEngine2_rulesForInput_2

JavaX fragment (include)

1  
sclass RuleEngine2_MatchedRule {
2  
  RuleEngine2.Rule rule;
3  
  SS map;
4  
  LS goodVars, badVars;
5  
  
6  
  LS unclearVars() { ret listMinusSet(keys(map), goodVars, badVars); }
7  
}
8  
9  
static L<RuleEngine2_MatchedRule> ai_ruleEngine2_rulesForInput_2(RuleEngine2 engine, S q) {
10  
  LS tokI = javaTokNPunctuationWithBrackets(q);
11  
  new L<RuleEngine2_MatchedRule> l;
12  
  for (RuleEngine2.Rule rule : engine.rules) {
13  
    S cond = first(rule.in);
14  
    SS map = zipTwoListsToCIMap_strict_withoutEquals(javaTokNPunctuationWithBrackets(cond), tokI);
15  
    if (map == null) continue;
16  
    //print(map + " | " + cond + " | " + rule.vars);
17  
    new RuleEngine2_MatchedRule matched;
18  
    matched.rule = rule;
19  
    matched.map = map;
20  
    matched.goodVars = matchX_any_allRests("good var *", rule.comments);
21  
    matched.badVars = matchX_any_allRests("bad var *", rule.comments);
22  
    l.add(matched);
23  
  }
24  
  ret l;
25  
}

Author comment

Began life as a copy of #1021400

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: #1021403
Snippet name: ai_ruleEngine2_rulesForInput_2
Eternal ID of this version: #1021403/3
Text MD5: 6e4f5beaf2d98ad920fff8b955c1b9bb
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-02-10 20:50:07
Source code size: 895 bytes / 25 lines
Pitched / IR pitched: No / No
Views / Downloads: 292 / 338
Version history: 2 change(s)
Referenced in: [show references]