KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > calipso > reportgenerator > reportcalculator > CountStrategy


1 package com.calipso.reportgenerator.reportcalculator;
2
3 import com.calipso.reportgenerator.common.InfoException;
4
5 import java.io.Serializable JavaDoc;
6
7 /**
8  *
9  * User: jbassino
10  * Date: 03/11/2004
11  * Time: 14:34:03
12  *
13  */

14 public class CountStrategy extends MetricCalculationStrategy implements Serializable JavaDoc {
15
16   public Object JavaDoc operate(Object JavaDoc[] node, int index, Object JavaDoc measure, Object JavaDoc[] aRow) {
17     if(Float.isNaN(((SharedFloat)node[index]).floatValue())){
18       return SharedFloat.newFrom(1);
19     }
20     return ((SharedFloat)node[index]).add(1);
21   }
22
23   public String JavaDoc getSQLFunction() throws InfoException {
24     return BasicSQLConstants.COUNT;
25   }
26
27 }
28
Popular Tags