| 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.UnsupportedArrayOfPtr; |
| 52 |
import smetana.core.UnsupportedArrayOfStruct2; |
| 53 |
import smetana.core.UnsupportedStructAndPtr; |
| 54 |
import smetana.core.__array_of_ptr__; |
| 55 |
import smetana.core.__ptr__; |
| 56 |
import smetana.core.__struct__; |
| 57 |
import smetana.core.size_t; |
| 58 |
import smetana.core.amiga.StarStruct; |
| 59 |
|
| 60 |
public class ST_Agnode_s extends UnsupportedStructAndPtr { |
| 61 |
|
| 62 |
public final ST_Agobj_s base = new ST_Agobj_s(this); |
| 63 |
public ST_Agraph_s root; |
| 64 |
public final ST_Agsubnode_s mainsub = new ST_Agsubnode_s(this); |
| 65 |
|
| 66 |
private final StarStruct parent; |
| 67 |
|
| 68 |
public static class ArrayOfStar extends UnsupportedArrayOfPtr implements __ptr__, __array_of_ptr__ { |
| 69 |
|
| 70 |
private final List<ST_Agnode_s> data; |
| 71 |
private final int pos; |
| 72 |
|
| 73 |
public ArrayOfStar(int size) { |
| 74 |
this.data = new ArrayList<ST_Agnode_s>(); |
| 75 |
this.pos = 0; |
| 76 |
for (int i = 0; i < size; i++) { |
| 77 |
data.add(null); |
| 78 |
} |
| 79 |
} |
| 80 |
|
| 81 |
public void swap(int i, int j) { |
| 82 |
ST_Agnode_s e1 = data.get(i); |
| 83 |
ST_Agnode_s e2 = data.get(j); |
| 84 |
data.set(i, e2); |
| 85 |
data.set(j, e1); |
| 86 |
} |
| 87 |
|
| 88 |
public ArrayOfStar(List<ST_Agnode_s> data, int pos) { |
| 89 |
this.data = data; |
| 90 |
this.pos = pos; |
| 91 |
} |
| 92 |
|
| 93 |
public ArrayOfStar reallocJ(int newsize) { |
| 94 |
while (data.size() < newsize) { |
| 95 |
data.add(null); |
| 96 |
} |
| 97 |
return this; |
| 98 |
} |
| 99 |
|
| 100 |
@Override |
| 101 |
public ArrayOfStar plus(int delta) { |
| 102 |
return new ArrayOfStar(data, pos + delta); |
| 103 |
} |
| 104 |
|
| 105 |
@Override |
| 106 |
public ArrayOfStar asPtr() { |
| 107 |
return this; |
| 108 |
} |
| 109 |
|
| 110 |
@Override |
| 111 |
public void setPtr(__ptr__ value) { |
| 112 |
this.data.set(pos, (ST_Agnode_s) value); |
| 113 |
} |
| 114 |
|
| 115 |
public ST_Agnode_s get(int i) { |
| 116 |
return plus(i).getPtr(); |
| 117 |
} |
| 118 |
|
| 119 |
@Override |
| 120 |
public ST_Agnode_s getPtr() { |
| 121 |
return this.data.get(pos); |
| 122 |
} |
| 123 |
|
| 124 |
@Override |
| 125 |
public int comparePointer(__ptr__ other) { |
| 126 |
final ArrayOfStar this2 = (ArrayOfStar) other; |
| 127 |
if (this.data != this2.data) { |
| 128 |
throw new IllegalArgumentException(); |
| 129 |
} |
| 130 |
return this.pos - this2.pos; |
| 131 |
} |
| 132 |
|
| 133 |
public boolean isSameThan2(ArrayOfStar other) { |
| 134 |
if (this.data != other.data) { |
| 135 |
throw new IllegalArgumentException(); |
| 136 |
} |
| 137 |
return this.pos == other.pos; |
| 138 |
} |
| 139 |
} |
| 140 |
|
| 141 |
public static class Array extends UnsupportedArrayOfStruct2 implements __ptr__, __array_of_ptr__ { |
| 142 |
|
| 143 |
private final List<ST_Agnode_s> data; |
| 144 |
private final int pos; |
| 145 |
|
| 146 |
@Override |
| 147 |
public void setStruct(__struct__ value) { |
| 148 |
get(0).___(value); |
| 149 |
} |
| 150 |
|
| 151 |
@Override |
| 152 |
public Array asPtr() { |
| 153 |
return this; |
| 154 |
} |
| 155 |
|
| 156 |
public Array(int size) { |
| 157 |
this.data = new ArrayList<ST_Agnode_s>(); |
| 158 |
this.pos = 0; |
| 159 |
for (int i = 0; i < size; i++) { |
| 160 |
data.add(new ST_Agnode_s()); |
| 161 |
} |
| 162 |
} |
| 163 |
|
| 164 |
public Array reallocJ(int newsize) { |
| 165 |
while (data.size() < newsize) { |
| 166 |
data.add(new ST_Agnode_s()); |
| 167 |
} |
| 168 |
return this; |
| 169 |
} |
| 170 |
|
| 171 |
public Array plus(int delta) { |
| 172 |
return plusJ(delta); |
| 173 |
} |
| 174 |
|
| 175 |
@Override |
| 176 |
public void setPtr(__ptr__ value) { |
| 177 |
this.data.set(pos, (ST_Agnode_s) value); |
| 178 |
} |
| 179 |
|
| 180 |
@Override |
| 181 |
public ST_Agnode_s getPtr() { |
| 182 |
return this.data.get(pos); |
| 183 |
} |
| 184 |
|
| 185 |
private Array(List<ST_Agnode_s> data, int pos) { |
| 186 |
this.data = data; |
| 187 |
this.pos = pos; |
| 188 |
} |
| 189 |
|
| 190 |
public ST_Agnode_s get(int i) { |
| 191 |
return this.data.get(pos + i); |
| 192 |
} |
| 193 |
|
| 194 |
public Array plusJ(int i) { |
| 195 |
return new Array(data, pos + i); |
| 196 |
} |
| 197 |
|
| 198 |
public int minus(Array other) { |
| 199 |
if (this.data != other.data) { |
| 200 |
throw new IllegalArgumentException(); |
| 201 |
} |
| 202 |
return this.pos - other.pos; |
| 203 |
} |
| 204 |
|
| 205 |
public Array move(int delta) { |
| 206 |
throw new UnsupportedOperationException(getClass().toString()); |
| 207 |
} |
| 208 |
|
| 209 |
public void realloc(size_t nb) { |
| 210 |
throw new UnsupportedOperationException(getClass().toString()); |
| 211 |
} |
| 212 |
|
| 213 |
public int comparePointerInternal(__array_of_ptr__ other) { |
| 214 |
throw new UnsupportedOperationException(getClass().toString()); |
| 215 |
} |
| 216 |
|
| 217 |
|
| 218 |
} |
| 219 |
|
| 220 |
public ST_Agnode_s() { |
| 221 |
this(null); |
| 222 |
} |
| 223 |
|
| 224 |
public ST_Agnode_s(StarStruct parent) { |
| 225 |
this.parent = parent; |
| 226 |
} |
| 227 |
|
| 228 |
public StarStruct getParent() { |
| 229 |
return parent; |
| 230 |
} |
| 231 |
|
| 232 |
@Override |
| 233 |
public __ptr__ castTo(Class dest) { |
| 234 |
if (dest == ST_Agnode_s.class) { |
| 235 |
return this; |
| 236 |
} |
| 237 |
if (dest == ST_Agobj_s.class) { |
| 238 |
return base; |
| 239 |
} |
| 240 |
return super.castTo(dest); |
| 241 |
} |
| 242 |
|
| 243 |
public ST_Agobj_s castTo_ST_Agobj_s() { |
| 244 |
return base; |
| 245 |
} |
| 246 |
|
| 247 |
@Override |
| 248 |
public boolean isSameThan(StarStruct other) { |
| 249 |
ST_Agnode_s other2 = (ST_Agnode_s) other; |
| 250 |
return this == other2; |
| 251 |
} |
| 252 |
|
| 253 |
@Override |
| 254 |
public __ptr__ setPtr(String fieldName, __ptr__ newData) { |
| 255 |
if (fieldName.equals("root")) { |
| 256 |
this.root = (ST_Agraph_s) newData; |
| 257 |
return root; |
| 258 |
} |
| 259 |
return super.setPtr(fieldName, newData); |
| 260 |
} |
| 261 |
|
| 262 |
@Override |
| 263 |
public ST_Agnode_s getStruct() { |
| 264 |
return this; |
| 265 |
} |
| 266 |
|
| 267 |
|
| 268 |
|
| 269 |
|
| 270 |
|
| 271 |
|
| 272 |
|
| 273 |
|
| 274 |
} |
| 275 |
|
| 276 |
|
| 277 |
|
| 278 |
|
| 279 |
|
| 280 |
|