forked from next-step/java-baseball-playground
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDelimiter.java
More file actions
30 lines (25 loc) · 821 Bytes
/
Delimiter.java
File metadata and controls
30 lines (25 loc) · 821 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
package calculaotor;
import java.util.Objects;
public enum Delimiter {
PLUS("+"),
MINUS("-"),
MULTIPLICATION("*"),
DIVISION("/");
private final String delimiter;
Delimiter(String delimiter) {
this.delimiter = delimiter;
}
public static Delimiter findDelimiter(String delimiter) {
if (Objects.equals(delimiter, PLUS.delimiter)) {
return Delimiter.PLUS;
} else if (Objects.equals(delimiter, MINUS.delimiter)) {
return Delimiter.MINUS;
} else if (Objects.equals(delimiter, MULTIPLICATION.delimiter)) {
return Delimiter.MULTIPLICATION;
} else if (Objects.equals(delimiter, DIVISION.delimiter)) {
return Delimiter.DIVISION;
} else {
throw new RuntimeException();
}
}
}