-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathStrikeBallCount.java
More file actions
47 lines (37 loc) · 1016 Bytes
/
StrikeBallCount.java
File metadata and controls
47 lines (37 loc) · 1016 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 baseball.domain;
import baseball.constant.Constant;
public class StrikeBallCount {
private int strikeCount;
private int ballCount;
private final int length;
public StrikeBallCount() {
length = Constant.LENGTH.getValue();
}
public void resetCounts() {
strikeCount = 0;
ballCount = 0;
}
public void addStrikeCount() {
strikeCount++;
}
public void addBallCount() {
ballCount++;
}
public int getStrikeCount() {
return strikeCount;
}
public int getBallCount() {
return ballCount;
}
public boolean getIsComplete() {
return strikeCount == length;
}
@Override
public boolean equals(Object obj) {
if (obj instanceof StrikeBallCount) {
StrikeBallCount strikeBallCount = (StrikeBallCount) obj;
return strikeCount == strikeBallCount.getStrikeCount() && ballCount == strikeBallCount.getBallCount();
}
return false;
}
}