-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShotReport.java
More file actions
33 lines (27 loc) · 833 Bytes
/
ShotReport.java
File metadata and controls
33 lines (27 loc) · 833 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
public final class ShotReport {
private final ShotResult result;
private final Coordinate coordinate;
private final String sunkShipName;
private final boolean gameWon;
public ShotReport(ShotResult result, Coordinate coordinate, String sunkShipName, boolean gameWon) {
this.result = result;
this.coordinate = coordinate;
this.sunkShipName = sunkShipName;
this.gameWon = gameWon;
}
public ShotResult getResult() {
return result;
}
public Coordinate getCoordinate() {
return coordinate;
}
public String getSunkShipName() {
return sunkShipName;
}
public boolean isGameWon() {
return gameWon;
}
public boolean grantsExtraTurn() {
return result == ShotResult.HIT || result == ShotResult.SUNK;
}
}