| 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 smetana.core.HardcodedStruct; |
| 49 |
import smetana.core.UnsupportedStructAndPtr; |
| 50 |
import smetana.core.__ptr__; |
| 51 |
import smetana.core.__struct__; |
| 52 |
import smetana.core.amiga.StarStruct; |
| 53 |
|
| 54 |
public class ST_Agobj_s extends UnsupportedStructAndPtr implements WithParent, HardcodedStruct { |
| 55 |
|
| 56 |
public final ST_Agtag_s tag = new ST_Agtag_s(this); |
| 57 |
public ST_Agrec_s data; |
| 58 |
|
| 59 |
@Override |
| 60 |
public void copyDataFrom(__struct__ other) { |
| 61 |
ST_Agobj_s this2 = (ST_Agobj_s) other; |
| 62 |
this.tag.copyDataFrom((__struct__) this2.tag); |
| 63 |
this.data = this2.data; |
| 64 |
|
| 65 |
} |
| 66 |
|
| 67 |
private final StarStruct parent; |
| 68 |
|
| 69 |
public ST_Agobj_s() { |
| 70 |
this(null); |
| 71 |
} |
| 72 |
|
| 73 |
public ST_Agobj_s(StarStruct parent) { |
| 74 |
this.parent = parent; |
| 75 |
} |
| 76 |
|
| 77 |
@Override |
| 78 |
public __ptr__ castTo(Class dest) { |
| 79 |
if (dest == ST_Agobj_s.class) { |
| 80 |
return this; |
| 81 |
} |
| 82 |
if (dest == ST_Agraph_s.class && parent instanceof ST_Agraph_s) { |
| 83 |
return (ST_Agraph_s) parent; |
| 84 |
} |
| 85 |
if (dest == ST_Agnode_s.class && parent instanceof ST_Agnode_s) { |
| 86 |
return (ST_Agnode_s) parent; |
| 87 |
} |
| 88 |
if (dest == ST_Agedge_s.class && parent instanceof ST_Agedge_s) { |
| 89 |
return (ST_Agedge_s) parent; |
| 90 |
} |
| 91 |
return super.castTo(dest); |
| 92 |
} |
| 93 |
|
| 94 |
@Override |
| 95 |
public __ptr__ setPtr(String fieldName, __ptr__ newData) { |
| 96 |
if (fieldName.equals("data")) { |
| 97 |
if (newData instanceof ST_Agnodeinfo_t) { |
| 98 |
ST_Agnodeinfo_t info = (ST_Agnodeinfo_t) newData; |
| 99 |
newData = (ST_Agrec_s) info.castTo(ST_Agrec_s.class); |
| 100 |
} else if (newData instanceof ST_Agedgeinfo_t) { |
| 101 |
ST_Agedgeinfo_t info = (ST_Agedgeinfo_t) newData; |
| 102 |
newData = (ST_Agrec_s) info.castTo(ST_Agrec_s.class); |
| 103 |
} else if (newData instanceof ST_Agedgeinfo_t) { |
| 104 |
ST_Agedgeinfo_t info = (ST_Agedgeinfo_t) newData; |
| 105 |
newData = (ST_Agrec_s) info.castTo(ST_Agrec_s.class); |
| 106 |
} |
| 107 |
if (newData instanceof ST_Agrec_s) { |
| 108 |
this.data = (ST_Agrec_s) newData; |
| 109 |
} |
| 110 |
return data; |
| 111 |
} |
| 112 |
return super.setPtr(fieldName, newData); |
| 113 |
} |
| 114 |
|
| 115 |
@Override |
| 116 |
public void setStruct(String fieldName, __struct__ newData) { |
| 117 |
if (fieldName.equals("tag")) { |
| 118 |
this.tag.copyDataFrom(newData); |
| 119 |
return; |
| 120 |
} |
| 121 |
super.setStruct(fieldName, newData); |
| 122 |
} |
| 123 |
|
| 124 |
public StarStruct getParent() { |
| 125 |
return parent; |
| 126 |
} |
| 127 |
|
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
|
| 133 |
|
| 134 |
|
| 135 |
} |
| 136 |
|
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
|