1 | // nodeMatcher: func(WebNode, WebNode) -> double |
2 | static Map<WebNode> web_matchAllPerms_x(Web patternWeb, Web inputWeb, O nodeMatcher) { |
3 | L<WebNode> patternNodes = web_nodes(patternWeb); |
4 | L<WebNode> inputNodes = web_nodes(inputWeb); |
5 | if (l(patternNodes) != l(inputNodes)) |
6 | null; |
7 | //fail("Can't match, differing number of nodes: " + l(patternNodes) + "/" + l(inputNodes)); |
8 | |
9 | LL<WebNode> perms = allPermutations(inputNodes); |
10 | new Best<L<WebNode>> best; |
11 | for (L<WebNode> perm : perms) |
12 | best.put(perm, web_matchNodeLists_x(patternNodes, perm, nodeMatcher)); |
13 | L<WebNode> l = best.getIfScoreAbove(0); |
14 | ret l == null ? null : twoListsToOrderedMap(patternNodes, l); |
15 | } |
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: | 422 / 452 |
Version history: | 1 change(s) |
Referenced in: | [show references] |