blob: 828ee5a17aa69b9031d3bf3add3125b93b5787e9 (
plain) (
blame)
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
|
/*
* Code formatter project
* CS 4481
*/
package submit.ast;
/**
*
* @author edwajohn
*/
public enum UnaryOperatorType {
NOT("!"), NEG("-"), DEREF("*"), QUESTION("?");
private final String value;
private UnaryOperatorType(String value) {
this.value = value;
}
public static UnaryOperatorType fromString(String s) {
for (UnaryOperatorType at : UnaryOperatorType.values()) {
if (at.value.equals(s)) {
return at;
}
}
throw new RuntimeException("Illegal string in UnaryOperatorType.fromString()");
}
@Override
public String toString() {
return value;
}
}
|