KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > japex > report > ResultPerDriver


1 /*
2  * ResultPerDriver.java
3  *
4  * Created on April 10, 2005, 6:12 PM
5  */

6
7 package com.sun.japex.report;
8 import java.util.Map JavaDoc;
9 import java.util.HashMap JavaDoc;
10
11 /**
12  * Test results per driver
13  *
14  */

15 public class ResultPerDriver {
16     double _harmMean;
17     double _geomMean;
18     double _aritMean;
19     Map JavaDoc _testResults;
20     
21     /** Creates a new instance of ReportPerDriver */
22     public ResultPerDriver() {
23         _testResults = new HashMap JavaDoc();
24     }
25     public void setHarmMean(String JavaDoc value) {
26         try {
27             _harmMean = Double.parseDouble(value);
28         } catch (NumberFormatException JavaDoc e) {
29             System.out.println(e.getMessage());
30         }
31     }
32     public double getHarmMean() {
33         return _harmMean;
34     }
35     
36     public void setGeomMean(String JavaDoc value) {
37         try {
38             _geomMean = Double.parseDouble(value);
39         } catch (NumberFormatException JavaDoc e) {
40             System.out.println(e.getMessage());
41         }
42     }
43     public double getGeomMean() {
44         return _geomMean;
45     }
46     
47     public void setAritMean(String JavaDoc value) {
48         try {
49             _aritMean = Double.parseDouble(value);
50         } catch (NumberFormatException JavaDoc e) {
51             System.out.println(e.getMessage());
52         }
53     }
54     public double getAritMean() {
55         return _aritMean;
56     }
57     
58     public void addResult(String JavaDoc testName, String JavaDoc value) {
59         try {
60             _testResults.put(testName, new Double JavaDoc(Double.parseDouble(value)));
61         } catch (NumberFormatException JavaDoc e) {
62             System.out.println(e.getMessage());
63         }
64         
65     }
66     public double getResult(String JavaDoc testName) {
67         if (!_testResults.containsKey(testName)) return 0;
68         double value = ((Double JavaDoc)_testResults.get(testName)).doubleValue();
69         return value;
70     }
71     
72 }
73
Popular Tags