// 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; } }