3 public class AssignOperation {
4 public static final int EQ=1;
5 public static final int MULTEQ=2;
6 public static final int DIVEQ=3;
7 public static final int MODEQ=4;
8 public static final int PLUSEQ=5;
9 public static final int MINUSEQ=6;
10 public static final int LSHIFTEQ=7;
11 public static final int RSHIFTEQ=8;
12 public static final int URSHIFTEQ=9;
13 public static final int ANDEQ=10;
14 public static final int XOREQ=11;
15 public static final int OREQ=12;
17 private int operation;
18 public AssignOperation(int op) {
22 public AssignOperation(String op) {
23 this.operation=parseOp(op);
26 public Operation getBaseOp() {
31 return new Operation(Operation.MULT);
33 return new Operation(Operation.DIV);
35 return new Operation(Operation.MOD);
37 return new Operation(Operation.ADD);
39 return new Operation(Operation.SUB);
41 return new Operation(Operation.LEFTSHIFT);
43 return new Operation(Operation.RIGHTSHIFT);
45 return new Operation(Operation.BIT_AND);
47 return new Operation(Operation.BIT_XOR);
49 return new Operation(Operation.BIT_OR);
54 public static int parseOp(String st) {
57 else if (st.equals("multeq"))
59 else if (st.equals("diveq"))
61 else if (st.equals("modeq"))
63 else if (st.equals("pluseq"))
65 else if (st.equals("minuseq"))
67 else if (st.equals("lshifteq"))
69 else if (st.equals("rshifteq"))
71 else if (st.equals("andeq"))
73 else if (st.equals("xoreq"))
75 else if (st.equals("oreq"))
77 else throw new Error();
80 public String toString() {
83 else if (operation==MULTEQ)
85 else if (operation==DIVEQ)
87 else if (operation==MODEQ)
89 else if (operation==PLUSEQ)
91 else if (operation==MINUSEQ)
93 else if (operation==LSHIFTEQ)
95 else if (operation==RSHIFTEQ)
97 else if (operation==ANDEQ)
99 else if (operation==XOREQ)
101 else if (operation==OREQ)
103 else throw new Error();