1 10 package mondrian.calc.impl; 11 12 import mondrian.olap.*; 13 import mondrian.olap.fun.FunUtil; 14 import mondrian.olap.type.NumericType; 15 import mondrian.calc.impl.AbstractCalc; 16 import mondrian.calc.DoubleCalc; 17 import mondrian.calc.Calc; 18 19 30 public abstract class AbstractDoubleCalc 31 extends AbstractCalc 32 implements DoubleCalc { 33 private final Calc[] calcs; 34 35 protected AbstractDoubleCalc(Exp exp, Calc[] calcs) { 36 super(exp); 37 this.calcs = calcs; 38 assert getType() instanceof NumericType; 39 } 40 41 public Object evaluate(Evaluator evaluator) { 42 final double d = evaluateDouble(evaluator); 43 if (d == FunUtil.DoubleNull) { 44 return null; 45 } 46 return new Double (d); 47 } 48 49 public Calc[] getCalcs() { 50 return calcs; 51 } 52 } 53 54 | Popular Tags |