KickJava   Java API By Example, From Geeks To Geeks.

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


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:41:12
12  *
13  */

14 public class MinStrategy extends MetricCalculationStrategy implements Serializable JavaDoc {
15 /* private boolean firstValue;
16
17   public MinStrategy(){
18     firstValue = true;
19   }*/

20
21   public Object JavaDoc operate(Object JavaDoc[] node, int index, Object JavaDoc measure, Object JavaDoc[] aRow) {
22     /*if(firstValue){
23       firstValue = false;
24       return SharedFloat.newFrom(measure);
25     }*/

26     SharedFloat sharedFloat = (SharedFloat)node[index];
27     if (measure!=null){
28       if(Float.isNaN(sharedFloat.floatValue())){
29         return measure;
30       }
31       if(sharedFloat.compareTo(measure) <= 0){
32         return sharedFloat;
33       }else{
34         return measure;
35       }
36     }else{
37       return sharedFloat;
38     }
39   }
40
41   public String JavaDoc getSQLFunction() throws InfoException {
42     return BasicSQLConstants.MIN;
43   }
44
45 }
46
Popular Tags