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

24
LINES

< > BotCompany Repo | #1008820 // printExplainTree2_filterClasses

JavaX fragment (include)

// filter: S -> bool
static void printExplainTree2_filterClasses(Explain e, O filter) {
  printExplainTree2_filterClasses(0, e, filter);
}

static void printExplainTree2_filterClasses(int indent, Explain e, O filter) {
  bool printNulls = false;
  
  if (e == null) {
    // this would print "null" for every <identifier> etc
    if (printNulls)
      print(indent(indent) + "null");
  } else {
    new L<S> classNames;
    while true {
      addIfMatchesPredicate(classNames, e.className(), filter);
      if (!e.singleEqualChild()) break;
      e = e.sub(0);
    }
    print(indent(indent) + join(", ", classNames) + " | " + e.string());
    for (Explain sub : e.subs)
      printExplainTree2_filterClasses(indent+2, sub, filter);
  }
}

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: 519 / 611
Version history: 2 change(s)
Referenced in: [show references]