1 package com.calipso.reportgenerator.reportcalculator; 2 3 import com.calipso.reportgenerator.common.InfoException; 4 5 import java.io.Serializable ; 6 7 14 public class SumStrategy extends MetricCalculationStrategy implements Serializable { 15 16 public Object operate(Object [] node, int index, Object measure, Object [] aRow) { 17 SharedFloat sharedFloat = (SharedFloat)node[index]; 18 if (measure!=null){ 19 if(Float.isNaN(sharedFloat.floatValue())){ 20 return measure; } 22 return sharedFloat.add((SharedFloat)measure); 23 }else{ 24 return sharedFloat; 25 } 26 } 27 28 public String getSQLFunction() throws InfoException { 29 return BasicSQLConstants.SUM; 30 } 31 } 32 | Popular Tags |