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

31
LINES

< > BotCompany Repo | #1033176 // Size [dev.]

JavaX fragment (include)

1  
sclass Size implements Comparable<Size> {
2  
  int x, y;
3  
  
4  
  *() {}
5  
  *(Point p) {
6  
    x = p.x;
7  
    y = p.y;
8  
  }
9  
  *(int *x, int *y) {}
10  
  
11  
  Point getPoint() {
12  
    ret new Point(x, y);
13  
  }
14  
  
15  
  public bool equals(O o) {
16  
    ret o instanceof Size && x == o/Size.x && y == o/Size.y;
17  
  }
18  
  
19  
  public int hashCode() {
20  
    ret boostHashCombine(x, y);
21  
  }
22  
  
23  
  // compare in scan order
24  
  public int compareTo(Size p) {
25  
    if (y != p.y) ret cmp(y, p.y);
26  
    ret cmp(x, p.x);
27  
  }
28  
  
29  
  public S toString() {
30  
    ret x + ", " + y;
31  
  }

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1033176
Snippet name: Size [dev.]
Eternal ID of this version: #1033176/1
Text MD5: 970d0d1ce76b3cc043a0ad9680270678
Author: stefan
Category: javax / recognition by compression
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-15 22:54:54
Source code size: 553 bytes / 31 lines
Pitched / IR pitched: No / No
Views / Downloads: 66 / 84
Referenced in: [show references]