-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCard.java
More file actions
41 lines (35 loc) · 934 Bytes
/
Card.java
File metadata and controls
41 lines (35 loc) · 934 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
public class Card {
private String element;
private int powerNumber;
private String color;
public Card(String element, int powerNumber, String color) {
this.element = element;
this.powerNumber = powerNumber;
this.color = color;
}
public String getElement() {
return element;
}
public int getPowerNumber() {
return powerNumber;
}
public String getColor() {
return color;
}
public String getString() {
return this.element + "," + this.powerNumber + "," + this.color;
}
//Make sure the comparisons of cards check all values
public boolean equals(Card o) {
if (!this.element.equals(o.getElement())) {
return false;
}
if (this.powerNumber != o.getPowerNumber()) {
return false;
}
if (!this.color.equals(o.getColor())){
return false;
}
return true;
}
}