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

COVERAGE SUMMARY FOR SOURCE FILE [ExperimentRunImpl.java]

nameclass, %method, %block, %line, %
ExperimentRunImpl.java100% (1/1)100% (2/2)100% (54/54)100% (13/13)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ExperimentRunImpl100% (1/1)100% (2/2)100% (54/54)100% (13/13)
ExperimentRunImpl (IDAOFactory): void 100% (1/1)100% (4/4)100% (2/2)
getMeasurementsOfSensor (Sensor): SensorAndMeasurements 100% (1/1)100% (50/50)100% (11/11)

1package de.uka.ipd.sdq.sensorframework.entities.impl;
2 
3import java.util.ArrayList;
4 
5import de.uka.ipd.sdq.sensorframework.entities.Measurement;
6import de.uka.ipd.sdq.sensorframework.entities.Sensor;
7import de.uka.ipd.sdq.sensorframework.entities.SensorAndMeasurements;
8import de.uka.ipd.sdq.sensorframework.entities.StateMeasurement;
9import de.uka.ipd.sdq.sensorframework.entities.TimeSpanMeasurement;
10import de.uka.ipd.sdq.sensorframework.entities.dao.IDAOFactory;
11 
12@javax.persistence.Entity
13public class ExperimentRunImpl extends de.uka.ipd.sdq.sensorframework.entities.base.AbstractExperimentRun {
14 
15        public ExperimentRunImpl(IDAOFactory myFactory) {
16                super(myFactory);
17        }
18 
19        @Override
20        public SensorAndMeasurements getMeasurementsOfSensor(Sensor sensor) {
21                // TODO: Fix this conceptually!!!
22//                EntityManager em = ExperimentDAO.singleton().getEntityManagerFactory().createEntityManager();
23//                Query q = em.createQuery("SELECT m FROM Measurement m WHERE FK_SENSOR = "+sensor.getSensorID());
24//                Collection <Measurement> result = q.getResultList();
25//                em.close();
26                ArrayList<Measurement> result = new ArrayList<Measurement>();
27                for (Measurement m: this.getMeasurements()) {
28                        if (m instanceof TimeSpanMeasurement) {
29                                TimeSpanMeasurement tsm = (TimeSpanMeasurement) m;
30                                if (tsm.getSensor() == sensor)
31                                        result.add(m);
32                        }
33                        if (m instanceof StateMeasurement) {
34                                StateMeasurement tsm = (StateMeasurement) m;
35                                if (tsm.getSensor() == sensor)
36                                        result.add(m);
37                        }
38                }
39                return new SensorAndMeasurements(sensor,result);
40        }
41}

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