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

COVERAGE SUMMARY FOR SOURCE FILE [StateSensorToFrequencyFailurePieAdapter.java]

nameclass, %method, %block, %line, %
StateSensorToFrequencyFailurePieAdapter.java0%   (0/1)0%   (0/3)0%   (0/85)0%   (0/17)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class StateSensorToFrequencyFailurePieAdapter0%   (0/1)0%   (0/3)0%   (0/85)0%   (0/17)
StateSensorToFrequencyFailurePieAdapter (SensorAndMeasurements): void 0%   (0/1)0%   (0/4)0%   (0/2)
calculateFractions (HashMap): double 0%   (0/1)0%   (0/76)0%   (0/14)
instantiatePie (String): AbstractPie 0%   (0/1)0%   (0/5)0%   (0/1)

1package de.uka.ipd.sdq.sensorframework.adapter;
2 
3import java.util.HashMap;
4 
5import de.uka.ipd.sdq.codegen.simudatavisualisation.datatypes.AbstractPie;
6import de.uka.ipd.sdq.codegen.simudatavisualisation.datatypes.FrequencyFailurePie;
7import de.uka.ipd.sdq.sensorframework.entities.Measurement;
8import de.uka.ipd.sdq.sensorframework.entities.SensorAndMeasurements;
9import de.uka.ipd.sdq.sensorframework.entities.State;
10import de.uka.ipd.sdq.sensorframework.entities.StateMeasurement;
11import de.uka.ipd.sdq.sensorframework.entities.StateSensor;
12 
13public class StateSensorToFrequencyFailurePieAdapter extends
14                StateSensorToPieAdapter {
15 
16        /**
17         * Initializes the adapter with the given StateSensor measurements.
18         * 
19         * @param samInformation
20         *            Information about the StateSensor and the measurements
21         */
22        public StateSensorToFrequencyFailurePieAdapter(
23                        final SensorAndMeasurements samInformation) {
24                super(samInformation);
25        }
26 
27        /*
28         * (non-Javadoc)
29         * 
30         * @seede.uka.ipd.sdq.sensorframework.adapter.StateSensorToPieAdapter#
31         * calculateFractions(java.util.HashMap)
32         */
33        protected double calculateFractions(final HashMap<String, Double> fractions) {
34                for (State state : ((StateSensor) samInformation.getSensor())
35                                .getSensorStates()) {
36                        if (!state.getStateLiteral().equals("Success")) {
37                                fractions.put(state.getStateLiteral(), 0.0);
38                        }
39                }
40                int failureCounter = 0;
41                for (Measurement m : samInformation.getMeasurements()) {
42                        StateMeasurement sm = (StateMeasurement) m;
43                        if(sm.getSensorState().getStateLiteral().equals("Success")){
44                                continue;
45                        }
46                        failureCounter++;
47                        double oldValue = fractions.get(sm.getSensorState().getStateLiteral());
48                        double newValue = oldValue + 1.0;
49                        fractions.put(sm.getSensorState().getStateLiteral(), newValue);
50                }
51                return failureCounter;
52        }
53 
54        /*
55         * (non-Javadoc)
56         * 
57         * @see
58         * de.uka.ipd.sdq.sensorframework.adapter.StateSensorToPieAdapter#instantiatePie
59         * (java.lang.String)
60         */
61        protected AbstractPie instantiatePie(String sensorName) {
62                return new FrequencyFailurePie(sensorName);
63        }
64 
65}

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