Libraryless. Click here for Pure Java version (9142L/51K).
srecord Rect(int x, int y, int w, int h) is WidthAndHeight { *(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; } final Rectangle getRectangle() { ret new Rectangle(x, y, w, h); } public S toString() { ret x + "," + y + " / " + w + "," + h; } final int x1() { ret x; } final int y1() { ret y; } final int x2() { ret x + w; } final int y2() { ret y + h; } final bool contains(Pt p) { ret contains(p.x, p.y); } final bool contains(int _x, int _y) { ret _x >= x && _y >= y && _x < x+w && _y < y+h; } final bool contains(Rectangle r) { ret rectContains(this, r); } final bool empty() { ret w <= 0 || h <= 0; } final public int getWidth() { ret w; } final public int getHeight() { ret h; } final public int area() { ret w*h; } final public int x() { ret x; } final public int y() { ret y; } WidthAndHeight widthAndHeight() { ret main widthAndHeight(w, h); } }
download show line numbers debug dex old transpilations
Travelled to 24 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, ekrmjmnbrukm, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, jtubtzbbkimh, lpdgvwnxivlt, lulzaavyztxj, mowyntqkapby, mqqgnosmbjvj, onxytkatvevr, ppjhyzlbdabe, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt, wtqryiryparv, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1005390 |
Snippet name: | class Rect - persistable version of Rectangle |
Eternal ID of this version: | #1005390/14 |
Text MD5: | edcde344afa0a5b5d90b6b651838d1d4 |
Transpilation MD5: | d042cdfd7eda7eee2abefaaaac2ca2ef |
Author: | stefan |
Category: | javax / concepts / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-08-15 20:15:28 |
Source code size: | 1130 bytes / 48 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 816 / 9582 |
Version history: | 13 change(s) |
Referenced in: | [show references] |