Debian Codegraph @

src/h/ST_Agraph_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.OFFSET;
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_Agraph_s extends UnsupportedStructAndPtr {
61
62 public final ST_Agobj_s base = new ST_Agobj_s(this);
63 public final ST_Agdesc_s desc = new ST_Agdesc_s(this);
64 public final ST_dtlink_s link = new ST_dtlink_s(this);
65
66 public ST_dt_s n_seq; /* the node set in sequence */
67 public ST_dt_s n_id; /* the node set indexed by ID */
68 public ST_dt_s e_seq; /* holders for edge sets */
69 public ST_dt_s e_id; /* holders for edge sets */
70 public ST_dt_s g_dict; /* subgraphs - descendants */
71 public ST_Agraph_s parent; /* subgraphs - ancestors */
72 // Agraph_t *parent, *root; /* subgraphs - ancestors */
73 public ST_Agraph_s root; /* subgraphs - ancestors */
74 public ST_Agclos_s clos; /* shared resources */
75
76 private final StarStruct _parent;
77
78 public ST_Agraph_s() {
79 this(null);
80 }
81
82 public ST_Agraph_s(StarStruct parent) {
83 this._parent = parent;
84 }
85
86 public StarStruct getParent() {
87 return _parent;
88 }
89
90 @Override
91 public ST_Agraph_s getStruct() {
92 return this;
93 }
94
95 @Override
96 public void setStruct(String fieldName, __struct__ newData) {
97 if (fieldName.equals("desc")) {
98 desc.copyDataFrom(newData);
99 return;
100 }
101 super.setStruct(fieldName, newData);
102 }
103
104 @Override
105 public ST_Agraph_s getPtr() {
106 return this;
107 }
108
109 public static class Array extends UnsupportedArrayOfStruct2 implements __ptr__, __array_of_ptr__ {
110
111 private final List<ST_Agraph_s> data;
112 private final int pos;
113
114 @Override
115 public void setStruct(String fieldName, __struct__ data) {
116 getStruct().setStruct(fieldName, data);
117 }
118
119 @Override
120 public __ptr__ castTo(Class dest) {
121 return getStruct().castTo(dest);
122 }
123
124 @Override
125 public void setPtr(__ptr__ value) {
126 this.data.set(pos, (ST_Agraph_s) value);
127 }
128
129 @Override
130 public ST_Agraph_s getPtr() {
131 return this.data.get(pos);
132 }
133
134 @Override
135 public Array asPtr() {
136 return this;
137 }
138
139 @Override
140 public ST_Agraph_s getStruct() {
141 return data.get(pos);
142 }
143
144 public Array(int size) {
145 this.data = new ArrayList<ST_Agraph_s>();
146 this.pos = 0;
147 for (int i = 0; i < size; i++) {
148 data.add(null);
149 }
150 }
151
152 public Array reallocJ(int newsize) {
153 while (data.size() < newsize) {
154 data.add(null);
155 }
156 return this;
157 }
158
159 public Array plus(int delta) {
160 return plusJ(delta);
161 }
162
163 private Array(List<ST_Agraph_s> data, int pos) {
164 this.data = data;
165 this.pos = pos;
166 }
167
168 public ST_Agraph_s get(int i) {
169 return this.data.get(pos + i);
170 }
171
172 public Array plusJ(int i) {
173 return new Array(data, pos + i);
174 }
175
176 public int minus(Array other) {
177 if (this.data != other.data) {
178 throw new IllegalArgumentException();
179 }
180 return this.pos - other.pos;
181 }
182
183 public Array move(int delta) {
184 throw new UnsupportedOperationException(getClass().toString());
185 }
186
187 public void realloc(size_t nb) {
188 throw new UnsupportedOperationException(getClass().toString());
189 }
190
191 public int comparePointerInternal(__array_of_ptr__ other) {
192 throw new UnsupportedOperationException(getClass().toString());
193 }
194
195 }
196
197 @Override
198 public Object addVirtualBytes(int virtualBytes) {
199 if (virtualBytes == 0) {
200 return this;
201 }
202 OFFSET offset = OFFSET.fromInt(virtualBytes);
203 // if (offset.toString().equals("h.Agedge_s::seq_link")) {
204 // return seq_link;
205 // }
206 if (offset.toString().equals("h.ST_Agraph_s::link")) {
207 return link;
208 }
209 System.err.println("offset156=" + offset);
210 return super.addVirtualBytes(virtualBytes);
211 }
212
213 @Override
214 public __ptr__ setPtr(String fieldName, __ptr__ newData) {
215 if (fieldName.equals("clos")) {
216 this.clos = (ST_Agclos_s) newData;
217 return clos;
218 }
219 if (fieldName.equals("root")) {
220 this.root = (ST_Agraph_s) newData;
221 return root;
222 }
223 if (fieldName.equals("n_seq")) {
224 this.n_seq = (ST_dt_s) newData;
225 return n_seq;
226 }
227 if (fieldName.equals("n_id")) {
228 this.n_id = (ST_dt_s) newData;
229 return n_id;
230 }
231 if (fieldName.equals("e_seq")) {
232 this.e_seq = (ST_dt_s) newData;
233 return e_seq;
234 }
235 if (fieldName.equals("e_id")) {
236 this.e_id = (ST_dt_s) newData;
237 return e_id;
238 }
239 if (fieldName.equals("g_dict")) {
240 this.g_dict = (ST_dt_s) newData;
241 return g_dict;
242 }
243 if (fieldName.equals("parent")) {
244 this.parent = (ST_Agraph_s) newData;
245 return parent;
246 }
247 return super.setPtr(fieldName, newData);
248 }
249
250 @Override
251 public __ptr__ castTo(Class dest) {
252 if (dest == ST_Agobj_s.class) {
253 return base;
254 }
255 if (dest == ST_Agraph_s.class) {
256 return this;
257 }
258 return super.castTo(dest);
259 }
260
261 public ST_Agobj_s castTo_ST_Agobj_s() {
262 return base;
263 }
264
265 @Override
266 public boolean isSameThan(StarStruct other) {
267 ST_Agraph_s other2 = (ST_Agraph_s) other;
268 return this == other2;
269 }
270
271 public StarStruct from_link(ST_dtlink_s from) {
272 if (from == link) {
273 return this;
274 }
275 throw new IllegalArgumentException();
276 }
277
278 //
279 // public interface ST_Agraph_s extends __ptr__ {
280 // public static List<String> DEFINITION = Arrays.asList(
281 // "struct Agraph_s",
282 // "{",
283 // "Agobj_t base",
284 // "Agdesc_t desc",
285 // "Dtlink_t link",
286 // "Dict_t *n_seq",
287 // "Dict_t *n_id",
288 // "Dict_t *e_seq, *e_id",
289 // "Dict_t *g_dict",
290 // "Agraph_t *parent, *root",
291 // "Agclos_t *clos",
292 // "}");
293 }
294
295 // struct Agraph_s {
296 // Agobj_t base;
297 // Agdesc_t desc;
298 // Dtlink_t link;
299 // Dict_t *n_seq; /* the node set in sequence */
300 // Dict_t *n_id; /* the node set indexed by ID */
301 // Dict_t *e_seq, *e_id; /* holders for edge sets */
302 // Dict_t *g_dict; /* subgraphs - descendants */
303 // Agraph_t *parent, *root; /* subgraphs - ancestors */
304 // Agclos_t *clos; /* shared resources */
305 // };