| 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 |
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 |
|
| 63 |
|
| 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 |
|
| 81 |
|
| 82 |
public static Object RTreeFreeNode(Object... arg) { |
| 83 |
UNSUPPORTED("e9yu9bfc7a1ihpoc5axpyg4eg"); |
| 84 |
UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); |
| 85 |
UNSUPPORTED("2jtyh6hx1w2fcx2gjs8ksbkuh"); |
| 86 |
UNSUPPORTED("ed5n0l2c9xevohsgtsmv822gw"); |
| 87 |
UNSUPPORTED("8pbkap1jra9u3gvgio7ou7y1n"); |
| 88 |
UNSUPPORTED("div10atae09n36x269sl208r1"); |
| 89 |
UNSUPPORTED("357domcrb707wvdox73ayvdj1"); |
| 90 |
UNSUPPORTED("bo0y3vz195pcz24vm46pixpb2"); |
| 91 |
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); |
| 92 |
|
| 93 |
throw new UnsupportedOperationException(); |
| 94 |
} |
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 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 |
|
| 110 |
} finally { |
| 111 |
LEAVING("4qk9wkm05q2pwf20ud6g2tufg","InitNode"); |
| 112 |
} |
| 113 |
} |
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 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 |
|
| 134 |
|
| 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 |
|
| 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 |
|
| 161 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 199 |
|
| 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 |
|
| 205 |
|
| 206 |
if (n.count < 64) { |
| 207 |
for (i = 0; i < 64; i++) { |
| 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 |
|
| 215 |
return 0; |
| 216 |
} else { |
| 217 |
if (rtp.StatFlag!=0) { |
| 218 |
UNSUPPORTED("2y8kv6b3ysrr61q7tqn76rhhc"); |
| 219 |
UNSUPPORTED("dn4oynmx9ugizzs5pkxiyptbi"); |
| 220 |
UNSUPPORTED("5c97f6vfxny0zz35l2bu4maox"); |
| 221 |
UNSUPPORTED("2u8wpa4w1q7rg14t07bny6p8i"); |
| 222 |
} |
| 223 |
|
| 224 |
SplitNode(rtp, n, b, new_); |
| 225 |
if (n.level == 0) |
| 226 |
rtp.setInt("LeafCount", rtp.LeafCount+1); |
| 227 |
else |
| 228 |
UNSUPPORTED("6tkfiebspy7ecivrzb3l5y7jd"); |
| 229 |
return 1; |
| 230 |
} |
| 231 |
} finally { |
| 232 |
LEAVING("2njctcrpeff95ysmv9ji34x4s","AddBranch"); |
| 233 |
} |
| 234 |
} |
| 235 |
|
| 236 |
|
| 237 |
|
| 238 |
|
| 239 |
|
| 240 |
|
| 241 |
public static void DisconBranch(ST_Node_t___ n, int i) { |
| 242 |
ENTERING("eqzamflj58f43cflwns9cemnk","DisconBranch"); |
| 243 |
try { |
| 244 |
|
| 245 |
|
| 246 |
InitBranch(n.branch[i]); |
| 247 |
n.setInt("count", n.count-1); |
| 248 |
} finally { |
| 249 |
LEAVING("eqzamflj58f43cflwns9cemnk","DisconBranch"); |
| 250 |
} |
| 251 |
} |
| 252 |
|
| 253 |
|
| 254 |
} |