Debian Codegraph @

src/h/ST_pointf.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.CString;
52 import smetana.core.HardcodedStruct;
53 import smetana.core.UnsupportedArrayOfStruct2;
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.size_t;
59 import smetana.core.amiga.Area;
60 import smetana.core.amiga.StarStruct;
61
62 public class ST_pointf extends UnsupportedStructAndPtr implements HardcodedStruct {
63
64 public double x;
65 public double y;
66
67 @Override
68 public boolean isSameThan(StarStruct other) {
69 return this==(ST_pointf)other;
70 }
71
72 public static class Array extends UnsupportedArrayOfStruct2 implements __ptr__,
73 __array_of_ptr__ {
74
75 private final List<ST_pointf> data;
76 private final int pos;
77
78 @Override
79 public void setStruct(__struct__ value) {
80 getStruct().___(value);
81 }
82
83 @Override
84 public Array asPtr() {
85 return this;
86 }
87
88 @Override
89 public void setDouble(String fieldName, double value) {
90 getStruct().setDouble(fieldName, value);
91 }
92
93 @Override
94 public ST_pointf getStruct() {
95 return get(0).getStruct();
96 }
97
98 @Override
99 public ST_pointf getPtr() {
100 return get(0);
101 }
102
103 public Array(int size) {
104 this.data = new ArrayList<ST_pointf>();
105 this.pos = 0;
106 for (int i = 0; i < size; i++) {
107 data.add(new ST_pointf());
108 }
109 }
110
111 public Array reallocJ(int newsize) {
112 while (data.size() < newsize) {
113 data.add(new ST_pointf());
114 }
115 return this;
116 }
117
118 public Array plus(int delta) {
119 return plusJ(delta);
120 }
121
122 private Array(List<ST_pointf> data, int pos) {
123 this.data = data;
124 this.pos = pos;
125 }
126
127 public ST_pointf get(int i) {
128 return this.data.get(pos + i);
129 }
130
131 public Array plusJ(int i) {
132 return new Array(data, pos + i);
133 }
134
135 public int minus(Array other) {
136 if (this.data != other.data) {
137 throw new IllegalArgumentException();
138 }
139 return this.pos - other.pos;
140 }
141
142 public Array move(int delta) {
143 throw new UnsupportedOperationException(getClass().toString());
144 }
145
146 public void realloc(size_t nb) {
147 throw new UnsupportedOperationException(getClass().toString());
148 }
149
150 public int comparePointerInternal(__array_of_ptr__ other) {
151 throw new UnsupportedOperationException(getClass().toString());
152 }
153
154 public void setCString(CString value) {
155 throw new UnsupportedOperationException(getClass().toString());
156 }
157
158 }
159
160 public static ST_pointf[] malloc(int nb) {
161 final ST_pointf result[] = new ST_pointf[nb];
162 for (int i = 0; i < nb; i++) {
163 result[i] = new ST_pointf();
164 }
165 return result;
166 }
167
168 public static ST_pointf[] realloc(ST_pointf[] old, int nb) {
169 if (nb <= old.length) {
170 return old;
171 }
172 final ST_pointf result[] = new ST_pointf[nb];
173 for (int i = 0; i < nb; i++) {
174 result[i] = i < old.length ? old[i] : new ST_pointf();
175 }
176 return result;
177 }
178
179 public ST_pointf() {
180 this(null);
181 }
182
183
184 @Override
185 public ST_pointf copy() {
186 final ST_pointf result = new ST_pointf();
187 result.x = this.x;
188 result.y = this.y;
189 return result;
190 }
191
192 @Override
193 public void setStruct(__struct__ value) {
194 final ST_pointf other2 = (ST_pointf) value;
195 this.x = other2.x;
196 this.y = other2.y;
197 }
198
199 @Override
200 public void copyDataFrom(__ptr__ value) {
201 final ST_pointf other2 = (ST_pointf) value;
202 this.x = other2.x;
203 this.y = other2.y;
204 }
205
206 @Override
207 public ST_pointf getStruct() {
208 return this;
209 }
210
211 @Override
212 public void memcopyFrom(Area source) {
213 // if (source instanceof StarArrayOfPtr) {
214 // final Amp other2 = (Amp) ((StarArrayOfPtr) source).getPtr();
215 // this.x = other2.getX();
216 // this.y = other2.getY();
217 // return;
218 //
219 // }
220 final ST_pointf other2 = (ST_pointf) source;
221 this.x = other2.x;
222 this.y = other2.y;
223 }
224
225 @Override
226 public void ___(__struct__ other) {
227 final ST_pointf other2 = (ST_pointf) other;
228 this.x = other2.x;
229 this.y = other2.y;
230 }
231
232 @Override
233 public void ____(__ptr__ other) {
234 if (other instanceof ST_pointf.Array) {
235 ST_pointf.Array other2 = (ST_pointf.Array) other;
236 this.x = other2.get(0).x;
237 this.y = other2.get(0).y;
238 return;
239 }
240 // if (other instanceof __array_of_ptr__) {
241 // Amp other2 = (Amp) other.getPtr();
242 // this.x = other2.getX();
243 // this.y = other2.getY();
244 // return;
245 // }
246 // if (other instanceof StarArrayOfPtr) {
247 // Amp other2 = (Amp) other.getPtr();
248 // this.x = other2.getX();
249 // this.y = other2.getY();
250 // return;
251 // }
252 // if (other instanceof Amp) {
253 // Amp other2 = (Amp) other;
254 // this.x = other2.getX();
255 // this.y = other2.getY();
256 // return;
257 // }
258 if (other instanceof ST_pointf) {
259 ST_pointf other2 = (ST_pointf) other;
260 this.x = other2.x;
261 this.y = other2.y;
262 return;
263 }
264 System.err.println("other=" + other.getClass());
265 System.err.println("other=" + other.getPtr().getClass());
266 super.____(other);
267 }
268
269 @Override
270 public void copyDataFrom(__struct__ other) {
271 final ST_pointf other2 = (ST_pointf) other;
272 this.x = other2.x;
273 this.y = other2.y;
274 }
275
276 @Override
277 public void setDouble(String fieldName, double data) {
278 if (fieldName.equals("x")) {
279 this.x = data;
280 return;
281 }
282 if (fieldName.equals("y")) {
283 this.y = data;
284 return;
285 }
286 super.setDouble(fieldName, data);
287 }
288
289 public ST_pointf(StarStruct parent) {
290 }
291
292 // public interface ST_pointf extends __ptr__ {
293 // public static List<String> DEFINITION = Arrays.asList(
294 // "typedef struct pointf_s",
295 // "{",
296 // "double x, y",
297 // "}",
298 // "pointf");
299 }
300
301 // typedef struct pointf_s { double x, y; } pointf;