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

nameclass, %method, %block, %line, %
StateSensorToFrequencyPieAdapter.java0%   (0/1)0%   (0/3)0%   (0/73)0%   (0/12)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class StateSensorToFrequencyPieAdapter0%   (0/1)0%   (0/3)0%   (0/73)0%   (0/12)
StateSensorToFrequencyPieAdapter (SensorAndMeasurements): void 0%   (0/1)0%   (0/4)0%   (0/2)
calculateFractions (HashMap): double 0%   (0/1)0%   (0/64)0%   (0/9)
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.FrequencyPie;
6import de.uka.ipd.sdq.codegen.simudatavisualisation.datatypes.AbstractPie;
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 
13/**
14 * This adapter provides a frequency-based calculation of the individual pie
15 * fractions.
16 * 
17 * Used for execution result visualization (reliability-related).
18 * 
19 * @author brosch
20 * 
21 */
22public class StateSensorToFrequencyPieAdapter extends StateSensorToPieAdapter {
23 
24        /**
25         * Initializes the adapter with the given StateSensor measurements.
26         * 
27         * @param samInformation
28         *            Information about the StateSensor and the measurements
29         */
30        public StateSensorToFrequencyPieAdapter(
31                        final SensorAndMeasurements samInformation) {
32                super(samInformation);
33        }
34 
35        /*
36         * (non-Javadoc)
37         * @see de.uka.ipd.sdq.sensorframework.adapter.StateSensorToPieAdapter#calculateFractions(java.util.HashMap)
38         */
39        protected double calculateFractions(final HashMap<String, Double> fractions) {
40                for (State state : ((StateSensor) samInformation.getSensor())
41                                .getSensorStates()) {
42                        fractions.put(state.getStateLiteral(), 0.0);
43                }
44                for (Measurement m : samInformation.getMeasurements()) {
45                        StateMeasurement sm = (StateMeasurement) m;
46                        double oldValue = fractions.get(sm.getSensorState().getStateLiteral());
47                        double newValue = oldValue + 1.0;
48                        fractions.put(sm.getSensorState().getStateLiteral(), newValue);
49                }
50                return samInformation.getMeasurements().size();
51        }
52 
53        /*
54         * (non-Javadoc)
55         * @see de.uka.ipd.sdq.sensorframework.adapter.StateSensorToPieAdapter#instantiatePie(java.lang.String)
56         */
57        protected AbstractPie instantiatePie(String sensorName) {
58                return new FrequencyPie(sensorName);
59        }
60}

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