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

24
LINES

< > BotCompany Repo | #1008820 // printExplainTree2_filterClasses

JavaX fragment (include)

1  
// filter: S -> bool
2  
static void printExplainTree2_filterClasses(Explain e, O filter) {
3  
  printExplainTree2_filterClasses(0, e, filter);
4  
}
5  
6  
static void printExplainTree2_filterClasses(int indent, Explain e, O filter) {
7  
  bool printNulls = false;
8  
  
9  
  if (e == null) {
10  
    // this would print "null" for every <identifier> etc
11  
    if (printNulls)
12  
      print(indent(indent) + "null");
13  
  } else {
14  
    new L<S> classNames;
15  
    while true {
16  
      addIfMatchesPredicate(classNames, e.className(), filter);
17  
      if (!e.singleEqualChild()) break;
18  
      e = e.sub(0);
19  
    }
20  
    print(indent(indent) + join(", ", classNames) + " | " + e.string());
21  
    for (Explain sub : e.subs)
22  
      printExplainTree2_filterClasses(indent+2, sub, filter);
23  
  }
24  
}

Author comment

Began life as a copy of #1008819

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: #1008820
Snippet name: printExplainTree2_filterClasses
Eternal ID of this version: #1008820/3
Text MD5: 99378d35959a968b49d9b8647ff7aa4d
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-06-09 04:00:13
Source code size: 761 bytes / 24 lines
Pitched / IR pitched: No / No
Views / Downloads: 522 / 616
Version history: 2 change(s)
Referenced in: [show references]