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

COVERAGE SUMMARY FOR SOURCE FILE [OverallUtilisationWriteDataStrategy.java]

nameclass, %method, %block, %line, %
OverallUtilisationWriteDataStrategy.java0%   (0/1)0%   (0/3)0%   (0/89)0%   (0/23)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class OverallUtilisationWriteDataStrategy0%   (0/1)0%   (0/3)0%   (0/89)0%   (0/23)
OverallUtilisationWriteDataStrategy (IDAOFactory, Experiment, ExperimentRun):... 0%   (0/1)0%   (0/6)0%   (0/2)
initialise (MetaDataInit): void 0%   (0/1)0%   (0/46)0%   (0/9)
writeData (PipeData): void 0%   (0/1)0%   (0/37)0%   (0/12)

1package de.uka.ipd.sdq.pipesandfilters.framework.recorder.sensorframework.strategies;
2 
3import java.util.HashMap;
4 
5import javax.measure.Measure;
6import javax.measure.quantity.Dimensionless;
7import javax.measure.quantity.Duration;
8import javax.measure.unit.SI;
9 
10import de.uka.ipd.sdq.pipesandfilters.framework.MetaDataInit;
11import de.uka.ipd.sdq.pipesandfilters.framework.PipeData;
12import de.uka.ipd.sdq.pipesandfilters.framework.recorder.sensorframework.SensorHelper;
13import de.uka.ipd.sdq.sensorframework.entities.Experiment;
14import de.uka.ipd.sdq.sensorframework.entities.ExperimentRun;
15import de.uka.ipd.sdq.sensorframework.entities.Sensor;
16import de.uka.ipd.sdq.sensorframework.entities.State;
17import de.uka.ipd.sdq.sensorframework.entities.StateSensor;
18import de.uka.ipd.sdq.sensorframework.entities.dao.IDAOFactory;
19 
20public class OverallUtilisationWriteDataStrategy extends AbstractWriteDataStrategy {
21 
22        private State idleState;
23 
24        private State busyState;
25 
26        public OverallUtilisationWriteDataStrategy(IDAOFactory daoFactory,
27                        Experiment experiment, ExperimentRun run) {
28                super(daoFactory, experiment, run);
29        }        
30 
31        public void initialise(MetaDataInit metaData) {
32                String sensorId = metaData.getMeasurementName();
33                this.idleState = SensorHelper.createOrReuseState(daoFactory, "Idle");
34                this.busyState = SensorHelper.createOrReuseState(daoFactory, "Busy");
35                sensor = SensorHelper.createOrReuseStateSensor(daoFactory, experiment,
36                                sensorId, idleState);
37                if (!((StateSensor) sensor).getSensorStates().contains(idleState)) {
38                        ((StateSensor) sensor).addSensorState(idleState);
39                }
40                ((StateSensor) sensor).addSensorState(busyState);
41        }
42 
43        @SuppressWarnings("unchecked")
44        @Override
45        public void writeData(PipeData data) {
46                Measure<Double, Duration> measurementTimeMeasure = (Measure<Double, Duration>) data
47                                .getTupleElement(0);
48                double measurementTime = measurementTimeMeasure.doubleValue(SI.SECOND);
49                Measure<Integer, Dimensionless> numericStateMeasure = (Measure<Integer, Dimensionless>) data
50                                .getTupleElement(1);
51                int numericState = numericStateMeasure.intValue(Dimensionless.UNIT);
52                State state = null;
53                if (numericState == 0) {
54                        state = idleState;
55                } else {
56                        state = busyState;
57                }
58                run.addStateMeasurement((StateSensor)sensor, state, measurementTime);
59        }
60 
61}

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