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 [RCommandRReportItem.java]

nameclass, %method, %block, %line, %
RCommandRReportItem.java0%   (0/1)0%   (0/4)0%   (0/99)0%   (0/25)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class RCommandRReportItem0%   (0/1)0%   (0/4)0%   (0/99)0%   (0/25)
RCommandRReportItem (String, String): void 0%   (0/1)0%   (0/12)0%   (0/4)
generateData (RConnection): void 0%   (0/1)0%   (0/39)0%   (0/12)
getText (): String 0%   (0/1)0%   (0/44)0%   (0/7)
visit (IReportRenderingVisitor): void 0%   (0/1)0%   (0/4)0%   (0/2)

1package de.uka.ipd.sdq.sensorframework.visualisation.rvisualisation.reportitems;
2 
3import java.util.Vector;
4 
5import org.eclipse.core.runtime.IStatus;
6import org.rosuda.JRI.REXP;
7 
8import de.uka.ipd.sdq.sensorframework.visualisation.rvisualisation.RVisualisationPlugin;
9import de.uka.ipd.sdq.sensorframework.visualisation.rvisualisation.utils.RConnection;
10 
11/**Report item used to display statistical values. The last result 
12 * returned from R is considered to be the value of interest.
13 * @author groenda (comments, refactoring)
14 */
15public class RCommandRReportItem extends AbstractGeneratedTextRReportItem {
16 
17        /** The value returned from R after executing the provided command. */
18        protected REXP returnedValue = new REXP();
19        /** The R command which execution yields to the required value. */
20        protected String rCommands;
21 
22        /**Initializes a new report item.
23         * @param rCommands R commands that lead to the calculation of the 
24         *        statistical value.
25         * @param description Description of this report item.
26         */
27        public RCommandRReportItem(final String rCommands, 
28                        final String description) {
29                super(description);
30                this.rCommands = rCommands;
31        }
32        
33        /** {@inheritDoc}
34         */
35        @Override
36        public String getText() {
37                // Returns the saved value
38                if (returnedValue.rtype == REXP.INTSXP) {
39                        return "" + returnedValue.asInt();
40                } else if (returnedValue.rtype == REXP.REALSXP) {
41                        return "" + returnedValue.asDouble();
42                } else if (returnedValue.rtype == REXP.STRSXP) {
43                        return "" + returnedValue.asString();
44                } else {
45                        return "N/A";
46                }
47        }
48        
49        /** {@inheritDoc}
50         */
51        @Override
52        public void visit(final IReportRenderingVisitor renderingVisitor) {
53                renderingVisitor.visitGeneratedTextReportItem(this);
54        }
55 
56 
57        /** {@inheritDoc}
58         */
59        @Override
60        public void generateData(final RConnection rConnection) {
61                Vector<REXP> result = rConnection.execute(rCommands);
62                if (!result.isEmpty()) {
63                        returnedValue = result.lastElement();
64                } else {
65                        returnedValue = new REXP();
66                        RVisualisationPlugin.log(
67                                        IStatus.WARNING,
68                                        "The calculation of the R command report item \"" 
69                                        + getDescription() + "\" yield to no result. "
70                                        + "Most probably data import or the calculation in R "
71                                        + "went wrong. Details: lastConsoleMessage=" 
72                                        + rConnection.getLastConsoleMessage());
73                }
74        }
75}

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