001package composite.four; 002public class Main { 003 public static void main(String[] args) { 004 Expr onePtwo = ExprFactory.newPlus 005 (ExprFactory.newConst(1), ExprFactory.newConst(2)); 006 007 ExprBuilder eb = ExprFactory.newMultBuilder(); 008 eb.add(ExprFactory.newConst(3)); 009 eb.add(ExprFactory.newConst(4)); 010 eb.add(onePtwo); 011 Expr multiplies = eb.toExpr(); 012 Expr m = ExprFactory.newMinus (onePtwo, multiplies); 013 014 System.out.println(m); 015 System.out.println("Value: " + m.eval()); 016 } 017}