Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

19
LINES

< > BotCompany Repo | #1034492 // NumberPt - point with Numbers

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (5103L/28K).

sclass NumberPt is IDoublePt {
  Number x, y;
  
  *() {}
  *(Point p) { x = p.x; y = p.y; }
  *(Pt    p) { x = p.x; y = p.y; }
  *(double *x, double *y) {}
  
  [stdEq]
  
  toString {
    ret x + ", " + y;
  }
  
  double length() { ret sqrt(sqr(x_dbl())+sqr(y_dbl())); }
  
  public double x_double aka x_dbl() { ret x.doubleValue(); }
  public double y_double aka y_dbl() { ret y.doubleValue(); }
}

Author comment

Began life as a copy of #1009189

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1034492
Snippet name: NumberPt - point with Numbers
Eternal ID of this version: #1034492/5
Text MD5: a1afa05f95284694f8bc30889be17ca8
Transpilation MD5: 890dcfdde21b2b4e16b45c38381d6c07
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-02-08 09:10:57
Source code size: 420 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 89 / 165
Version history: 4 change(s)
Referenced in: [show references]