All Downloads are FREE. Search and download functionalities are using the official Maven repository.

gen.lib.label.node__c Maven / Gradle / Ivy

There is a newer version: 1.2024.8
Show newest version
// THIS FILE HAS BEEN GENERATED BY A PREPROCESSOR.
package gen.lib.label;
import static gen.lib.label.rectangle__c.CombineRect;
import static gen.lib.label.rectangle__c.InitRect;
import static gen.lib.label.rectangle__c.RectArea;
import static gen.lib.label.split_q__c.SplitNode;
import static smetana.core.Macro.UNSUPPORTED;
import static smetana.core.debug.SmetanaDebug.ENTERING;
import static smetana.core.debug.SmetanaDebug.LEAVING;

import gen.annotation.Original;
import gen.annotation.Unused;
import h.ST_Branch_t;
import h.ST_Node_t___;
import h.ST_RTree;
import h.ST_Rect_t;

public class node__c {


//3 9uj7ni1m6q6drtoh56w82d6m4
// Node_t *RTreeNewNode(RTree_t * rtp) 
@Unused
@Original(version="2.38.0", path="lib/label/node.c", name="", key="9uj7ni1m6q6drtoh56w82d6m4", definition="Node_t *RTreeNewNode(RTree_t * rtp)")
public static ST_Node_t___ RTreeNewNode(ST_RTree rtp) {
ENTERING("9uj7ni1m6q6drtoh56w82d6m4","RTreeNewNode");
try {
	ST_Node_t___ n;
	rtp.NodeCount = rtp.NodeCount + 1;
	n = new ST_Node_t___();
     InitNode(n);
     return n;
} finally {
LEAVING("9uj7ni1m6q6drtoh56w82d6m4","RTreeNewNode");
}
}





//3 4qk9wkm05q2pwf20ud6g2tufg
// void InitNode(Node_t * n) 
@Unused
@Original(version="2.38.0", path="lib/label/node.c", name="InitNode", key="4qk9wkm05q2pwf20ud6g2tufg", definition="void InitNode(Node_t * n)")
public static void InitNode(ST_Node_t___ n) {
ENTERING("4qk9wkm05q2pwf20ud6g2tufg","InitNode");
try {
     int i;
     n.count = 0;
     n.level = -1;
     for (i = 0; i < 64; i++)
    	 InitBranch(n.branch[i]);
     // InitBranch(&(n->branch[i]));
} finally {
LEAVING("4qk9wkm05q2pwf20ud6g2tufg","InitNode");
}
}




//3 ruhxixxei7au9z1iaj0zggwo
// void InitBranch(Branch_t * b) 
@Unused
@Original(version="2.38.0", path="lib/label/node.c", name="InitBranch", key="ruhxixxei7au9z1iaj0zggwo", definition="void InitBranch(Branch_t * b)")
public static void InitBranch(ST_Branch_t b) {
ENTERING("ruhxixxei7au9z1iaj0zggwo","InitBranch");
try {
	InitRect(b.rect);
	b.child = null;
} finally {
LEAVING("ruhxixxei7au9z1iaj0zggwo","InitBranch");
}
}




//3 42vjqe8n5yeq2jjby00xzrotk
// Rect_t NodeCover(Node_t * n) 
@Unused
@Original(version="2.38.0", path="lib/label/node.c", name="NodeCover", key="42vjqe8n5yeq2jjby00xzrotk", definition="Rect_t NodeCover(Node_t * n)")
public static ST_Rect_t NodeCover(ST_Node_t___ n) {
ENTERING("42vjqe8n5yeq2jjby00xzrotk","NodeCover");
try {
     int i, flag;
     final ST_Rect_t r = new ST_Rect_t();
     //     assert(n);
     InitRect(r);
     flag = 1;
     for (i = 0; i < 64; i++)
 	if (n.branch[i].child!=null) {
 	    if (flag!=0) {
 		r.___(n.branch[i].rect);
 		flag = 0;
 	    } else
 		r.___(CombineRect(r, (ST_Rect_t) n.branch[i].rect));
 	}
     return r;
} finally {
LEAVING("42vjqe8n5yeq2jjby00xzrotk","NodeCover");
}
}




//3 bek56v2skz6jfvw4uggy2h5w3
// int PickBranch(Rect_t * r, Node_t * n) 
@Unused
@Original(version="2.38.0", path="lib/label/node.c", name="PickBranch", key="bek56v2skz6jfvw4uggy2h5w3", definition="int PickBranch(Rect_t * r, Node_t * n)")
public static int PickBranch(ST_Rect_t r, ST_Node_t___ n) {
	ENTERING("bek56v2skz6jfvw4uggy2h5w3","PickBranch");
	try {
     ST_Rect_t rr=null;
     int i=0, flag=1, increase=0, bestIncr=0, area=0, bestArea=0;
     int best=0;
//     assert(r && n);
     for (i = 0; i < 64; i++) {
 	if (n.branch[i].child!=null) {
 	    final ST_Rect_t rect = new ST_Rect_t();
 	    rr = (ST_Rect_t) n.branch[i].rect;
 	    area = RectArea((ST_Rect_t) rr);
 	    /* increase = RectArea(&CombineRect(r, rr)) - area; */
 	    rect.___(CombineRect((ST_Rect_t) r, rr));
 	    increase = RectArea((ST_Rect_t) rect) - area;
 	    if (increase < bestIncr || flag!=0) {
 		best = i;
 		bestArea = area;
 		bestIncr = increase;
 		flag = 0;
 	    } else if (increase == bestIncr && area < bestArea) {
 		best = i;
 		bestArea = area;
 		bestIncr = increase;
 	    }
 	}
     }
     return best;
} finally {
LEAVING("bek56v2skz6jfvw4uggy2h5w3","PickBranch");
}
}




//3 2njctcrpeff95ysmv9ji34x4s
// int AddBranch(RTree_t * rtp, Branch_t * b, Node_t * n, Node_t ** new) 
@Unused
@Original(version="2.38.0", path="lib/label/node.c", name="AddBranch", key="2njctcrpeff95ysmv9ji34x4s", definition="int AddBranch(RTree_t * rtp, Branch_t * b, Node_t * n, Node_t ** new)")
public static int AddBranch(ST_RTree rtp, ST_Branch_t b, ST_Node_t___ n, ST_Node_t___ new_[]) {
ENTERING("2njctcrpeff95ysmv9ji34x4s","AddBranch");
try {
     int i;
//     assert(b);
//     assert(n);
     if (n.count < 64) {	/* split won't be necessary */
 	for (i = 0; i < 64; i++) {	/* find empty branch */
 	    if (n.branch[i].child == null) {
 		n.branch[i].___(b);
 		n.count = n.count+1;
 		break;
 	    }
}
// 	assert(i < 64);
 	return 0;
     } else {
 	if (rtp.StatFlag!=0) {
UNSUPPORTED("2y8kv6b3ysrr61q7tqn76rhhc"); // 	    if (rtp->Deleting)
UNSUPPORTED("dn4oynmx9ugizzs5pkxiyptbi"); // 		rtp->DeTouchCount++;
UNSUPPORTED("5c97f6vfxny0zz35l2bu4maox"); // 	    else
UNSUPPORTED("2u8wpa4w1q7rg14t07bny6p8i"); // 		rtp->InTouchCount++;
 	}
// 	assert(new);
 	SplitNode(rtp, n, b, new_);
 	if (n.level == 0)
 		rtp.LeafCount = rtp.LeafCount+1;
 	else
UNSUPPORTED("6tkfiebspy7ecivrzb3l5y7jd"); // 	    rtp->NonLeafCount++;
 	return 1;
     }
} finally {
LEAVING("2njctcrpeff95ysmv9ji34x4s","AddBranch");
}
}




//3 eqzamflj58f43cflwns9cemnk
// void DisconBranch(Node_t * n, int i) 
@Unused
@Original(version="2.38.0", path="lib/label/node.c", name="DisconBranch", key="eqzamflj58f43cflwns9cemnk", definition="void DisconBranch(Node_t * n, int i)")
public static void DisconBranch(ST_Node_t___ n, int i) {
ENTERING("eqzamflj58f43cflwns9cemnk","DisconBranch");
try {
//     assert(n && i >= 0 && i < 64);
//     assert(n->branch[i].child);
     InitBranch(n.branch[i]);
     n.count = n.count-1;
} finally {
LEAVING("eqzamflj58f43cflwns9cemnk","DisconBranch");
}
}


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy