summaryrefslogtreecommitdiff
path: root/src/h/ST_Agnodeinfo_t.java
blob: 3a7d3bfca97eb7f0e6cc87d670b9627228b9d39e (plain)
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
/* ========================================================================
 * PlantUML : a free UML diagram generator
 * ========================================================================
 *
 * Project Info:  http://plantuml.com
 * 
 * If you like this project or if you find it useful, you can support us at:
 * 
 * http://plantuml.com/patreon (only 1$ per month!)
 * http://plantuml.com/paypal
 * 
 * This file is part of Smetana.
 * Smetana is a partial translation of Graphviz/Dot sources from C to Java.
 *
 * (C) Copyright 2009-2017, Arnaud Roques
 *
 * This translation is distributed under the same Licence as the original C program:
 * 
 *************************************************************************
 * Copyright (c) 2011 AT&T Intellectual Property 
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors: See CVS logs. Details at http://www.graphviz.org/
 *************************************************************************
 *
 * THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC
 * LICENSE ("AGREEMENT"). [Eclipse Public License - v 1.0]
 * 
 * ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES
 * RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
 * 
 * You may obtain a copy of the License at
 * 
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */
package h;

import smetana.core.UnsupportedStarStruct;
import smetana.core.UnsupportedStructAndPtr;
import smetana.core.__ptr__;
import smetana.core.__struct__;
import smetana.core.amiga.StarStruct;

public class ST_Agnodeinfo_t extends UnsupportedStructAndPtr {

	private final StarStruct parent;

	public ST_Agnodeinfo_t() {
		this(null);
	}

	public ST_Agnodeinfo_t(StarStruct parent) {
		this.parent = parent;
	}

	private final ST_Agrec_s hdr = new ST_Agrec_s(this);

	private ST_shape_desc shape;
	private ST_polygon_t shape_info;
	private final ST_pointf coord = new ST_pointf(this);
	private double width, height;

	// "boxf bb",
	private double ht, lw, rw;
	private ST_textlabel_t label;
	private ST_textlabel_t xlabel;
	// "void *alg",
	private ST_Agedge_s alg = null;
	// "char state",
	// "unsigned char gui_state",
	// "boolean clustnode",
	// "unsigned char pinned",
	private int id, heapindex, hops;
	// "double *pos, dist",
	private int showboxes;

	private boolean has_port;
	// "node_t* rep",
	// "node_t *set",
	private int node_type, mark, onstack;
	private int ranktype, weight_class;
	private ST_Agnode_s next;
	private ST_Agnode_s prev;
	// "elist in, out, flat_out, flat_in, other",
	private final ST_elist in = new ST_elist(this);
	private final ST_elist out = new ST_elist(this);
	private final ST_elist flat_out = new ST_elist(this);
	private final ST_elist flat_in = new ST_elist(this);
	private final ST_elist other = new ST_elist(this);
	private ST_Agraph_s.Amp clust;
	private int UF_size;

	private ST_Agnode_s UF_parent;

	private ST_Agnode_s inleaf, outleaf;
	private int rank, order;
	private double mval;
	private final ST_elist save_in = new ST_elist(this);
	private final ST_elist save_out = new ST_elist(this);
	private final ST_elist tree_in = new ST_elist(this);
	private final ST_elist tree_out = new ST_elist(this);
	private ST_Agedge_s par;
	private int low, lim;
	private int priority;

	// "double pad[1]",
	// "}",
	// "Agnodeinfo_t");

	@Override
	public StarStruct amp() {
		return new Amp();
	}

	public class Amp extends UnsupportedStarStruct {

	}

	@Override
	public __ptr__ castTo(Class dest) {
		if (dest == Agrec_s.class) {
			return hdr;
		}
		return super.castTo(dest);
	}

	@Override
	public void setDouble(String fieldName, double data) {
		if (fieldName.equals("width")) {
			this.width = data;
			return;
		}
		if (fieldName.equals("height")) {
			this.height = data;
			return;
		}
		if (fieldName.equals("ht")) {
			this.ht = data;
			return;
		}
		if (fieldName.equals("lw")) {
			this.lw = data;
			return;
		}
		if (fieldName.equals("rw")) {
			this.rw = data;
			return;
		}
		if (fieldName.equals("mval")) {
			this.mval = data;
			return;
		}
		super.setDouble(fieldName, data);
	}

