github.com/thommil/tge-mobile@v0.0.0-20190308225214-66a08abd51aa/bind/testdata/structs.java.golden (about) 1 // Java class structs.S is a proxy for talking to a Go program. 2 // gobind -lang=java structs 3 // 4 // File is generated by gobind. Do not edit. 5 package structs; 6 7 import go.Seq; 8 9 public final class S implements Seq.Proxy { 10 static { Structs.touch(); } 11 12 private final int refnum; 13 14 @Override public final int incRefnum() { 15 Seq.incGoRef(refnum, this); 16 return refnum; 17 } 18 19 S(int refnum) { this.refnum = refnum; Seq.trackGoRef(refnum, this); } 20 21 public S() { this.refnum = __New(); Seq.trackGoRef(refnum, this); } 22 23 private static native int __New(); 24 25 public final native double getX(); 26 public final native void setX(double v); 27 28 public final native double getY(); 29 public final native void setY(double v); 30 31 public native S identity() throws Exception; 32 public native double sum(); 33 @Override public boolean equals(Object o) { 34 if (o == null || !(o instanceof S)) { 35 return false; 36 } 37 S that = (S)o; 38 double thisX = getX(); 39 double thatX = that.getX(); 40 if (thisX != thatX) { 41 return false; 42 } 43 double thisY = getY(); 44 double thatY = that.getY(); 45 if (thisY != thatY) { 46 return false; 47 } 48 return true; 49 } 50 51 @Override public int hashCode() { 52 return java.util.Arrays.hashCode(new Object[] {getX(), getY()}); 53 } 54 55 @Override public String toString() { 56 StringBuilder b = new StringBuilder(); 57 b.append("S").append("{"); 58 b.append("X:").append(getX()).append(","); 59 b.append("Y:").append(getY()).append(","); 60 return b.append("}").toString(); 61 } 62 } 63 64 // Java class structs.S2 is a proxy for talking to a Go program. 65 // gobind -lang=java structs 66 // 67 // File is generated by gobind. Do not edit. 68 package structs; 69 70 import go.Seq; 71 72 public final class S2 implements Seq.Proxy, I { 73 static { Structs.touch(); } 74 75 private final int refnum; 76 77 @Override public final int incRefnum() { 78 Seq.incGoRef(refnum, this); 79 return refnum; 80 } 81 82 S2(int refnum) { this.refnum = refnum; Seq.trackGoRef(refnum, this); } 83 84 public S2() { this.refnum = __New(); Seq.trackGoRef(refnum, this); } 85 86 private static native int __New(); 87 88 public native void m(); 89 public native String string(); 90 @Override public boolean equals(Object o) { 91 if (o == null || !(o instanceof S2)) { 92 return false; 93 } 94 S2 that = (S2)o; 95 return true; 96 } 97 98 @Override public int hashCode() { 99 return java.util.Arrays.hashCode(new Object[] {}); 100 } 101 102 @Override public String toString() { 103 return string(); 104 } 105 } 106 107 // Java class structs.Structs_ is a proxy for talking to a Go program. 108 // gobind -lang=java structs 109 // 110 // File is generated by gobind. Do not edit. 111 package structs; 112 113 import go.Seq; 114 115 public final class Structs_ implements Seq.Proxy, I { 116 static { Structs.touch(); } 117 118 private final int refnum; 119 120 @Override public final int incRefnum() { 121 Seq.incGoRef(refnum, this); 122 return refnum; 123 } 124 125 Structs_(int refnum) { this.refnum = refnum; Seq.trackGoRef(refnum, this); } 126 127 public Structs_() { this.refnum = __New(); Seq.trackGoRef(refnum, this); } 128 129 private static native int __New(); 130 131 public native void m(); 132 @Override public boolean equals(Object o) { 133 if (o == null || !(o instanceof Structs_)) { 134 return false; 135 } 136 Structs_ that = (Structs_)o; 137 return true; 138 } 139 140 @Override public int hashCode() { 141 return java.util.Arrays.hashCode(new Object[] {}); 142 } 143 144 @Override public String toString() { 145 StringBuilder b = new StringBuilder(); 146 b.append("Structs_").append("{"); 147 return b.append("}").toString(); 148 } 149 } 150 151 // Java class structs.I is a proxy for talking to a Go program. 152 // gobind -lang=java structs 153 // 154 // File is generated by gobind. Do not edit. 155 package structs; 156 157 import go.Seq; 158 159 public interface I { 160 public void m(); 161 162 } 163 164 // Java class structs.Structs is a proxy for talking to a Go program. 165 // gobind -lang=java structs 166 // 167 // File is generated by gobind. Do not edit. 168 package structs; 169 170 import go.Seq; 171 172 public abstract class Structs { 173 static { 174 Seq.touch(); // for loading the native library 175 _init(); 176 } 177 178 private Structs() {} // uninstantiable 179 180 // touch is called from other bound packages to initialize this package 181 public static void touch() {} 182 183 private static native void _init(); 184 185 private static final class proxyI implements Seq.Proxy, I { 186 private final int refnum; 187 188 @Override public final int incRefnum() { 189 Seq.incGoRef(refnum, this); 190 return refnum; 191 } 192 193 proxyI(int refnum) { this.refnum = refnum; Seq.trackGoRef(refnum, this); } 194 195 public native void m(); 196 } 197 198 199 public static native S identity(S s); 200 public static native S identityWithError(S s) throws Exception; 201 }