final srecord Rect(int x, int y, int w, int h) { *(Rectangle r) { x = r.x; y = r.y; w = r.width; h = r.height; } *(Pt p, int *w, int *h) { x = p.x; y = p.y; } *(Rect r) { x = r.x; y = r.y; w = r.w; h = r.h; } Rectangle getRectangle() { ret new Rectangle(x, y, w, h); } public S toString() { ret x + "," + y + " / " + w + "," + h; } int x1() { ret x; } int y1() { ret y; } int x2() { ret x + w; } int y2() { ret y + h; } bool contains(Pt p) { ret contains(p.x, p.y); } bool contains(int _x, int _y) { ret _x >= x && _y >= y && _x < x+w && _y < y+h; } bool empty() { ret w <= 0 || h <= 0; } int getWidth() { ret w; } int getHeight() { ret h; } }