-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPosition.java
More file actions
41 lines (32 loc) · 728 Bytes
/
Position.java
File metadata and controls
41 lines (32 loc) · 728 Bytes
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
//Author: Dennis Eriksson Berg
public class Position {
private double x;
private double y;
private Place place;
public Position(double x, double y) {
this.x = x;
this.y = y;
}
public void setPlace(Place p) {
place = p;
}
public double getX() {
return x;
}
public double getY() {
return y;
}
@Override
public boolean equals(Object o) {
if (o instanceof Position) {
Position position = (Position) o;
if (x == position.x && y == position.y) {
return true;
}
}
return false;
}
public int hashCode() {
return (int) (x * 10000 + y);
}
}