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)

1  
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) {
2  
  final new Flag anyResults;
3  
  
4  
  if (e cast And) {
5  
    final Exp a = e.a, b = e.b;
6  
    c.iterate_single(a, m, r {
7  
      anyResults.raise();
8  
      temp tempAddToList_exclusive(satisfiedConditions, a);
9  
      nlLogic_iterate_withOnFail2(c, b, m, satisfiedConditions, onMatch, onFail);
10  
    });
11  
  } else
12  
    c.iterate_single(e, m, r {
13  
      anyResults.raise();
14  
      callF(onMatch);
15  
    });
16  
    
17  
  if (!anyResults.isUp())
18  
    callF(onFail, satisfiedConditions, e);
19  
}

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: 382 / 429
Version history: 1 change(s)
Referenced in: [show references]