Download Jar. Libraryless. Click here for Pure Java version (7438L/54K).
1 | !7 |
2 | |
3 | p-exp {
|
4 | ObjectNode root = new(mL("English sentence patterns"));
|
5 | |
6 | //processNode_recursive(root, 10); |
7 | ct_process_firstOnly(root, 10, 'ct_objectNodeToListNode); |
8 | |
9 | showFrame(jDynamicTree(root, ct_getChildren())); |
10 | } |
11 | |
12 | svoid ct_process_firstOnly(CTNode n, int depthCounter, S... functions) {
|
13 | if (n == null || depthCounter <= 0) ret; |
14 | if (nempty(n.children)) ret; |
15 | |
16 | for (S f : functions) {
|
17 | if (nempty(n.children)) ret; |
18 | pcallF(f, n); |
19 | } |
20 | |
21 | ct_process_firstOnly(first(n.children), depthCounter-1, functions); |
22 | } |
23 | |
24 | svoid ct_objectNodeToListNode(CTNode n) {
|
25 | if (n instanceof ObjectNode) {
|
26 | ObjectNode on = cast n; |
27 | O o = on.obj; |
28 | |
29 | if (o instanceof Collection) |
30 | n.add(ListNode(asList((Collection) o))); |
31 | } |
32 | } |
33 | |
34 | sclass ListNode > CTNode {
|
35 | L list; |
36 | |
37 | *() {}
|
38 | *(L *list) {}
|
39 | |
40 | S toString2() { ret sfu(list); }
|
41 | |
42 | public bool equals(O o) { ret stdEq(this, o, 'list); }
|
43 | public int hashCode() { ret stdHash(this, 'list); }
|
44 | } |
Began life as a copy of #1017536
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1017538 |
| Snippet name: | Computation Tree On Lists [dev.] |
| Eternal ID of this version: | #1017538/6 |
| Text MD5: | 82c49d7e4f9166ee4b5c1627e4374691 |
| Transpilation MD5: | c78327c649da76a1aee4b6dec04c3ae0 |
| Author: | stefan |
| Category: | javax / a.i. |
| Type: | JavaX source code (desktop) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2018-07-26 14:08:35 |
| Source code size: | 1008 bytes / 44 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 601 / 1348 |
| Version history: | 5 change(s) |
| Referenced in: | [show references] |