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

14
LINES

< > BotCompany Repo | #1010329 // web_matchAllPerms - matches two webs in all permutations; returns null unless perfect match

JavaX fragment (include)

1  
static Map<WebNode> web_matchAllPerms(Web patternWeb, Web inputWeb) {
2  
  L<WebNode> patternNodes = web_nodes(patternWeb);
3  
  L<WebNode> inputNodes = web_nodes(inputWeb);
4  
  if (l(patternNodes) != l(inputNodes))
5  
    null;
6  
    //fail("Can't match, differing number of nodes: " + l(patternNodes) + "/" + l(inputNodes));
7  
  
8  
  LL<WebNode> perms = allPermutations(inputNodes);
9  
  new Best<L<WebNode>> best;
10  
  for (L<WebNode> perm : perms)
11  
    best.put(perm, web_matchNodeLists(patternNodes, perm));
12  
  L<WebNode> l = best.getIfScoreAbove(0);
13  
  ret l == null ? null : twoListsToOrderedMap(patternNodes, l);
14  
}

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: #1010329
Snippet name: web_matchAllPerms - matches two webs in all permutations; returns null unless perfect match
Eternal ID of this version: #1010329/4
Text MD5: 7f7bd2d2b662da9706dc0b329ba5bb6c
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-11 21:55:30
Source code size: 609 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 515 / 538
Version history: 3 change(s)
Referenced in: [show references]