Debian Codegraph @

src/h/ST_Agedge_s.java

raw symbols SCIP
1 /* ========================================================================
2 * PlantUML : a free UML diagram generator
3 * ========================================================================
4 *
5 * Project Info: http://plantuml.com
6 *
7 * If you like this project or if you find it useful, you can support us at:
8 *
9 * http://plantuml.com/patreon (only 1$ per month!)
10 * http://plantuml.com/paypal
11 *
12 * This file is part of Smetana.
13 * Smetana is a partial translation of Graphviz/Dot sources from C to Java.
14 *
15 * (C) Copyright 2009-2020, Arnaud Roques
16 *
17 * This translation is distributed under the same Licence as the original C program:
18 *
19 *************************************************************************
20 * Copyright (c) 2011 AT&T Intellectual Property
21 * All rights reserved. This program and the accompanying materials
22 * are made available under the terms of the Eclipse Public License v1.0
23 * which accompanies this distribution, and is available at
24 * http://www.eclipse.org/legal/epl-v10.html
25 *
26 * Contributors: See CVS logs. Details at http://www.graphviz.org/
27 *************************************************************************
28 *
29 * THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC
30 * LICENSE ("AGREEMENT"). [Eclipse Public License - v 1.0]
31 *
32 * ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES
33 * RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
34 *
35 * You may obtain a copy of the License at
36 *
37 * http://www.eclipse.org/legal/epl-v10.html
38 *
39 * Unless required by applicable law or agreed to in writing, software
40 * distributed under the License is distributed on an "AS IS" BASIS,
41 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
42 * See the License for the specific language governing permissions and
43 * limitations under the License.
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 // Order=out, in
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 // public interface ST_Agedge_s extends __ptr__ {
242 // public static List<String> DEFINITION = Arrays.asList(
243 // "struct Agedge_s",
244 // "{",
245 // "Agobj_t base",
246 // "Dtlink_t id_link",
247 // "Dtlink_t seq_link",
248 // "Agnode_t *node",
249 // "}");
250 }
251
252 // struct Agedge_s {
253 // Agobj_t base;
254 // Dtlink_t id_link; /* main graph only */
255 // Dtlink_t seq_link;
256 // Agnode_t *node; /* the endpoint node */
257 // };