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).

1  
sclass DoublePt is IDoublePt {
2  
  double x, y;
3  
  
4  
  *() {}
5  
  *(Point p) {
6  
    x = p.x;
7  
    y = p.y;
8  
  }
9  
  *(double *x, double *y) {}
10  
  
11  
  equals DoublePt p { ret x == p.x && y == p.y; }
12  
  public int hashCode() {
13  
    ret boostHashCombine(main hashCode(x), main hashCode(y));
14  
  }
15  
  
16  
  toString {
17  
    ret x + ", " + y;
18  
  }
19  
  
20  
  double length() { ret sqrt(x*x+y*y); }
21  
  
22  
  public double x_double() { ret x; }
23  
  public double y_double() { ret y; }
24  
}

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: 597 / 3418
Version history: 4 change(s)
Referenced in: [show references]