Libraryless. Click here for Pure Java version (117L/1K).
sclass Pt is Comparable<Pt>, IDoublePt { int x, y; *() {} *(Point p) { x = p.x; y = p.y; } *(int *x, int *y) {} Point getPoint() { ret new Point(x, y); } public bool equals(O o) { ret o instanceof Pt && x == o/Pt.x && y == o/Pt.y; } public int hashCode() { ret boostHashCombine(x, y); } // compare in scan order public int compareTo(Pt p) { if (y != p.y) ret cmp(y, p.y); ret cmp(x, p.x); } public S toString() { ret x + ", " + y; } double length() { ret sqrt(x*x+y*y); } public Pt minus(Pt p) { ret ptMinus(this, p); } public double x_double() { ret x; } public double y_double() { ret y; } }
Began life as a copy of #1005390
download show line numbers debug dex old transpilations
Travelled to 24 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, jtubtzbbkimh, lpdgvwnxivlt, lulzaavyztxj, mowyntqkapby, mqqgnosmbjvj, odhhsrjjbcgr, onxytkatvevr, ppjhyzlbdabe, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, snaazhdonpnp, tslmcundralx, tvejysmllsmz, vouqrxazstgt, wtqryiryparv, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1005718 |
Snippet name: | class Pt - persistable/portable version of Point |
Eternal ID of this version: | #1005718/7 |
Text MD5: | e111cdabf0e954c22739f86033d19c85 |
Transpilation MD5: | 20cf1374bd59751b0b89228794f07617 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-03-12 22:21:06 |
Source code size: | 730 bytes / 39 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 782 / 8328 |
Version history: | 6 change(s) |
Referenced in: | #1007399 - class DPt - persistable/portable version of Point2D.Double #1009189 - class DoublePt - point with doubles #1033865 - Pt_meta - Pt + IMeta #1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674) |