Download Jar. Libraryless. Click here for Pure Java version (15156L/108K).
1 | !7 |
2 | |
3 | sS pattern = [[ |
4 | CirclesAndLines(circles=[Circle(text="An operation", traits=[], x=d("0.27"), y=d("0.48")), Circle(text="A standard function", traits=[], x=d("0.72"), y=d("0.48"))], lines=[Arrow(a=t5, b=t31, text="is done by", traits=[])], title="An operation")
|
5 | ]]; |
6 | |
7 | sS input = [[ |
8 | CirclesAndLines(circles=[Circle(text="\"Loading a snippet\"", traits=[], x=d("0.27"), y=d("0.48")), Circle(text="loadSnippet", traits=[], x=d("0.72"), y=d("0.48")), Circle(text="one argument", traits=[], x=d("0.49"), y=d("0.74")), Circle(text="a snippet ID", traits=[], x=d("0.72"), y=d("0.74"))], lines=[Arrow(a=t5, b=t31, text="is done by", traits=[]), Arrow(a=t5, b=t57, text="takes", traits=[]), Arrow(a=t57, b=t83, text="which is", traits=[])], title="\"Loading a snippet\"")
|
9 | ]]; |
10 | |
11 | sS then = [[ |
12 | CirclesAndLines(circles=[Circle(text="An operation", traits=[], x=d("0.27"), y=d("0.48")), Circle(text="some time", traits=[], x=d("0.69"), y=d("0.48"))], lines=[Arrow(a=t5, b=t31, text="takes", traits=[])], title="An operation")
|
13 | ]]; |
14 | |
15 | |
16 | p {
|
17 | Web patternWeb = parseWeb(pattern); |
18 | Web inputWeb = parseWeb(input), originalInputWeb = cloneWeb(inputWeb); |
19 | Web thenWeb = parseWeb(then); |
20 | |
21 | Map<WebNode> match = web_matchAllPerms_partial(patternWeb, inputWeb, Double.NaN); |
22 | print("Score: " + web_matchAllPerms_partial_score!);
|
23 | print("Match: " + match);
|
24 | web_addLabelsFromNodeToNode(match); |
25 | pnl(match); |
26 | Web step4 = cloneWeb(inputWeb); |
27 | Pair<WebNode> p = web_bestNodeMatch(thenWeb, step4); |
28 | if (p != null) |
29 | web_copyUsingPartialMap(thenWeb, step4, litmap(p.a, p.b)); |
30 | |
31 | CirclesAndLines.staticPopupExtender = voidfunc(final CirclesAndLines cal, final Canvas canvas, JPopupMenu menu) {
|
32 | addMenuItem(menu, jmenu("Operations",
|
33 | "First labels only", r { cal_dropSecondaryLabels(cal); canvas.update(); }));
|
34 | }; |
35 | |
36 | showTabbedWebs("Pattern", patternWeb, "Input", originalInputWeb, "Result", inputWeb, "Then", step4);
|
37 | print(ai_allUnclearLabels()); |
38 | } |
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: | #1010593 |
| Snippet name: | Match & Copy Labels [dev.] |
| Eternal ID of this version: | #1010593/12 |
| Text MD5: | 6a94cfce87b7c6c92f621d822645f500 |
| Transpilation MD5: | 50b5a4daf919918d00efa0ae6e320ed2 |
| Author: | stefan |
| Category: | javax / a.i. |
| Type: | JavaX source code (desktop) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2017-09-22 19:15:17 |
| Source code size: | 1990 bytes / 38 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 854 / 1987 |
| Version history: | 11 change(s) |
| Referenced in: | [show references] |