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

17
LINES

< > BotCompany Repo | #1010445 // web_mergeNodesByFirstLabelIC

JavaX fragment (include)

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

Author comment

Began life as a copy of #1009979

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: #1010445
Snippet name: web_mergeNodesByFirstLabelIC
Eternal ID of this version: #1010445/4
Text MD5: 23f15372a822b79c39bf9831d97bd343
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-18 01:00:12
Source code size: 679 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 393 / 441
Version history: 3 change(s)
Referenced in: [show references]