| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
package h; |
| 47 |
|
| 48 |
import java.util.ArrayList; |
| 49 |
import java.util.List; |
| 50 |
|
| 51 |
import smetana.core.CString; |
| 52 |
import smetana.core.HardcodedStruct; |
| 53 |
import smetana.core.UnsupportedArrayOfStruct2; |
| 54 |
import smetana.core.UnsupportedStructAndPtr; |
| 55 |
import smetana.core.__array_of_ptr__; |
| 56 |
import smetana.core.__ptr__; |
| 57 |
import smetana.core.__struct__; |
| 58 |
import smetana.core.size_t; |
| 59 |
import smetana.core.amiga.Area; |
| 60 |
import smetana.core.amiga.StarStruct; |
| 61 |
|
| 62 |
public class ST_pointf extends UnsupportedStructAndPtr implements HardcodedStruct { |
| 63 |
|
| 64 |
public double x; |
| 65 |
public double y; |
| 66 |
|
| 67 |
@Override |
| 68 |
public boolean isSameThan(StarStruct other) { |
| 69 |
return this==(ST_pointf)other; |
| 70 |
} |
| 71 |
|
| 72 |
public static class Array extends UnsupportedArrayOfStruct2 implements __ptr__, |
| 73 |
__array_of_ptr__ { |
| 74 |
|
| 75 |
private final List<ST_pointf> data; |
| 76 |
private final int pos; |
| 77 |
|
| 78 |
@Override |
| 79 |
public void setStruct(__struct__ value) { |
| 80 |
getStruct().___(value); |
| 81 |
} |
| 82 |
|
| 83 |
@Override |
| 84 |
public Array asPtr() { |
| 85 |
return this; |
| 86 |
} |
| 87 |
|
| 88 |
@Override |
| 89 |
public void setDouble(String fieldName, double value) { |
| 90 |
getStruct().setDouble(fieldName, value); |
| 91 |
} |
| 92 |
|
| 93 |
@Override |
| 94 |
public ST_pointf getStruct() { |
| 95 |
return get(0).getStruct(); |
| 96 |
} |
| 97 |
|
| 98 |
@Override |
| 99 |
public ST_pointf getPtr() { |
| 100 |
return get(0); |
| 101 |
} |
| 102 |
|
| 103 |
public Array(int size) { |
| 104 |
this.data = new ArrayList<ST_pointf>(); |
| 105 |
this.pos = 0; |
| 106 |
for (int i = 0; i < size; i++) { |
| 107 |
data.add(new ST_pointf()); |
| 108 |
} |
| 109 |
} |
| 110 |
|
| 111 |
public Array reallocJ(int newsize) { |
| 112 |
while (data.size() < newsize) { |
| 113 |
data.add(new ST_pointf()); |
| 114 |
} |
| 115 |
return this; |
| 116 |
} |
| 117 |
|
| 118 |
public Array plus(int delta) { |
| 119 |
return plusJ(delta); |
| 120 |
} |
| 121 |
|
| 122 |
private Array(List<ST_pointf> data, int pos) { |
| 123 |
this.data = data; |
| 124 |
this.pos = pos; |
| 125 |
} |
| 126 |
|
| 127 |
public ST_pointf get(int i) { |
| 128 |
return this.data.get(pos + i); |
| 129 |
} |
| 130 |
|
| 131 |
public Array plusJ(int i) { |
| 132 |
return new Array(data, pos + i); |
| 133 |
} |
| 134 |
|
| 135 |
public int minus(Array other) { |
| 136 |
if (this.data != other.data) { |
| 137 |
throw new IllegalArgumentException(); |
| 138 |
} |
| 139 |
return this.pos - other.pos; |
| 140 |
} |
| 141 |
|
| 142 |
public Array move(int delta) { |
| 143 |
throw new UnsupportedOperationException(getClass().toString()); |
| 144 |
} |
| 145 |
|
| 146 |
public void realloc(size_t nb) { |
| 147 |
throw new UnsupportedOperationException(getClass().toString()); |
| 148 |
} |
| 149 |
|
| 150 |
public int comparePointerInternal(__array_of_ptr__ other) { |
| 151 |
throw new UnsupportedOperationException(getClass().toString()); |
| 152 |
} |
| 153 |
|
| 154 |
public void setCString(CString value) { |
| 155 |
throw new UnsupportedOperationException(getClass().toString()); |
| 156 |
} |
| 157 |
|
| 158 |
} |
| 159 |
|
| 160 |
public static ST_pointf[] malloc(int nb) { |
| 161 |
final ST_pointf result[] = new ST_pointf[nb]; |
| 162 |
for (int i = 0; i < nb; i++) { |
| 163 |
result[i] = new ST_pointf(); |
| 164 |
} |
| 165 |
return result; |
| 166 |
} |
| 167 |
|
| 168 |
public static ST_pointf[] realloc(ST_pointf[] old, int nb) { |
| 169 |
if (nb <= old.length) { |
| 170 |
return old; |
| 171 |
} |
| 172 |
final ST_pointf result[] = new ST_pointf[nb]; |
| 173 |
for (int i = 0; i < nb; i++) { |
| 174 |
result[i] = i < old.length ? old[i] : new ST_pointf(); |
| 175 |
} |
| 176 |
return result; |
| 177 |
} |
| 178 |
|
| 179 |
public ST_pointf() { |
| 180 |
this(null); |
| 181 |
} |
| 182 |
|
| 183 |
|
| 184 |
@Override |
| 185 |
public ST_pointf copy() { |
| 186 |
final ST_pointf result = new ST_pointf(); |
| 187 |
result.x = this.x; |
| 188 |
result.y = this.y; |
| 189 |
return result; |
| 190 |
} |
| 191 |
|
| 192 |
@Override |
| 193 |
public void setStruct(__struct__ value) { |
| 194 |
final ST_pointf other2 = (ST_pointf) value; |
| 195 |
this.x = other2.x; |
| 196 |
this.y = other2.y; |
| 197 |
} |
| 198 |
|
| 199 |
@Override |
| 200 |
public void copyDataFrom(__ptr__ value) { |
| 201 |
final ST_pointf other2 = (ST_pointf) value; |
| 202 |
this.x = other2.x; |
| 203 |
this.y = other2.y; |
| 204 |
} |
| 205 |
|
| 206 |
@Override |
| 207 |
public ST_pointf getStruct() { |
| 208 |
return this; |
| 209 |
} |
| 210 |
|
| 211 |
@Override |
| 212 |
public void memcopyFrom(Area source) { |
| 213 |
|
| 214 |
|
| 215 |
|
| 216 |
|
| 217 |
|
| 218 |
|
| 219 |
|
| 220 |
final ST_pointf other2 = (ST_pointf) source; |
| 221 |
this.x = other2.x; |
| 222 |
this.y = other2.y; |
| 223 |
} |
| 224 |
|
| 225 |
@Override |
| 226 |
public void ___(__struct__ other) { |
| 227 |
final ST_pointf other2 = (ST_pointf) other; |
| 228 |
this.x = other2.x; |
| 229 |
this.y = other2.y; |
| 230 |
} |
| 231 |
|
| 232 |
@Override |
| 233 |
public void ____(__ptr__ other) { |
| 234 |
if (other instanceof ST_pointf.Array) { |
| 235 |
ST_pointf.Array other2 = (ST_pointf.Array) other; |
| 236 |
this.x = other2.get(0).x; |
| 237 |
this.y = other2.get(0).y; |
| 238 |
return; |
| 239 |
} |
| 240 |
|
| 241 |
|
| 242 |
|
| 243 |
|
| 244 |
|
| 245 |
|
| 246 |
|
| 247 |
|
| 248 |
|
| 249 |
|
| 250 |
|
| 251 |
|
| 252 |
|
| 253 |
|
| 254 |
|
| 255 |
|
| 256 |
|
| 257 |
|
| 258 |
if (other instanceof ST_pointf) { |
| 259 |
ST_pointf other2 = (ST_pointf) other; |
| 260 |
this.x = other2.x; |
| 261 |
this.y = other2.y; |
| 262 |
return; |
| 263 |
} |
| 264 |
System.err.println("other=" + other.getClass()); |
| 265 |
System.err.println("other=" + other.getPtr().getClass()); |
| 266 |
super.____(other); |
| 267 |
} |
| 268 |
|
| 269 |
@Override |
| 270 |
public void copyDataFrom(__struct__ other) { |
| 271 |
final ST_pointf other2 = (ST_pointf) other; |
| 272 |
this.x = other2.x; |
| 273 |
this.y = other2.y; |
| 274 |
} |
| 275 |
|
| 276 |
@Override |
| 277 |
public void setDouble(String fieldName, double data) { |
| 278 |
if (fieldName.equals("x")) { |
| 279 |
this.x = data; |
| 280 |
return; |
| 281 |
} |
| 282 |
if (fieldName.equals("y")) { |
| 283 |
this.y = data; |
| 284 |
return; |
| 285 |
} |
| 286 |
super.setDouble(fieldName, data); |
| 287 |
} |
| 288 |
|
| 289 |
public ST_pointf(StarStruct parent) { |
| 290 |
} |
| 291 |
|
| 292 |
|
| 293 |
|
| 294 |
|
| 295 |
|
| 296 |
|
| 297 |
|
| 298 |
|
| 299 |
} |
| 300 |
|
| 301 |
|