-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCouple.java
More file actions
41 lines (30 loc) · 875 Bytes
/
Copy pathCouple.java
File metadata and controls
41 lines (30 loc) · 875 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
41
package conlan.math;
public class Couple {
public int a;
public int b;
public Couple(int a, int b)
{
this.a = a;
this.b = b;
}
public String toString()
{
return "a: " + a + " b: " + b;
}
@Override
public boolean equals(Object obj) {
if(this == obj)
return true;
if(obj == null || obj.getClass() != this.getClass())
return false;
Couple couple = (Couple) obj;
//TODO rename these four booleans
boolean firstConditionOne = this.a == couple.a;
boolean firstConditionTwo = this.b == couple.b;
boolean secondConditionOne = this.a == couple.b;
boolean secondConditionTwo = this.b == couple.a;
if (firstConditionOne && firstConditionTwo || secondConditionOne && secondConditionTwo)
return true;
return false;
}
}