File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed
PennMobile/src/main/java/com/pennapps/labs/pennmobile/classes Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,13 @@ class Poll {
47
47
@Expose
48
48
var isVisible : Boolean = false
49
49
50
+ override fun equals (other : Any? ): Boolean {
51
+ return other is Poll && this .id == other.id && this .totalVotes == other.totalVotes
52
+ && this .question == other.question && this .options.size == other.options.size
53
+ && this .options.containsAll(other.options) && other.options.containsAll(this .options)
54
+ }
55
+
56
+
50
57
// @Expose
51
58
// var homeAdapter : HomeAdapter? = null
52
59
@@ -72,6 +79,21 @@ class Poll {
72
79
// gui?.notifyDataSetChanged()
73
80
}
74
81
82
+ override fun hashCode (): Int {
83
+ var result = id ? : 0
84
+ result = 31 * result + (clubCode?.hashCode() ? : 0 )
85
+ result = 31 * result + (question?.hashCode() ? : 0 )
86
+ result = 31 * result + (createdDate?.hashCode() ? : 0 )
87
+ result = 31 * result + (startDate?.hashCode() ? : 0 )
88
+ result = 31 * result + (expireDate?.hashCode() ? : 0 )
89
+ result = 31 * result + multiselect.hashCode()
90
+ result = 31 * result + (clubComment?.hashCode() ? : 0 )
91
+ result = 31 * result + options.hashCode()
92
+ result = 31 * result + totalVotes
93
+ result = 31 * result + isVisible.hashCode()
94
+ return result
95
+ }
96
+
75
97
// Device id + poll id -> hash -> id
76
98
77
99
}
Original file line number Diff line number Diff line change @@ -24,4 +24,20 @@ class PollOption {
24
24
var selected : Boolean = false
25
25
26
26
var isVisible : Boolean = false
27
+ override fun equals (other : Any? ): Boolean {
28
+ return other is PollOption && this .choice == other.choice && this .id == other.id
29
+ && this .voteCount == other.voteCount
30
+ }
31
+
32
+ override fun hashCode (): Int {
33
+ var result = id ? : 0
34
+ result = 31 * result + (poll ? : 0 )
35
+ result = 31 * result + (choice?.hashCode() ? : 0 )
36
+ result = 31 * result + voteCount
37
+ result = 31 * result + selected.hashCode()
38
+ result = 31 * result + isVisible.hashCode()
39
+ return result
40
+ }
41
+
42
+
27
43
}
You can’t perform that action at this time.
0 commit comments