01: package com.calipso.reportgenerator.reportcalculator;
02:
03: import com.calipso.reportgenerator.common.InfoException;
04:
05: import java.io.Serializable;
06:
07: /**
08: *
09: * User: jbassino
10: * Date: 03/11/2004
11: * Time: 14:32:10
12: *
13: */
14: public class SumStrategy extends MetricCalculationStrategy implements
15: Serializable {
16:
17: public Object operate(Object[] node, int index, Object measure,
18: Object[] aRow) {
19: SharedFloat sharedFloat = (SharedFloat) node[index];
20: if (measure != null) {
21: if (Float.isNaN(sharedFloat.floatValue())) {
22: return measure;//SharedFloat.newFrom((Float)measure);
23: }
24: return sharedFloat.add((SharedFloat) measure);
25: } else {
26: return sharedFloat;
27: }
28: }
29:
30: public String getSQLFunction() throws InfoException {
31: return BasicSQLConstants.SUM;
32: }
33: }
|