-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPoint.java
54 lines (44 loc) · 1.02 KB
/
Point.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package com.github.lleuad0.abbyydevcourse;
public class Point {
private int x;
private int y;
public Point(int x, int y) {
this.x = x;
this.y = y;
}
public int getX() {
return x;
}
public int getY() {
return y;
}
/*
public boolean equals(Object object) {
boolean result = false;
if (object instanceof Point) {
Point point = (Point) object;
if (x == point.x && y == point.y) {
result = true;
}
}
return result;
}
public int hashcode() {
return x + y * 31;
}
*/
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Point point = (Point) o;
if (x != point.x) return false;
return y == point.y;
}
@Override
public int hashCode() {
int result = x;
result = 31 * result + y;
return result;
}
}