-
Notifications
You must be signed in to change notification settings - Fork 0
/
Expert.java
74 lines (66 loc) · 1.93 KB
/
Expert.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import java.util.Comparator;
import java.util.Objects;
public class Expert {
public int expertId;
public double distance;
public static Comparator<Expert> DistComparator() {
Comparator comp = new Comparator<Expert>() {
public int compare(Expert s1, Expert s2) {
if (s1.distance > s2.distance)
return 1;
if (s1.distance < s2.distance)
return -1;
return 0;
}
};
return comp;
}
public Expert()
{
// this.expertId = expertId;
// this.distance = distance;
}
public int getExpertId()
{
return expertId;
}
public void setExpertId(int expertId)
{
this.expertId = expertId;
}
public double getDistance()
{
return distance;
}
public void setDistance(double distance)
{
this.distance = distance;
}
@Override public String toString()
{
return String.format("(%d,%f)", expertId, distance);
}
@Override public int hashCode()
{
int hash = 7;
hash = 79 * hash + Objects.hashCode(this.expertId);
hash = 79 * hash + Objects.hashCode(this.distance);
return hash;
}
@Override public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Expert other = (Expert) obj;
if (!Objects.equals(this.expertId, other.expertId)) {
return false;
}
if (!Objects.equals(this.distance, other.distance)) {
return false;
}
return true;
}
}