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

21
LINES

< > BotCompany Repo | #1013183 // ai_isRuleSuitableForFunction

JavaX fragment (include)

1  
static Map<Pair<S>, Bool> ai_isRuleSuitableForFunction_cache = synchroHashMap();
2  
3  
static bool ai_isRuleSuitableForFunction(S rule, S f) {
4  
  Pair<S> p = pair(rule, f);
5  
  Bool b = ai_isRuleSuitableForFunction_cache.get(p);
6  
  if (b != null) ret b;
7  
  try {
8  
    callAndMake(f, rule, null);
9  
    ai_isRuleSuitableForFunction_cache.put(p, true);
10  
    true;
11  
  } catch e {
12  
    if (shortClassNameIs(e, "UnsuitableRuleException")) {
13  
      ai_isRuleSuitableForFunction_cache.put(p, false);
14  
      false;
15  
    } else {
16  
      ai_isRuleSuitableForFunction_cache.put(p, false);
17  
      printException(e);
18  
      throw FunctionIsBroken(f);
19  
    }
20  
  }
21  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1013183
Snippet name: ai_isRuleSuitableForFunction
Eternal ID of this version: #1013183/5
Text MD5: 7a3450e188085e0cabcdde0ed18db6be
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-12-27 06:21:28
Source code size: 647 bytes / 21 lines
Pitched / IR pitched: No / No
Views / Downloads: 386 / 401
Version history: 4 change(s)
Referenced in: [show references]