	@Override
	public double getDouble(String fieldName) {
		if (fieldName.equals("width")) {
			return this.width;
		}
		if (fieldName.equals("height")) {
			return this.height;
		}
		if (fieldName.equals("ht")) {
			return this.ht;
		}
		if (fieldName.equals("lw")) {
			return this.lw;
		}
		if (fieldName.equals("rw")) {
			return this.rw;
		}
		if (fieldName.equals("mval")) {
			return this.mval;
		}
		return super.getDouble(fieldName);
	}

	@Override
	public void setBoolean(String fieldName, boolean data) {
		if (fieldName.equals("mark")) {
			this.mark = data ? 1 : 0;
			return;
		}
		if (fieldName.equals("onstack")) {
			this.onstack = data ? 1 : 0;
			return;
		}
		super.setBoolean(fieldName, data);
	}

	@Override
	public void setInt(String fieldName, int data) {
		if (fieldName.equals("showboxes")) {
			this.showboxes = data;
			return;
		}
		if (fieldName.equals("UF_size")) {
			this.UF_size = data;
			return;
		}
		if (fieldName.equals("mark")) {
			this.mark = data;
			return;
		}
		if (fieldName.equals("onstack")) {
			this.onstack = data;
			return;
		}
		if (fieldName.equals("priority")) {
			this.priority = data;
			return;
		}
		if (fieldName.equals("node_type")) {
			this.node_type = data;
			return;
		}
		if (fieldName.equals("rank")) {
			this.rank = data;
			return;
		}
		if (fieldName.equals("order")) {
			this.order = data;
			return;
		}
		if (fieldName.equals("ranktype")) {
			this.ranktype = data;
			return;
		}
		if (fieldName.equals("low")) {
			this.low = data;
			return;
		}
		if (fieldName.equals("lim")) {
			this.lim = data;
			return;
		}
		if (fieldName.equals("weight_class")) {
			this.weight_class = data;
			return;
		}
		super.setInt(fieldName, data);
	}

	@Override
	public int getInt(String fieldName) {
		if (fieldName.equals("UF_size")) {
			return this.UF_size;
		}
		if (fieldName.equals("ranktype")) {
			return this.ranktype;
		}
		if (fieldName.equals("mark")) {
			return this.mark;
		}
		if (fieldName.equals("onstack")) {
			return this.onstack;
		}
		if (fieldName.equals("priority")) {
			return this.priority;
		}
		if (fieldName.equals("node_type")) {
			return this.node_type;
		}
		if (fieldName.equals("rank")) {
			return this.rank;
		}
		if (fieldName.equals("order")) {
			return this.order;
		}
		if (fieldName.equals("ranktype")) {
			return this.ranktype;
		}
		if (fieldName.equals("low")) {
			return this.low;
		}
		if (fieldName.equals("lim")) {
			return this.lim;
		}
		if (fieldName.equals("weight_class")) {
			return this.weight_class;
		}
		if (fieldName.equals("id")) {
			return this.id;
		}
		if (fieldName.equals("heapindex")) {
			return this.heapindex;
		}
		if (fieldName.equals("hops")) {
			return this.hops;
		}
		return super.getInt(fieldName);
	}

	@Override
	public boolean getBoolean(String fieldName) {
		if (fieldName.equals("onstack")) {
			return this.onstack != 0;
		}
		if (fieldName.equals("has_port")) {
			return this.has_port;
		}
		return super.getBoolean(fieldName);
	}

	@Override
	public __ptr__ setPtr(String fieldName, __ptr__ newData) {
		if (fieldName.equals("shape")) {
			this.shape = (ST_shape_desc) newData;
			return shape;
		}
		if (fieldName.equals("shape_info")) {
			this.shape_info = (ST_polygon_t) newData;
			return shape_info;
		}
		if (fieldName.equals("label")) {
			this.label = (ST_textlabel_t) newData;
			return label;
		}
		if (fieldName.equals("clust")) {
			if (newData instanceof ST_Agraph_s) {
				this.clust = (h.ST_Agraph_s.Amp) ((ST_Agraph_s) newData).amp();
			} else {
				this.clust = (ST_Agraph_s.Amp) newData;
			}
			return clust;
		}
		if (fieldName.equals("next")) {
			this.next = (ST_Agnode_s) newData;
			return next;
		}
		if (fieldName.equals("prev")) {
			if (newData instanceof ST_Agnode_s.Amp) {
				this.prev = ((ST_Agnode_s.Amp) newData).getObject();
			} else {
				this.prev = (ST_Agnode_s) newData;
			}
			return prev;
		}
		if (fieldName.equals("UF_parent")) {
			this.UF_parent = (ST_Agnode_s) newData;
			return UF_parent;
		}
		if (fieldName.equals("par")) {
			if (newData instanceof ST_Agedge_s.Amp) {
				this.par = ((ST_Agedge_s.Amp) newData).getObject();
			} else {
				this.par = (ST_Agedge_s) newData;
			}
			return par;
		}
		if (fieldName.equals("alg")) {
			this.alg = (ST_Agedge_s) alg;
			return alg;
		}
		return super.setPtr(fieldName, newData);
	}

