// union-type entry sclass E { S q, a, state; bool test; // not used anymore probably S comment; // not checked for comparison *() {} *(S text, S type) { if (eq(type, "q")) q = text; else if (eq(type, "a")) a = text; else state = text; } // does not compare the "test" bit bool eqTo(E y) { E x = this; ret eq/*ic*/(x.q, y.q) && eq/*ic*/(x.a, y.a) && eq/*ic*/(x.state, y.state); } public bool equals(O o) { ret o is a E && eqTo((E) o); } public int hashCode() { ret stdHash(this, "q", "a", "state"); } static E state(S state) { if (state == null) null; new E e; e.state = state; ret e; } static E q(S q) { if (q == null) null; new E e; e.q = q; ret e; } static E a(S a) { if (a == null) null; new E e; e.a = a; ret e; } public S toString() { ret unparsePoemLine(this); } bool q() { ret q != null; } bool a() { ret a != null; } bool state() { ret state != null; } S type() { ret q() ? "q" : a() ? "a" : "state"; } S text() { ret q() ? q : a() ? a : state; } }
download show line numbers debug dex old transpilations
Travelled to 18 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, imzmzdywqqli, ishqpsrjomds, jtubtzbbkimh, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, ppjhyzlbdabe, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, wtqryiryparv
No comments. add comment
Snippet ID: | #1003474 |
Snippet name: | class E (poem line) |
Eternal ID of this version: | #1003474/1 |
Text MD5: | 674547dfda2785f0abf5233e1ffc5fea |
Author: | stefan |
Category: | javax / talking robots |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-07-05 17:58:05 |
Source code size: | 1128 bytes / 49 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 683 / 4160 |
Referenced in: | [show references] |