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

31
LINES

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

JavaX fragment (include)

sclass Size implements Comparable<Size> {
  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 Size && x == o/Size.x && y == o/Size.y;
  }
  
  public int hashCode() {
    ret boostHashCombine(x, y);
  }
  
  // compare in scan order
  public int compareTo(Size p) {
    if (y != p.y) ret cmp(y, p.y);
    ret cmp(x, p.x);
  }
  
  public S toString() {
    ret x + ", " + y;
  }

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: 62 / 77
Referenced in: [show references]