sbool printConceptGraph_showIDs; static void printConceptGraph(Concept c) { printConceptGraph_impl(c, 0, "", new IdentityHashMap); } static void printConceptGraph_impl(Concept c, int indent, S prefix, IdentityHashMap seen) { bool isSeen = seen.containsKey(c); seen.put(c, c); StringBuilder buf = new StringBuilder; buf.append(prefix); S cname = dynamicShortName(c); if (eq(cname, "Str")) buf.append("Str " + quote(cget(c, "name"))); else { buf.append(cname); if (printConceptGraph_showIDs) buf.append(" [" + c.id + (isSeen ? ", seen" : "") + "]"); else if (isSeen) buf.append(" [seen]"); for (S field : conceptFields(c)) { O val = cget(c, field); if (val != null && !val instanceof Concept) buf.append(" " + field + "=" + struct(val)); } } printIndent(indent, buf); if (isSeen) ret; L<S> names = dynGetRefNames(c); for (S name : names) { Concept val = cast cget(c, name); if (eq(name, "_if")) name = "if"; // prettify printConceptGraph_impl(val, indent + 2, l(names) == 1 ? "" : name + "=", seen); } }
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1005466 |
Snippet name: | printConceptGraph |
Eternal ID of this version: | #1005466/1 |
Text MD5: | 1fc41bf3e476776522d173dc96c2d45c |
Author: | stefan |
Category: | javax / concepts |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-11-20 13:32:08 |
Source code size: | 1145 bytes / 38 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 524 / 512 |
Referenced in: | [show references] |