-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathFinalResult.java
More file actions
47 lines (38 loc) Β· 824 Bytes
/
FinalResult.java
File metadata and controls
47 lines (38 loc) Β· 824 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
package bowling.frame.result;
import bowling.frame.Frame;
import bowling.score.Score;
public class FinalResult implements FrameResult {
private final Score score;
public static FinalResult of(final Score score) {
return new FinalResult(score);
}
private FinalResult(final Score score) {
this.score = score;
}
@Override
public Frame nextFrame() {
throw new IllegalArgumentException("λ§μ§λ§ νλ μ");
}
@Override
public Score getScore() {
return score;
}
@Override
public int getFrameNo() {
return Frame.MAX_NO;
}
@Override
public int getNextFrameNo() {
return Frame.MAX_NO;
}
@Override
public String toString() {
if (score.isTen()) {
return Strike.DISPLAY_STRING;
}
if (score.isZero()) {
return Gutter.DISPLAY_STRING;
}
return String.valueOf(score.toInt());
}
}