We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 119841a commit ae74fa5Copy full SHA for ae74fa5
yoonexample/src/main/java/stack/OperatorPriority.java
@@ -0,0 +1,35 @@
1
+package stack;
2
+
3
+public enum OperatorPriority {
4
+ TOP(3),
5
+ MID(2),
6
+ BOT(1),
7
+ NONE(-1);
8
9
+ private final int priority;
10
11
+ OperatorPriority(int priority) {
12
+ this.priority = priority;
13
+ }
14
15
+ public static OperatorPriority getOperatorPriority(char sign) {
16
+ switch (sign) {
17
+ case '*':
18
+ case '/':
19
+ return TOP;
20
+ case '+':
21
+ case '-':
22
+ return MID;
23
+ case '(':
24
+ return BOT;
25
+ default:
26
+ return NONE;
27
28
29
30
+ public int getPriority() {
31
+ return priority;
32
33
34
35
+}
0 commit comments