diff options
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/parserutils/ShuntingYard.java')
| -rw-r--r-- | BJC-Utils2/src/main/java/bjc/utils/parserutils/ShuntingYard.java | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/BJC-Utils2/src/main/java/bjc/utils/parserutils/ShuntingYard.java b/BJC-Utils2/src/main/java/bjc/utils/parserutils/ShuntingYard.java index ace636e..8a036ce 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/parserutils/ShuntingYard.java +++ b/BJC-Utils2/src/main/java/bjc/utils/parserutils/ShuntingYard.java @@ -19,7 +19,7 @@ import bjc.utils.funcdata.FunctionalList; */ public class ShuntingYard<E> { - private static enum Operator implements IPrecedent { + public static enum Operator implements IPrecedent { ADD(1), DIVIDE(4), MULTIPLY(3), SUBTRACT(2); private final int precedence; @@ -39,9 +39,6 @@ public class ShuntingYard<E> { } } - static { - } - /** * Holds all the shuntable operations */ @@ -64,6 +61,16 @@ public class ShuntingYard<E> { * * @param tok * The token representing the operator + */ + public void addOp(String tok, int i) { + this.addOp(tok, IPrecedent.newSimplePrecedent(i)); + } + + /** + * Add an operator to the list of shuntable operators + * + * @param tok + * The token representing the operator * @param prec * The precedence of the operator */ @@ -127,14 +134,4 @@ public class ShuntingYard<E> { public void removeOp(String tok) { ops.remove(tok); } - - /** - * Add an operator to the list of shuntable operators - * - * @param tok - * The token representing the operator - */ - public void addOp(String tok, int i) { - this.addOp(tok, IPrecedent.newSimplePrecedent(i)); - } }
\ No newline at end of file |
