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

19
LINES

< > BotCompany Repo | #1018332 // nlLogic_iterate_withOnFail2 - calls onFail when a term doesn't yield any results

JavaX fragment (include)

static void nlLogic_iterate_withOnFail2(final NLLogicChecker_v2 c, Exp e, final NLLogicChecker_v2.Matching m, final L<Exp> satisfiedConditions, final Runnable onMatch, final VF2<L<Exp>, Exp> onFail) {
  final new Flag anyResults;
  
  if (e cast And) {
    final Exp a = e.a, b = e.b;
    c.iterate_single(a, m, r {
      anyResults.raise();
      temp tempAddToList_exclusive(satisfiedConditions, a);
      nlLogic_iterate_withOnFail2(c, b, m, satisfiedConditions, onMatch, onFail);
    });
  } else
    c.iterate_single(e, m, r {
      anyResults.raise();
      callF(onMatch);
    });
    
  if (!anyResults.isUp())
    callF(onFail, satisfiedConditions, e);
}

Author comment

Began life as a copy of #1018313

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: #1018332
Snippet name: nlLogic_iterate_withOnFail2 - calls onFail when a term doesn't yield any results
Eternal ID of this version: #1018332/2
Text MD5: 66ccb3cf950c3c7708aae14f961b5fe9
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 21:26:14
Source code size: 681 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 321 / 362
Version history: 1 change(s)
Referenced in: [show references]