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

17
LINES

< > BotCompany Repo | #1018337 // nlLogic_fillBattleSpace_collector - uses Collector as output

JavaX fragment (include)

svoid nlLogic_fillBattleSpace_collector(final NLLogicChecker_v2 c, final Collector<RuleWithParams> battleSpace, final bool debug) {
  withCancelPoint(voidfunc(final CancelPoint cp) {
    VF2<IfThen, NLLogicChecker_v2.Matching> onRuleFired = voidfunc(IfThen rule, NLLogicChecker_v2.Matching m) {
      if (battleSpace.add(new RuleWithParams(rule, m.matches)))
        cancelTo(cp);
    };
    VF4<IfThen, NLLogicChecker_v2.Matching, L<Exp>, Exp> onRuleFailed = voidfunc(IfThen rule, NLLogicChecker_v2.Matching m, L<Exp> satisfiedConditions, Exp remaining) {
      //print("satisfied conditions: " + satisfiedConditions);
      if (battleSpace.add(new FailedRule(rule, m.matches, cloneListOrNull(nullIfEmpty(satisfiedConditions)), remaining)))
        cancelTo(cp);
    };
    
    print("Iterating over " + n2(c.rules, "rule"));
    applyNLLogicFacts_v4_iterate_withFailed2_verbose.set(debug);
    applyNLLogicFacts_v4_iterate_withFailed2(c, onRuleFired, onRuleFailed, c.rules);
  });
}

Author comment

Began life as a copy of #1018334

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1018337
Snippet name: nlLogic_fillBattleSpace_collector - uses Collector as output
Eternal ID of this version: #1018337/5
Text MD5: 0862b7bf9322134921b0df6c81efa49b
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-09-19 23:50:58
Source code size: 1001 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 322 / 369
Version history: 4 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1018345 - nlLogic_fillBattleSpace_steppable