-
Notifications
You must be signed in to change notification settings - Fork 738
Expand file tree
/
Copy pathPlayer.java
More file actions
48 lines (34 loc) · 947 Bytes
/
Player.java
File metadata and controls
48 lines (34 loc) · 947 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
42
43
44
45
46
47
48
package nextstep.ladder.domain;
import java.util.Objects;
public class Player {
private final PlayerName name;
private Result result;
private final int startPosition;
public Player(PlayerName name, int startPosition) {
this.name = name;
this.startPosition = startPosition;
}
public PlayerName getName() {
return name;
}
public int getStartPosition() {
return startPosition;
}
public void saveResult(Result result) {
this.result = result;
}
public Result getResult() {
return result;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Player player = (Player) o;
return Objects.equals(name, player.name);
}
@Override
public int hashCode() {
return name != null ? name.hashCode() : 0;
}
}