38 private final int i;
39 private final double d;
40 private final String s;
41 private final List<String> l;
42 Value() {
43 this.i = 0;
44 this.d = 0;
45 this.s = "default";
46 this.l = List.of();
47 }
48 public static Value make(int i, double d, String s, String... items) {
49 Value v = Value.default;
50 v = __WithField(v.i, i);
51 v = __WithField(v.d, d);
52 v = __WithField(v.s, s);
53 v = __WithField(v.l, List.of(items));
54 return v;
55 }
56
57 private List<Object> values() {
58 return List.of(Value.class.asValueType(), i, d, s, l);
59 }
60
61 public int localHashCode() {
62 return values().hashCode();
63 }
64
65 public String localToString() {
66 System.out.println(l);
67 return String.format("[%s i=%s d=%s s=%s l=%s]", Value.class.getName(),
68 i, String.valueOf(d), s, l.toString());
69 }
70 }
71
72 private static void assertEquals(Object o1, Object expected) {
73 if (!Objects.equals(o1, expected)) {
74 throw new RuntimeException(o1 + " expected: " + expected);
75 }
76 }
77
78 public static void main(String... args) throws Throwable {
|
38 private final int i;
39 private final double d;
40 private final String s;
41 private final List<String> l;
42 Value() {
43 this.i = 0;
44 this.d = 0;
45 this.s = "default";
46 this.l = List.of();
47 }
48 public static Value make(int i, double d, String s, String... items) {
49 Value v = Value.default;
50 v = __WithField(v.i, i);
51 v = __WithField(v.d, d);
52 v = __WithField(v.s, s);
53 v = __WithField(v.l, List.of(items));
54 return v;
55 }
56
57 private List<Object> values() {
58 return List.of(Value.class, i, d, s, l);
59 }
60
61 public int localHashCode() {
62 return values().hashCode();
63 }
64
65 public String localToString() {
66 System.out.println(l);
67 return String.format("[%s i=%s d=%s s=%s l=%s]", Value.class.getName(),
68 i, String.valueOf(d), s, l.toString());
69 }
70 }
71
72 private static void assertEquals(Object o1, Object expected) {
73 if (!Objects.equals(o1, expected)) {
74 throw new RuntimeException(o1 + " expected: " + expected);
75 }
76 }
77
78 public static void main(String... args) throws Throwable {
|