Debian Codegraph @

src/h/ST_Agobj_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 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 // public interface ST_Agobj_s extends __ptr__ {
129 // public static List<String> DEFINITION = Arrays.asList(
130 // "struct Agobj_s",
131 // "{",
132 // "Agtag_t tag",
133 // "Agrec_t *data",
134 // "}");
135 }
136
137 // struct Agobj_s {
138 // Agtag_t tag;
139 // Agrec_t *data;
140 // };