1 28 29 package com.caucho.amber.expr.fun; 30 31 import com.caucho.amber.query.QueryParser; 32 import com.caucho.amber.expr.AmberExpr; 33 import com.caucho.amber.type.*; 34 import com.caucho.util.L10N; 35 36 import java.util.ArrayList ; 37 38 39 42 public class SumFunExpr extends FunExpr { 43 private static final L10N L = new L10N(SumFunExpr.class); 44 45 private AmberExpr _arg; 46 47 50 protected SumFunExpr(QueryParser parser, 51 String id, 52 ArrayList <AmberExpr> args, 53 boolean distinct) 54 { 55 super(parser, id, args, distinct); 56 57 _arg = args.get(0); 59 } 60 61 public static SumFunExpr create(QueryParser parser, 62 String id, 63 ArrayList <AmberExpr> args, 64 boolean distinct) 65 { 66 return new SumFunExpr(parser, id, args, distinct); 67 } 68 69 72 public Type getType() 73 { 74 Type argType = _arg.getType(); 76 77 if ((argType instanceof IntegerType) || 78 (argType instanceof PrimitiveIntType)) 79 return LongType.create(); 80 81 if ((argType instanceof FloatType) || 82 (argType instanceof PrimitiveFloatType)) 83 return DoubleType.create(); 84 85 return argType; 86 } 87 } 88 | Popular Tags |