1 | abstract sclass CTNode { |
2 | new LinkedHashSet<CTNode> children; |
3 | |
4 | toString { ret joinNemptiesWithColonSpace(shortClassName(this), toString2()); } |
5 | S toString2() { ret ""; } // override me |
6 | |
7 | bool add(CTNode n) { ret children.add(n); } |
8 | } |
9 | |
10 | sclass ObjectNode<A> extends CTNode { |
11 | A obj; |
12 | |
13 | *() {} |
14 | *(A *obj) {} |
15 | |
16 | S toString2() { ret sfu(obj); } |
17 | |
18 | public bool equals(O o) { ret stdEq(this, o, 'obj); } |
19 | public int hashCode() { ret stdHash(this, 'obj); } |
20 | } |
21 | |
22 | sclass OpNode > CTNode { |
23 | S op; |
24 | bool haveResult; |
25 | O result; // this is the result coming back up from the operation |
26 | |
27 | *() {} |
28 | *(S *op) {} |
29 | |
30 | S toString2() { ret haveResult ? result + " <- " + op : op; } |
31 | |
32 | public bool equals(O o) { ret stdEq(this, o, 'op); } |
33 | public int hashCode() { ret stdHash(this, 'op); } |
34 | |
35 | void setResult(O o) { |
36 | result = o; |
37 | haveResult = true; |
38 | } |
39 | } |
Began life as a copy of #1017535
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1017600 |
Snippet name: | Computation Tree Include v2 |
Eternal ID of this version: | #1017600/4 |
Text MD5: | 544e650b820088f6fbc46a2ba1f7bb32 |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-07-29 17:28:46 |
Source code size: | 901 bytes / 39 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 353 / 524 |
Version history: | 3 change(s) |
Referenced in: | [show references] |