| 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.HardcodedStruct; |
| 52 |
import smetana.core.OFFSET; |
| 53 |
import smetana.core.UnsupportedArrayOfPtr; |
| 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.amiga.StarStruct; |
| 59 |
|
| 60 |
public class ST_Agedge_s extends UnsupportedStructAndPtr implements HardcodedStruct { |
| 61 |
|
| 62 |
private final StarStruct parent; |
| 63 |
|
| 64 |
public final ST_Agobj_s base = new ST_Agobj_s(this); |
| 65 |
public final ST_dtlink_s id_link = new ST_dtlink_s(this); |
| 66 |
public final ST_dtlink_s seq_link = new ST_dtlink_s(this); |
| 67 |
public ST_Agnode_s node; |
| 68 |
|
| 69 |
public static class ArrayOfStar extends UnsupportedArrayOfPtr implements __ptr__, __array_of_ptr__ { |
| 70 |
|
| 71 |
private final List<ST_Agedge_s> data; |
| 72 |
private final int pos; |
| 73 |
|
| 74 |
public ArrayOfStar(int size) { |
| 75 |
this.data = new ArrayList<ST_Agedge_s>(); |
| 76 |
this.pos = 0; |
| 77 |
for (int i = 0; i < size; i++) { |
| 78 |
data.add(null); |
| 79 |
} |
| 80 |
} |
| 81 |
|
| 82 |
public void swap(int i, int j) { |
| 83 |
ST_Agedge_s e1 = data.get(i); |
| 84 |
ST_Agedge_s e2 = data.get(j); |
| 85 |
data.set(i, e2); |
| 86 |
data.set(j, e1); |
| 87 |
} |
| 88 |
|
| 89 |
public ArrayOfStar(List<ST_Agedge_s> data, int pos) { |
| 90 |
this.data = data; |
| 91 |
this.pos = pos; |
| 92 |
} |
| 93 |
|
| 94 |
public ArrayOfStar reallocJ(int newsize) { |
| 95 |
while (data.size() < newsize) { |
| 96 |
data.add(null); |
| 97 |
} |
| 98 |
return this; |
| 99 |
} |
| 100 |
|
| 101 |
@Override |
| 102 |
public ArrayOfStar plus(int delta) { |
| 103 |
return new ArrayOfStar(data, pos + delta); |
| 104 |
} |
| 105 |
|
| 106 |
public ST_Agedge_s get(int i) { |
| 107 |
return plus(i).getPtr(); |
| 108 |
} |
| 109 |
|
| 110 |
|
| 111 |
@Override |
| 112 |
public ArrayOfStar asPtr() { |
| 113 |
return this; |
| 114 |
} |
| 115 |
|
| 116 |
@Override |
| 117 |
public void setPtr(__ptr__ value) { |
| 118 |
this.data.set(pos, (ST_Agedge_s) value); |
| 119 |
} |
| 120 |
|
| 121 |
@Override |
| 122 |
public ST_Agedge_s getPtr() { |
| 123 |
return this.data.get(pos); |
| 124 |
} |
| 125 |
|
| 126 |
@Override |
| 127 |
public int comparePointer(__ptr__ other) { |
| 128 |
final ArrayOfStar this2 = (ArrayOfStar) other; |
| 129 |
if (this.data != this2.data) { |
| 130 |
throw new IllegalArgumentException(); |
| 131 |
} |
| 132 |
return this.pos - this2.pos; |
| 133 |
} |
| 134 |
|
| 135 |
public boolean isSameThan2(ArrayOfStar other) { |
| 136 |
if (this.data != other.data) { |
| 137 |
throw new IllegalArgumentException(); |
| 138 |
} |
| 139 |
return this.pos == other.pos; |
| 140 |
} |
| 141 |
|
| 142 |
} |
| 143 |
|
| 144 |
@Override |
| 145 |
public void copyDataFrom(__ptr__ arg) { |
| 146 |
ST_Agedge_s this2 = (ST_Agedge_s) arg; |
| 147 |
this.base.copyDataFrom((__struct__) this2.base); |
| 148 |
this.id_link.copyDataFrom((__struct__) this2.id_link); |
| 149 |
this.seq_link.copyDataFrom((__struct__) this2.seq_link); |
| 150 |
this.node = this2.node; |
| 151 |
} |
| 152 |
|
| 153 |
public ST_Agedge_s() { |
| 154 |
this(null); |
| 155 |
} |
| 156 |
|
| 157 |
public ST_Agedge_s(StarStruct parent) { |
| 158 |
this.parent = parent; |
| 159 |
} |
| 160 |
|
| 161 |
@Override |
| 162 |
public boolean isSameThan(StarStruct other) { |
| 163 |
ST_Agedge_s other2 = (ST_Agedge_s) other; |
| 164 |
return this == other2; |
| 165 |
} |
| 166 |
|
| 167 |
@Override |
| 168 |
public Object addVirtualBytes(int virtualBytes) { |
| 169 |
if (virtualBytes == 0) { |
| 170 |
return this; |
| 171 |
} |
| 172 |
OFFSET offset = OFFSET.fromInt(virtualBytes); |
| 173 |
if (offset.toString().equals("h.ST_Agedge_s::seq_link")) { |
| 174 |
return seq_link; |
| 175 |
} |
| 176 |
if (offset.toString().equals("h.ST_Agedge_s::id_link")) { |
| 177 |
return id_link; |
| 178 |
} |
| 179 |
System.err.println("offset2=" + offset); |
| 180 |
return super.addVirtualBytes(virtualBytes); |
| 181 |
} |
| 182 |
|
| 183 |
@Override |
| 184 |
public ST_Agedge_s plus(int pointerMove) { |
| 185 |
ST_Agedgepair_s pair = (ST_Agedgepair_s) parent; |
| 186 |
|
| 187 |
if (pair.out == this && pointerMove == 1) { |
| 188 |
return pair.in; |
| 189 |
} |
| 190 |
if (pair.in == this && pointerMove == -1) { |
| 191 |
return pair.out; |
| 192 |
} |
| 193 |
throw new UnsupportedOperationException(); |
| 194 |
} |
| 195 |
|
| 196 |
@Override |
| 197 |
public __ptr__ castTo(Class dest) { |
| 198 |
if (dest == ST_Agobj_s.class) { |
| 199 |
return base; |
| 200 |
} |
| 201 |
if (dest == ST_Agedge_s.class) { |
| 202 |
return this; |
| 203 |
} |
| 204 |
return super.castTo(dest); |
| 205 |
} |
| 206 |
|
| 207 |
public ST_Agobj_s castTo_ST_Agobj_s() { |
| 208 |
return base; |
| 209 |
} |
| 210 |
|
| 211 |
|
| 212 |
@Override |
| 213 |
public __ptr__ setPtr(String fieldName, __ptr__ newData) { |
| 214 |
if (fieldName.equals("node")) { |
| 215 |
this.node = (ST_Agnode_s) newData; |
| 216 |
return node; |
| 217 |
} |
| 218 |
return super.setPtr(fieldName, newData); |
| 219 |
} |
| 220 |
|
| 221 |
@Override |
| 222 |
public ST_Agedge_s getPtr() { |
| 223 |
return this; |
| 224 |
} |
| 225 |
|
| 226 |
public StarStruct from_seq_link(ST_dtlink_s from) { |
| 227 |
if (from == seq_link) { |
| 228 |
return this; |
| 229 |
} |
| 230 |
throw new IllegalArgumentException(); |
| 231 |
} |
| 232 |
|
| 233 |
public StarStruct from_id_link(ST_dtlink_s from) { |
| 234 |
if (from == id_link) { |
| 235 |
return this; |
| 236 |
} |
| 237 |
throw new IllegalArgumentException(); |
| 238 |
} |
| 239 |
|
| 240 |
|
| 241 |
|
| 242 |
|
| 243 |
|
| 244 |
|
| 245 |
|
| 246 |
|
| 247 |
|
| 248 |
|
| 249 |
|
| 250 |
} |
| 251 |
|
| 252 |
|
| 253 |
|
| 254 |
|
| 255 |
|
| 256 |
|
| 257 |
|