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

17
LINES

< > BotCompany Repo | #1010445 // web_mergeNodesByFirstLabelIC

JavaX fragment (include)

sbool web_mergeNodesByFirstLabelIC_debug;

static void web_mergeNodesByFirstLabelIC(Web web) {
  web_check(web);
  Map<S, WebNode> index = caseInsensitiveMap();
  for (WebNode node : web.nodes)
    if (!(node instanceof WebRelation) && nempty(node.labels)) index.put(web.unparseLabel(first(node.labels)), node);
  
  for (WebNode node : cloneList(web.nodes)) if (!(node instanceof WebRelation) && nempty(node.labels)) {
    WebNode n = index.get(web.unparseLabel(first(node.labels)));
    if (n == node) continue;
    if (web_mergeNodesByFirstLabelIC_debug)
      print("Collapsing: " + node + " => " + n);
    web_collapseNodeTo(node, n);
  }
  web_check(web);
}

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: 392 / 439
Version history: 3 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)