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

24
LINES

< > BotCompany Repo | #1009189 // class DoublePt - point with doubles

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

Libraryless. Click here for Pure Java version (86L/1K).

sclass DoublePt is IDoublePt {
  double x, y;
  
  *() {}
  *(Point p) {
    x = p.x;
    y = p.y;
  }
  *(double *x, double *y) {}
  
  equals DoublePt p { ret x == p.x && y == p.y; }
  public int hashCode() {
    ret boostHashCombine(main hashCode(x), main hashCode(y));
  }
  
  toString {
    ret x + ", " + y;
  }
  
  double length() { ret sqrt(x*x+y*y); }
  
  public double x_double() { ret x; }
  public double y_double() { ret y; }
}

Author comment

Began life as a copy of #1005718

download  show line numbers  debug dex  old transpilations   

Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, jtubtzbbkimh, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, ppjhyzlbdabe, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1009189
Snippet name: class DoublePt - point with doubles
Eternal ID of this version: #1009189/5
Text MD5: 0615f3c4af0ac734253698bcbdfa5876
Transpilation MD5: 75542ec335476e51843e772559f4a774
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:13:48
Source code size: 466 bytes / 24 lines
Pitched / IR pitched: No / No
Views / Downloads: 504 / 3306
Version history: 4 change(s)
Referenced in: [show references]