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:34:03
12: *
13: */
14: public class CountStrategy extends MetricCalculationStrategy implements
15: Serializable {
16:
17: public Object operate(Object[] node, int index, Object measure,
18: Object[] aRow) {
19: if (Float.isNaN(((SharedFloat) node[index]).floatValue())) {
20: return SharedFloat.newFrom(1);
21: }
22: return ((SharedFloat) node[index]).add(1);
23: }
24:
25: public String getSQLFunction() throws InfoException {
26: return BasicSQLConstants.COUNT;
27: }
28:
29: }
|