blob: 84f45aa67f31d8d95a86e8ddb1fb66881e4c4705 (
plain)
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
|
package bjc.utils.dice.ast;
public enum OperatorDiceNode implements IDiceASTNode {
ASSIGN, ADD, SUBTRACT, MULTIPLY, DIVIDE, GROUP, COMPOUND;
@Override
public boolean isOperator() {
return true;
}
public static OperatorDiceNode fromString(String s) {
switch(s) {
case ":=":
return ASSIGN;
case "+":
return ADD;
case "-":
return SUBTRACT;
case "*":
return MULTIPLY;
case "/":
return DIVIDE;
case "d":
return GROUP;
case "c":
return COMPOUND;
default:
throw new IllegalArgumentException(s + " is not a valid operator node");
}
}
}
|