4 public class FlagOpNode extends FlagExpressionNode {
5 FlagExpressionNode left;
6 FlagExpressionNode right;
9 public FlagOpNode(FlagExpressionNode l, FlagExpressionNode r, Operation o) {
15 public FlagOpNode(FlagExpressionNode l, Operation o) {
21 public FlagExpressionNode getLeft() {
25 public FlagExpressionNode getRight() {
29 public Operation getOp() {
33 public String printNode(int indent) {
35 return op.toString()+"("+left.printNode(indent)+")";
37 return left.printNode(indent)+" "+op.toString()+" "+right.printNode(indent);
41 return Kind.FlagOpNode;
44 public DNFFlag getDNF() {
45 DNFFlag leftflag=left.getDNF();
46 DNFFlag rightflag=right!=null?right.getDNF():null;
48 if (op.getOp()==Operation.LOGIC_NOT) {
49 return leftflag.not();
50 } else if (op.getOp()==Operation.LOGIC_OR) {
51 return leftflag.or(rightflag);
52 } else if (op.getOp()==Operation.LOGIC_AND) {
53 return leftflag.and(rightflag);
54 } else throw new Error();