// nodeMatcher: func(WebNode, WebNode) -> double static Map<WebNode> web_matchAllPerms_x(Web patternWeb, Web inputWeb, O nodeMatcher) { L<WebNode> patternNodes = web_nodes(patternWeb); L<WebNode> inputNodes = web_nodes(inputWeb); if (l(patternNodes) != l(inputNodes)) null; //fail("Can't match, differing number of nodes: " + l(patternNodes) + "/" + l(inputNodes)); LL<WebNode> perms = allPermutations(inputNodes); new Best<L<WebNode>> best; for (L<WebNode> perm : perms) best.put(perm, web_matchNodeLists_x(patternNodes, perm, nodeMatcher)); L<WebNode> l = best.getIfScoreAbove(0); ret l == null ? null : twoListsToOrderedMap(patternNodes, l); }
Began life as a copy of #1010329
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: | #1010801 |
Snippet name: | web_matchAllPerms_x - matches two webs in all permutations; returns null unless perfect match; with node matcher |
Eternal ID of this version: | #1010801/2 |
Text MD5: | 5b88b1d386c48ae855a68087be1d2519 |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-10-03 21:18:28 |
Source code size: | 691 bytes / 15 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 423 / 453 |
Version history: | 1 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1010803 - web_matchAllPerms_x_bestScore #1011891 - web_matchTriple_dollarVars - does not handle repeating vars (a == c == "$X") |