Debian Codegraph @

src/h/ST_bezier.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 h.ST_pointf.Array;
49
50 import java.util.ArrayList;
51 import java.util.List;
52
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_bezier extends UnsupportedStructAndPtr {
61
62 private final StarStruct parent;
63
64 public ST_bezier() {
65 this(null);
66 }
67
68 public ST_bezier(StarStruct parent) {
69 this.parent = parent;
70 }
71
72 // "{",
73 // "pointf *list",
74 public ST_pointf.Array list;
75
76 public int size;
77 public int sflag, eflag;
78
79 public final ST_pointf sp = new ST_pointf(this), ep = new ST_pointf(this);
80
81 public static class Array2 extends UnsupportedArrayOfPtr implements __ptr__, __array_of_ptr__ {
82
83 private final List<ST_bezier> data;
84 private final int pos;
85
86 public Array2(int size) {
87 this.data = new ArrayList<ST_bezier>();
88 this.pos = 0;
89 for (int i = 0; i < size; i++) {
90 data.add(new ST_bezier());
91 }
92 }
93
94 @Override
95 public ST_bezier getStruct() {
96 return data.get(pos);
97 }
98
99 @Override
100 public __ptr__ setPtr(String fieldName, __ptr__ newData) {
101 return getStruct().setPtr(fieldName, newData);
102 }
103
104 @Override
105 public void setStruct(String fieldName, __struct__ newData) {
106 getStruct().setStruct(fieldName, newData);
107 }
108
109 @Override
110 public void setInt(String fieldName, int data) {
111 getStruct().setInt(fieldName, data);
112 }
113
114 // public void swap(int i, int j) {
115 // ST_bezier e1 = data.get(i);
116 // ST_bezier e2 = data.get(j);
117 // data.set(i, e2);
118 // data.set(j, e1);
119 // }
120
121 public Array2(List<ST_bezier> data, int pos) {
122 this.data = data;
123 this.pos = pos;
124 }
125
126 public Array2 reallocJ(int newsize) {
127 while (data.size() < newsize) {
128 data.add(new ST_bezier());
129 }
130 return this;
131 }
132
133 @Override
134 public Array2 plus(int delta) {
135 return new Array2(data, pos + delta);
136 }
137
138 @Override
139 public Array2 asPtr() {
140 return this;
141 }
142
143 @Override
144 public void setPtr(__ptr__ value) {
145 this.data.set(pos, (ST_bezier) value);
146 }
147
148 @Override
149 public ST_bezier getPtr() {
150 return this.data.get(pos);
151 }
152
153 public ST_bezier get(int i) {
154 return this.plus(i).getPtr();
155 }
156
157 @Override
158 public int comparePointer(__ptr__ other) {
159 final Array2 this2 = (Array2) other;
160 if (this.data != this2.data) {
161 throw new IllegalArgumentException();
162 }
163 return this.pos - this2.pos;
164 }
165
166 public boolean isSameThan2(Array2 other) {
167 if (this.data != other.data) {
168 throw new IllegalArgumentException();
169 }
170 return this.pos == other.pos;
171 }
172 }
173
174 // "}",
175 // "bezier");
176
177 @Override
178 public void ___(__struct__ other) {
179 ST_bezier this2 = (ST_bezier) other;
180 this.list = this2.list;
181 this.size = this2.size;
182 this.sflag = this2.sflag;
183 this.eflag = this2.eflag;
184 this.sp.copyDataFrom((__struct__) this2.sp);
185 this.ep.copyDataFrom((__struct__) this2.ep);
186 }
187
188 @Override
189 public void ____(__ptr__ other) {
190 ___(((ST_bezier) other).getStruct());
191 }
192
193 @Override
194 public void setStruct(String fieldName, __struct__ newData) {
195 if (fieldName.equals("sp")) {
196 this.sp.copyDataFrom(newData);
197 return;
198 }
199 if (fieldName.equals("ep")) {
200 this.ep.copyDataFrom(newData);
201 return;
202 }
203 super.setStruct(fieldName, newData);
204 }
205
206 @Override
207 public void setInt(String fieldName, int data) {
208 if (fieldName.equals("size")) {
209 this.size = data;
210 return;
211 }
212 if (fieldName.equals("sflag")) {
213 this.sflag = data;
214 return;
215 }
216 if (fieldName.equals("eflag")) {
217 this.eflag = data;
218 return;
219 }
220 super.setInt(fieldName, data);
221 }
222
223 @Override
224 public __ptr__ setPtr(String fieldName, __ptr__ newData) {
225 if (fieldName.equals("list")) {
226 this.list = (Array) newData;
227 return this.list;
228 }
229 return super.setPtr(fieldName, newData);
230 }
231
232 @Override
233 public ST_bezier getStruct() {
234 return this;
235 }
236
237 @Override
238 public ST_bezier getPtr() {
239 return this;
240 }
241
242 }
243
244 // typedef struct bezier {
245 // pointf *list;
246 // int size;
247 // int sflag, eflag;
248 // pointf sp, ep;
249 // } bezier;