blob: 2d11079b39e2714059ddbbf27b2a96afe01ab4de (
plain)
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
|
package edu.brown.cs.student.term.hub;
import java.util.*;
public class Holder {
private int id;
private String name;
private double suspicionScore;
private Set<Holder> followers;
public Holder(int id, String name) {
this.id = id;
this.name = name;
followers = new HashSet<>();
}
public int getId() {
return id;
}
public void setSuspicionScore(double sus){
this.suspicionScore = sus;
}
public double getSuspicionScore(){return suspicionScore;}
public String getName() {
return name;
}
public Set<Holder> getFollowers() {
return followers;
}
public void addFollower(Holder follower){
followers.add(follower);
}
@Override
public String toString() {
return name;
}
public String toTestString() {
return "Holder{" +
"id=" + id +
", name='" + name + '\'' +
", suspicionScore=" + suspicionScore +
", followers=" + followers +
'}';
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Holder holder = (Holder) o;
return id == holder.id && Objects.equals(name, holder.name);
}
@Override
public int hashCode() {
return Objects.hash(id, name);
}
}
|