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

24
LINES

< > BotCompany Repo | #1021892 // gazelle_proposeCalculationFunctions [dev.]

JavaX fragment (include)

1  
// returns comments
2  
static LS gazelle_proposeCalculationFunctions(S ruleText, ai_gazelle_analyzeStatementsForRule_Data data) {
3  
  PairS rule = splitAtDoubleArrow_pair(ruleText);
4  
  S var1 = firstIntAsString(rule.a), var2 = secondIntAsString(rule.a);
5  
  S var3 = firstIntAsString(rule.b);
6  
  if (var1 == null || var2 == null || var3 == null) ret emptyList();
7  
  
8  
  LS functions = ai_numberCalculationFunctions();
9  
  for (SS map : listPlus(data.completeGoodMappings, null)) {
10  
    if (empty(functions)) null;
11  
    L<Double> numbers = ll(parseDouble(getOrKeep(map, var1)),
12  
      parseDouble(getOrKeep(map, var2)));
13  
    double result = parseDouble(getOrKeep(map, var3));
14  
    print("Checking map: " + map + " - " + numbers + " -> " + result);
15  
    functions = filter(functions, func(S f) -> bool {
16  
      ai_checkNumberCalculationFunction1(f,
17  
        numbers,
18  
        result)
19  
    });
20  
    print("Remaining functions: " + functions);
21  
  }
22  
  
23  
  ret ll(format("compute var " + quote(var3) + " from " + quote(var1) + " and " + quote(var2) + " using *", first(functions)));
24  
}

Author comment

Began life as a copy of #1021864

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, whxojlpjdney

No comments. add comment

Snippet ID: #1021892
Snippet name: gazelle_proposeCalculationFunctions [dev.]
Eternal ID of this version: #1021892/7
Text MD5: 9ded9d421f0945a96551b730ba73f93c
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-03 00:31:45
Source code size: 1076 bytes / 24 lines
Pitched / IR pitched: No / No
Views / Downloads: 170 / 206
Version history: 6 change(s)
Referenced in: [show references]