EMMA Coverage Report (generated Sun Feb 05 10:43:15 CET 2012)
[all classes][de.uka.ipd.sdq.sensorframework.visualisation.rvisualisation.reportitems]

COVERAGE SUMMARY FOR SOURCE FILE [SummaryReportItem.java]

nameclass, %method, %block, %line, %
SummaryReportItem.java0%   (0/1)0%   (0/2)0%   (0/109)0%   (0/19)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class SummaryReportItem0%   (0/1)0%   (0/2)0%   (0/109)0%   (0/19)
SummaryReportItem (String, String): void 0%   (0/1)0%   (0/19)0%   (0/3)
getText (): String 0%   (0/1)0%   (0/90)0%   (0/16)

1package de.uka.ipd.sdq.sensorframework.visualisation.rvisualisation.reportitems;
2 
3import java.text.DecimalFormat;
4 
5import org.rosuda.JRI.REXP;
6 
7/**Summarizes the values stored in a R variable by displaying
8 * some statistical measures.
9 * These measures are Minimum, 1st Quartile, Median, Mean, 
10 * 3rd Quartile, Maximum.
11 * @author groenda
12 */
13public class SummaryReportItem extends RCommandRReportItem {
14 
15        /**Initialized a new report item that summarizes the
16         * values stored in a R variable.
17         * @param rVariableName Name of the R variable in which the data is stored.
18         * @param displayName Name displayed when referring to the variable.
19         */
20        public SummaryReportItem(final String rVariableName, 
21                        final String displayName) {
22                super("summary(" + rVariableName + ")", 
23                                "Summary of Sensor " +  displayName);
24        }
25        
26        /** {@inheritDoc}
27         */
28        @Override
29        public String getText() {
30                StringBuilder result = new StringBuilder();
31                
32                result.append("<br/> <table border='1' cellspacing='3'><tr align='center'>");
33                result.append("<th>Min.</th><th> 1st Quart.</th><th>Median</th><th>Mean</th><th>3rd Quart.</th><th>Max.</th></tr>");
34                result.append("</tr><tr align='center'>");
35                
36                if (returnedValue.rtype == REXP.REALSXP) {
37                        double[] doubleArray = returnedValue.asDoubleArray();
38                        DecimalFormat df= new DecimalFormat();
39                        for (int measureNumber = 0; measureNumber < 6; measureNumber++) {
40                                // fix the number of used decimals using different formatters
41                                df.applyPattern("###.0");
42                                if (Math.abs(doubleArray[measureNumber])< 0.2) df.applyPattern("#0.0#E0#");
43                                if (Math.abs(doubleArray[measureNumber])>999) df.applyPattern("#0.0#E0#");
44                                df.format(doubleArray[measureNumber]);
45                                result.append("<td>"+df.format(doubleArray[measureNumber])+"</td>");
46                        }
47                        result.append("</tr></table>");
48                        return result.toString();
49                }
50                
51                return "N/A";
52        }
53        
54}

[all classes][de.uka.ipd.sdq.sensorframework.visualisation.rvisualisation.reportitems]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov