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)

sclass RuleEngine2_MatchedRule {
  RuleEngine2.Rule rule;
  SS map;
  LS goodVars, badVars;
  
  LS unclearVars() { ret listMinusSet(keys(map), goodVars, badVars); }
}

static L<RuleEngine2_MatchedRule> ai_ruleEngine2_rulesForInput_2(RuleEngine2 engine, S q) {
  LS tokI = javaTokNPunctuationWithBrackets(q);
  new L<RuleEngine2_MatchedRule> l;
  for (RuleEngine2.Rule rule : engine.rules) {
    S cond = first(rule.in);
    SS map = zipTwoListsToCIMap_strict_withoutEquals(javaTokNPunctuationWithBrackets(cond), tokI);
    if (map == null) continue;
    //print(map + " | " + cond + " | " + rule.vars);
    new RuleEngine2_MatchedRule matched;
    matched.rule = rule;
    matched.map = map;
    matched.goodVars = matchX_any_allRests("good var *", rule.comments);
    matched.badVars = matchX_any_allRests("bad var *", rule.comments);
    l.add(matched);
  }
  ret l;
}

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: 290 / 336
Version history: 2 change(s)
Referenced in: [show references]