forked from woowacourse/java-blackjack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCard.java
51 lines (40 loc) · 1.02 KB
/
Card.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
package blackjack.domain.card;
import java.util.Objects;
public class Card {
private final Value value;
private final Shape shape;
public Card(Value value, Shape shape) {
this.value = Objects.requireNonNull(value);
this.shape = Objects.requireNonNull(shape);
}
public int getMinScore() {
return value.getMinScore();
}
public int getMaxScore() {
return value.getMaxScore();
}
@Override
public boolean equals(Object object) {
if (this == object) {
return true;
}
if (object == null || getClass() != object.getClass()) {
return false;
}
Card card = (Card) object;
return value == card.value && shape == card.shape;
}
@Override
public int hashCode() {
return Objects.hash(value, shape);
}
public Value getValue() {
return value;
}
public Shape getShape() {
return shape;
}
public boolean isAce() {
return value.isAce();
}
}