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

COVERAGE SUMMARY FOR SOURCE FILE [SensorHelper.java]

nameclass, %method, %block, %line, %
SensorHelper.java0%   (0/1)0%   (0/4)0%   (0/96)0%   (0/17)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class SensorHelper0%   (0/1)0%   (0/4)0%   (0/96)0%   (0/17)
SensorHelper (): void 0%   (0/1)0%   (0/3)0%   (0/1)
createOrReuseState (IDAOFactory, String): State 0%   (0/1)0%   (0/20)0%   (0/4)
createOrReuseStateSensor (IDAOFactory, Experiment, String, State): StateSensor 0%   (0/1)0%   (0/37)0%   (0/6)
createOrReuseTimeSensor (IDAOFactory, Experiment, String): TimeSpanSensor 0%   (0/1)0%   (0/36)0%   (0/6)

1package de.uka.ipd.sdq.pipesandfilters.framework.recorder.sensorframework;
2 
3import de.uka.ipd.sdq.sensorframework.entities.Experiment;
4import de.uka.ipd.sdq.sensorframework.entities.Sensor;
5import de.uka.ipd.sdq.sensorframework.entities.State;
6import de.uka.ipd.sdq.sensorframework.entities.StateSensor;
7import de.uka.ipd.sdq.sensorframework.entities.TimeSpanSensor;
8import de.uka.ipd.sdq.sensorframework.entities.dao.IDAOFactory;
9import de.uka.ipd.sdq.sensorframework.entities.dao.ISensorDAO;
10import de.uka.ipd.sdq.sensorframework.entities.dao.IStateDAO;
11 
12public class SensorHelper {
13        public static StateSensor createOrReuseStateSensor(IDAOFactory f, Experiment experiment, String id, State initialState) {
14                ISensorDAO sensorDAO = f.createSensorDAO();
15                if (sensorDAO.findBySensorName(id).size() > 0) {
16                        for (Sensor s : sensorDAO.findBySensorName(id)) {
17                                if (s instanceof StateSensor && experiment.getSensors().contains(s))
18                                        return (StateSensor) s;
19                        }
20                }
21                return experiment.addStateSensor(initialState,id);
22        }
23 
24        public static State createOrReuseState(IDAOFactory f, String id) {
25                IStateDAO stateDAO = f.createStateDAO();
26                if (stateDAO.findByStateLiteral(id).size() == 1) {
27                        return stateDAO.findByStateLiteral(id).iterator().next();
28                }
29                return stateDAO.addState(id);
30        }
31 
32 
33        public static TimeSpanSensor createOrReuseTimeSensor(
34                        IDAOFactory f, Experiment experimentDatastore, String id) {
35                ISensorDAO sensorDAO = f.createSensorDAO();
36                if (sensorDAO.findBySensorName(id).size() > 0) {
37                        for (Sensor s : sensorDAO.findBySensorName(id)) {
38                                if (s instanceof TimeSpanSensor && experimentDatastore.getSensors().contains(s))
39                                        return (TimeSpanSensor) s;
40                        }
41                }
42                return experimentDatastore.addTimeSpanSensor(id);
43        }
44}

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