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

15
LINES

< > BotCompany Repo | #1010246 // web_makeTree - walk through web and make WebTree

JavaX fragment (include)

1  
static WebTree web_makeTree(WebNode node) {
2  
  if (node == null) null;
3  
  WebTree tree = new(node);
4  
  web_makeTree_impl(tree, new HashSet);
5  
  ret tree;
6  
}
7  
8  
static void web_makeTree_impl(WebTree tree, HashSet<WebNode> seen) {
9  
  if (!seen.add(tree.node)) ret;
10  
  for (WebNode n : web_forwardRelated(tree.node)) {
11  
    WebTree tree2 = new(n);
12  
    tree.children.add(pair(tree.node.web.getRelation(tree.node, n), tree2));
13  
    web_makeTree_impl(tree2, seen);
14  
  }
15  
}

Author comment

Began life as a copy of #1010241

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: #1010246
Snippet name: web_makeTree - walk through web and make WebTree
Eternal ID of this version: #1010246/3
Text MD5: 9b678a4494961e65fb48c6a2731ba3e7
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-09-07 18:28:43
Source code size: 467 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 373 / 413
Version history: 2 change(s)
Referenced in: [show references]