sclass Pt is Comparable, IDoublePt { 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 Pt && x == o/Pt.x && y == o/Pt.y; } public int hashCode() { ret boostHashCombine(x, y); } // compare in scan order public int compareTo(Pt p) { if (y != p.y) ret cmp(y, p.y); ret cmp(x, p.x); } public S toString() { ret x + ", " + y; } double length() { ret sqrt(x*x+y*y); } public Pt minus(Pt p) { ret ptMinus(this, p); } public double x_double() { ret x; } public double y_double() { ret y; } }