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

17
LINES

< > BotCompany Repo | #1009979 // web_mergeNodesByFirstLabel

JavaX fragment (include)

1  
sbool web_mergeNodesByFirstLabel_debug;
2  
3  
static void web_mergeNodesByFirstLabel(Web web) {
4  
  web_check(web);
5  
  new HashMap<Lisp, WebNode> index;
6  
  for (WebNode node : web.nodes)
7  
    if (!(node instanceof WebRelation) && nempty(node.labels)) index.put(first(node.labels), node);
8  
  
9  
  for (WebNode node : cloneList(web.nodes)) if (!(node instanceof WebRelation) && nempty(node.labels)) {
10  
    WebNode n = index.get(first(node.labels));
11  
    if (n == node) continue;
12  
    if (web_mergeNodesByFirstLabel_debug)
13  
      print("Collapsing: " + node + " => " + n);
14  
    web_collapseNodeTo(node, n);
15  
  }
16  
  web_check(web);
17  
}

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: #1009979
Snippet name: web_mergeNodesByFirstLabel
Eternal ID of this version: #1009979/6
Text MD5: 4d444158b15ce6d4dfe70dae0b6a9d9b
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-02 01:08:38
Source code size: 625 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 566 / 612
Version history: 5 change(s)
Referenced in: [show references]