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

10
LINES

< > BotCompany Repo | #1010251 // webTree_sortChildren - sorts by (relation text, node text) - modifies original tree

JavaX fragment (include)

static WebTree webTree_sortChildren(WebTree tree) {
  sortList(tree.children, makeComparator(func(Pair<WebNode, WebTree> a, Pair<WebNode, WebTree> b) {
    int i = stdCompare(web_text(a.a), web_text(b.a));
    if (i != 0) ret i;
    ret stdCompare(web_text(a.b.node), web_text(b.b.node));
  }));
  for (Pair<WebNode, WebTree> p : tree.children)
    webTree_sortChildren(p.b);
  ret tree;
}

Author comment

Began life as a copy of #1010249

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: #1010251
Snippet name: webTree_sortChildren - sorts by (relation text, node text) - modifies original tree
Eternal ID of this version: #1010251/1
Text MD5: 8eddc353bedd32be27bc6030ca4ef631
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:41:43
Source code size: 398 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 378 / 421
Referenced in: [show references]