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

43
LINES

< > BotCompany Repo | #1022572 // gazelle_reason_repeat_v2 - handle multiple [process] lines, dev.

JavaX fragment (include)

1  
static L<GazelleTree> gazelle_reason_repeat_v2(S input1, O... _) {
2  
  int max = 10;
3  
  
4  
  new L<GazelleTree> out;
5  
  Set<S> seen = litCISet(input1);
6  
  LinkedList<S> queue = ll_linkedList(input1);
7  
  
8  
  while (nempty(queue) && l(seen) < max) {
9  
    S input = popFirst(queue);
10  
    addAll(out, (L<GazelleTree>) callF(optPar sendToModules(_), input));
11  
      
12  
    L<GazelleTree> l = gazelle_reasonWithPreAndPost(input, paramsMinus(_, 'sendToModules));
13  
    
14  
    // commit to one entry
15  
    
16  
    if (empty(l)) continue;
17  
    gazelle_sortBeforeCommit(l, _);
18  
    
19  
    GazelleTree t = first(l);
20  
    if (boolPar debug(_) || boolPar debugCommit(_))
21  
      print("Committing to: " + t.line + " (out of " + l(l) + ")");
22  
23  
    RuleEngine2.Rule r = t.rule();
24  
    if (r == null || !contains(r.outTypes, "process"))
25  
      continue with out.add(t); // normal line
26  
      
27  
    // separate lines & add to queue
28  
    
29  
    LS lines = tok_splitAtPlusAtBeginningOfLine(t.line);
30  
    for i over lines: {
31  
      S line = lines.get(i);
32  
      if (eqGet(r.outTypes, i, "process"))
33  
        addWithTesterSet(queue, seen, line);
34  
      else {
35  
        t.line = line;
36  
        out.add(t);
37  
        t = null;
38  
      }
39  
    }
40  
  }
41  
  
42  
  ret out;
43  
}

Author comment

Began life as a copy of #1022481

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1022572
Snippet name: gazelle_reason_repeat_v2 - handle multiple [process] lines, dev.
Eternal ID of this version: #1022572/7
Text MD5: 27016b4d0a9bb4ad493ee8db0fb839ab
Author: stefan
Category: javax / gazelle
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-22 16:48:27
Source code size: 1232 bytes / 43 lines
Pitched / IR pitched: No / No
Views / Downloads: 194 / 240
Version history: 6 change(s)
Referenced in: [show references]