📄 mbr.java
字号:
/*
COMP 630C project
Re-implementation of R+ tree
Group member:
Cheng Wing Hang, Nelson
Cheung Kwok Ho, Steven
Ngai Ming Wai, Ryan
Shiu Hoi Nam
Tsui Chi Man
*/
import java.*;
import java.util.Random;
public class MBR {
RECT mbr; // Bounding box.
int oid; // Object id.
float cutxl;
float cutyl;
float cutxh;
float cutyh;
// Constructor function: The coordinates are randomly generated.
public MBR(int id)
{
RECT ran = new RECT();
this.mbr = ran;
this.oid = id;
cutxl=-1;
cutyl=-1;
cutxh=-1;
cutyh=-1;
}
public MBR(RECT w, int id)
{
this.mbr=w;
this.oid=id;
cutxl=-1;
cutyl=-1;
cutxh=-1;
cutyh=-1;
}
public MBR(RECT w)
{
this.mbr=w;
cutxl=-1;
cutyl=-1;
cutxh=-1;
cutyh=-1;
}
MBR(int oid, float xl, float yl, float xh, float yh) {
this.oid = oid;
mbr = new RECT(xl, yl, xh, yh);
cutxl=-1;
cutyl=-1;
cutxh=-1;
cutyh=-1;
}
// Check if this MBR overlaps with R.
int check_overlap(RECT R)
{
if ((R.high[0] <= this.mbr.low[0]) || (R.low[0] >= this.mbr.high[0]) ||
(R.high[1] <= this.mbr.low[1]) || (R.low[1] >= this.mbr.high[1]) )
{ return 0; }
return 1;
}
// Print the minimum bounding box and object ID
public void print()
{
System.out.println("OID: " + this.oid + " with mbr: " +
"( (" + this.mbr.low[0] + ", " + this.mbr.low[1] + "), (" +
this.mbr.high[0] + ", " + this.mbr.high[1] + ") )");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -