Debian Codegraph @

src/gen/lib/label/node__c.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 gen.lib.label;
47 import static gen.lib.label.rectangle__c.CombineRect;
48 import static gen.lib.label.rectangle__c.InitRect;
49 import static gen.lib.label.rectangle__c.RectArea;
50 import static gen.lib.label.split_q__c.SplitNode;
51 import static smetana.core.JUtilsDebug.ENTERING;
52 import static smetana.core.JUtilsDebug.LEAVING;
53 import static smetana.core.Macro.UNSUPPORTED;
54 import h.ST_Branch_t;
55 import h.ST_Node_t___;
56 import h.ST_RTree;
57 import h.ST_Rect_t;
58
59 public class node__c {
60
61
62 //3 9uj7ni1m6q6drtoh56w82d6m4
63 // Node_t *RTreeNewNode(RTree_t * rtp)
64 public static ST_Node_t___ RTreeNewNode(ST_RTree rtp) {
65 ENTERING("9uj7ni1m6q6drtoh56w82d6m4","RTreeNewNode");
66 try {
67 ST_Node_t___ n;
68 rtp.setInt("NodeCount", rtp.NodeCount + 1);
69 n = new ST_Node_t___();
70 InitNode(n);
71 return n;
72 } finally {
73 LEAVING("9uj7ni1m6q6drtoh56w82d6m4","RTreeNewNode");
74 }
75 }
76
77
78
79
80 //3 65wa5vy8i5k40218lbhdibrjx
81 // void RTreeFreeNode(RTree_t * rtp, Node_t * p)
82 public static Object RTreeFreeNode(Object... arg) {
83 UNSUPPORTED("e9yu9bfc7a1ihpoc5axpyg4eg"); // void RTreeFreeNode(RTree_t * rtp, Node_t * p)
84 UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
85 UNSUPPORTED("2jtyh6hx1w2fcx2gjs8ksbkuh"); // rtp->NodeCount--;
86 UNSUPPORTED("ed5n0l2c9xevohsgtsmv822gw"); // if (p->level == 0)
87 UNSUPPORTED("8pbkap1jra9u3gvgio7ou7y1n"); // rtp->LeafCount--;
88 UNSUPPORTED("div10atae09n36x269sl208r1"); // else
89 UNSUPPORTED("357domcrb707wvdox73ayvdj1"); // rtp->NonLeafCount--;
90 UNSUPPORTED("bo0y3vz195pcz24vm46pixpb2"); // free(p);
91 UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
92
93 throw new UnsupportedOperationException();
94 }
95
96
97
98
99 //3 4qk9wkm05q2pwf20ud6g2tufg
100 // void InitNode(Node_t * n)
101 public static void InitNode(ST_Node_t___ n) {
102 ENTERING("4qk9wkm05q2pwf20ud6g2tufg","InitNode");
103 try {
104 int i;
105 n.setInt("count", 0);
106 n.setInt("level", -1);
107 for (i = 0; i < 64; i++)
108 InitBranch(n.branch[i]);
109 // InitBranch(&(n->branch[i]));
110 } finally {
111 LEAVING("4qk9wkm05q2pwf20ud6g2tufg","InitNode");
112 }
113 }
114
115
116
117
118 //3 ruhxixxei7au9z1iaj0zggwo
119 // void InitBranch(Branch_t * b)
120 public static void InitBranch(ST_Branch_t b) {
121 ENTERING("ruhxixxei7au9z1iaj0zggwo","InitBranch");
122 try {
123 InitRect(b.rect);
124 b.child = null;
125 } finally {
126 LEAVING("ruhxixxei7au9z1iaj0zggwo","InitBranch");
127 }
128 }
129
130
131
132
133 //3 42vjqe8n5yeq2jjby00xzrotk
134 // Rect_t NodeCover(Node_t * n)
135 public static ST_Rect_t NodeCover(ST_Node_t___ n) {
136 ENTERING("42vjqe8n5yeq2jjby00xzrotk","NodeCover");
137 try {
138 int i, flag;
139 final ST_Rect_t r = new ST_Rect_t();
140 // assert(n);
141 InitRect(r);
142 flag = 1;
143 for (i = 0; i < 64; i++)
144 if (n.branch[i].child!=null) {
145 if (flag!=0) {
146 r.___(n.branch[i].rect);
147 flag = 0;
148 } else
149 r.___(CombineRect(r, (ST_Rect_t) n.branch[i].rect));
150 }
151 return r;
152 } finally {
153 LEAVING("42vjqe8n5yeq2jjby00xzrotk","NodeCover");
154 }
155 }
156
157
158
159
160 //3 bek56v2skz6jfvw4uggy2h5w3
161 // int PickBranch(Rect_t * r, Node_t * n)
162 public static int PickBranch(ST_Rect_t r, ST_Node_t___ n) {
163 ENTERING("bek56v2skz6jfvw4uggy2h5w3","PickBranch");
164 try {
165 ST_Rect_t rr=null;
166 int i=0, flag=1, increase=0, bestIncr=0, area=0, bestArea=0;
167 int best=0;
168 // assert(r && n);
169 for (i = 0; i < 64; i++) {
170 if (n.branch[i].child!=null) {
171 final ST_Rect_t rect = new ST_Rect_t();
172 rr = (ST_Rect_t) n.branch[i].rect;
173 area = RectArea((ST_Rect_t) rr);
174 /* increase = RectArea(&CombineRect(r, rr)) - area; */
175 rect.___(CombineRect((ST_Rect_t) r, rr));
176 increase = RectArea((ST_Rect_t) rect) - area;
177 if (increase < bestIncr || flag!=0) {
178 best = i;
179 bestArea = area;
180 bestIncr = increase;
181 flag = 0;
182 } else if (increase == bestIncr && area < bestArea) {
183 best = i;
184 bestArea = area;
185 bestIncr = increase;
186 }
187 }
188 }
189 return best;
190 } finally {
191 LEAVING("bek56v2skz6jfvw4uggy2h5w3","PickBranch");
192 }
193 }
194
195
196
197
198 //3 2njctcrpeff95ysmv9ji34x4s
199 // int AddBranch(RTree_t * rtp, Branch_t * b, Node_t * n, Node_t ** new)
200 public static int AddBranch(ST_RTree rtp, ST_Branch_t b, ST_Node_t___ n, ST_Node_t___ new_[]) {
201 ENTERING("2njctcrpeff95ysmv9ji34x4s","AddBranch");
202 try {
203 int i;
204 // assert(b);
205 // assert(n);
206 if (n.count < 64) { /* split won't be necessary */
207 for (i = 0; i < 64; i++) { /* find empty branch */
208 if (n.branch[i].child == null) {
209 n.branch[i].___(b.getStruct());
210 n.setInt("count", n.count+1);
211 break;
212 }
213 }
214 // assert(i < 64);
215 return 0;
216 } else {
217 if (rtp.StatFlag!=0) {
218 UNSUPPORTED("2y8kv6b3ysrr61q7tqn76rhhc"); // if (rtp->Deleting)
219 UNSUPPORTED("dn4oynmx9ugizzs5pkxiyptbi"); // rtp->DeTouchCount++;
220 UNSUPPORTED("5c97f6vfxny0zz35l2bu4maox"); // else
221 UNSUPPORTED("2u8wpa4w1q7rg14t07bny6p8i"); // rtp->InTouchCount++;
222 }
223 // assert(new);
224 SplitNode(rtp, n, b, new_);
225 if (n.level == 0)
226 rtp.setInt("LeafCount", rtp.LeafCount+1);
227 else
228 UNSUPPORTED("6tkfiebspy7ecivrzb3l5y7jd"); // rtp->NonLeafCount++;
229 return 1;
230 }
231 } finally {
232 LEAVING("2njctcrpeff95ysmv9ji34x4s","AddBranch");
233 }
234 }
235
236
237
238
239 //3 eqzamflj58f43cflwns9cemnk
240 // void DisconBranch(Node_t * n, int i)
241 public static void DisconBranch(ST_Node_t___ n, int i) {
242 ENTERING("eqzamflj58f43cflwns9cemnk","DisconBranch");
243 try {
244 // assert(n && i >= 0 && i < 64);
245 // assert(n->branch[i].child);
246 InitBranch(n.branch[i]);
247 n.setInt("count", n.count-1);
248 } finally {
249 LEAVING("eqzamflj58f43cflwns9cemnk","DisconBranch");
250 }
251 }
252
253
254 }