01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
package enumeration2;

public class ExprFactory {
  private ExprFactory() {}
  static public Expr newConst(int v) {
    return new Const(v);
  }
  static public Expr newPlus(Expr l, Expr r) {
    return new BinOp(l, Op.ADD, r);
  }
  static public Expr newMinus(Expr l, Expr r) {
    return new BinOp(l, Op.SUB, r);
  }
  static public Expr newMult(Expr l, Expr r) {
    return new BinOp(l, Op.MUL, r);
  }
  static public Expr newQuot(Expr l, Expr r) {
    return new BinOp(l, Op.DIV, r);
  }
}