	@Override
	public __ptr__ getPtr(String fieldName) {
		if (fieldName.equals("shape")) {
			return shape;
		}
		if (fieldName.equals("label")) {
			return label;
		}
		if (fieldName.equals("UF_parent")) {
			return UF_parent;
		}
		if (fieldName.equals("next")) {
			return next;
		}
		if (fieldName.equals("prev")) {
			return prev;
		}
		if (fieldName.equals("clust")) {
			return clust;
		}
		if (fieldName.equals("inleaf")) {
			return inleaf;
		}
		if (fieldName.equals("outleaf")) {
			return outleaf;
		}
		if (fieldName.equals("alg")) {
			return alg;
		}
		if (fieldName.equals("par")) {
			return par;
		}
		if (fieldName.equals("xlabel")) {
			return xlabel;
		}
		if (fieldName.equals("shape_info")) {
			return shape_info;
		}
		return super.getPtr(fieldName);
	}

	@Override
	public __struct__ getStruct(String fieldName) {
		if (fieldName.equals("in")) {
			return in;
		}
		if (fieldName.equals("out")) {
			return out;
		}
		if (fieldName.equals("flat_out")) {
			return flat_out;
		}
		if (fieldName.equals("flat_in")) {
			return flat_in;
		}
		if (fieldName.equals("other")) {
			return other;
		}
		if (fieldName.equals("save_in")) {
			return save_in;
		}
		if (fieldName.equals("save_out")) {
			return save_out;
		}
		if (fieldName.equals("tree_in")) {
			return tree_in;
		}
		if (fieldName.equals("tree_out")) {
			return tree_out;
		}
		if (fieldName.equals("coord")) {
			return coord;
		}
		return super.getStruct(fieldName);
	}

	@Override
	public void setStruct(String fieldName, __struct__ newData) {
		if (fieldName.equals("save_in")) {
			save_in.copyDataFrom(newData);
			return;
		}
		if (fieldName.equals("save_out")) {
			save_out.copyDataFrom(newData);
			return;
		}
		if (fieldName.equals("out")) {
			out.copyDataFrom(newData);
			return;
		}
		if (fieldName.equals("in")) {
			in.copyDataFrom(newData);
			return;
		}
		super.setStruct(fieldName, newData);
	}
}

// typedef struct Agnodeinfo_t {
// Agrec_t hdr;
// shape_desc *shape;
// void *shape_info;
// pointf coord;
// double width, height; /* inches */
// boxf bb;
// double ht, lw, rw;
// textlabel_t *label;
// textlabel_t *xlabel;
// void *alg;
// char state;
// unsigned char gui_state; /* Node state for GUI ops */
// boolean clustnode;
//
//
// unsigned char pinned;
// int id, heapindex, hops;
// double *pos, dist;
//
//
// unsigned char showboxes;
// boolean has_port;
// node_t* rep;
// node_t *set;
//
// /* fast graph */
// char node_type, mark, onstack;
// char ranktype, weight_class;
// node_t *next, *prev;
// elist in, out, flat_out, flat_in, other;
// graph_t *clust;
//
// /* for union-find and collapsing nodes */
// int UF_size;
// node_t *UF_parent;
// node_t *inleaf, *outleaf;
//
// /* for placing nodes */
// int rank, order; /* initially, order = 1 for ordered edges */
// double mval;
// elist save_in, save_out;
//
// /* for network-simplex */
// elist tree_in, tree_out;
// edge_t *par;
// int low, lim;
// int priority;
//
// double pad[1];
//
//
// } Agnodeinfo_t;