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

COVERAGE SUMMARY FOR SOURCE FILE [AbstractSensorAndMeasurements.java]

nameclass, %method, %block, %line, %
AbstractSensorAndMeasurements.java100% (1/1)38%  (3/8)69%  (86/124)59%  (16/27)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AbstractSensorAndMeasurements100% (1/1)38%  (3/8)69%  (86/124)59%  (16/27)
getFileName (): String 0%   (0/1)0%   (0/16)0%   (0/3)
getID (): long 0%   (0/1)0%   (0/4)0%   (0/1)
getSensor (): Sensor 0%   (0/1)0%   (0/3)0%   (0/1)
setSensor (SensorImpl): void 0%   (0/1)0%   (0/4)0%   (0/2)
store (): void 0%   (0/1)0%   (0/11)0%   (0/4)
AbstractSensorAndMeasurements (FileManager, ExperimentRun, Sensor): void 100% (1/1)100% (28/28)100% (7/7)
getEventTimeFileName (): String 100% (1/1)100% (29/29)100% (5/5)
getMeasurementsFileName (): String 100% (1/1)100% (29/29)100% (4/4)

1/**
2 * 
3 */
4package de.uka.ipd.sdq.sensorframework.dao.file.entities;
5 
6import java.io.File;
7import java.io.IOException;
8import java.util.List;
9 
10import de.uka.ipd.sdq.sensorframework.dao.file.FileDAOFactory;
11import de.uka.ipd.sdq.sensorframework.dao.file.FileManager;
12import de.uka.ipd.sdq.sensorframework.entities.ExperimentRun;
13import de.uka.ipd.sdq.sensorframework.entities.Measurement;
14import de.uka.ipd.sdq.sensorframework.entities.Sensor;
15import de.uka.ipd.sdq.sensorframework.storage.lists.BackgroundMemoryList;
16import de.uka.ipd.sdq.sensorframework.storage.lists.DoubleSerialiser;
17 
18/**TODO add documentation
19 * @author Ihssane El-Oudghiri 
20 * @author Steffen Becker
21 * 
22 */
23public abstract class AbstractSensorAndMeasurements 
24                extends AbstractFileEntity 
25                implements SerializableEntity {
26 
27        /**
28         * For serialization 
29         */
30        private static final long serialVersionUID = 1L;
31        
32        protected static final String EVENT_TIME_SUFFIX = "ET";
33        protected static final String MEASUREMENTS_SUFFIX = "MEAS";
34        
35        protected ExperimentRun experimentRun;
36        protected Sensor sensor;
37        protected BackgroundMemoryList<Double> eventTimes;
38        private FileManager fm;
39 
40        public AbstractSensorAndMeasurements(FileManager fm, ExperimentRun exprun, Sensor sensor) throws IOException {
41                super(fm.getDAOFactory());
42                this.sensor = sensor;
43                this.experimentRun = exprun;
44                this.fm = fm;
45                
46                eventTimes = new BackgroundMemoryList<Double>(getEventTimeFileName(), new DoubleSerialiser());
47                fm.addOpenList(eventTimes);
48        }
49 
50        protected String getEventTimeFileName() {
51                return fm.getRootDirectory() + File.separator +
52                FileDAOFactory.EXPRUN_FILE_NAME_PREFIX
53                + experimentRun.getExperimentRunID() + "_"
54                + sensor.getSensorID() + "_" +
55                EVENT_TIME_SUFFIX + ".ser";
56        }
57 
58        public String getFileName() {
59                return FileDAOFactory.EXPRUN_FILE_NAME_PREFIX
60                                + experimentRun.getExperimentRunID() + "_"
61                                + sensor.getSensorID();
62        }
63 
64        public long getID() {
65                throw new UnsupportedOperationException();
66        }
67 
68        public abstract List<Measurement> getMeasurements();
69 
70        protected String getMeasurementsFileName() {
71                return fm.getRootDirectory() + File.separator + FileDAOFactory.EXPRUN_FILE_NAME_PREFIX
72                + experimentRun.getExperimentRunID() + "_"
73                + sensor.getSensorID() + "_" +
74                MEASUREMENTS_SUFFIX + ".ser";
75        }
76 
77        public Sensor getSensor() {
78                return sensor;
79        }
80 
81        public void setSensor(SensorImpl sensor) {
82                this.sensor = sensor;
83        }
84        
85        /**
86         * Throws a RuntimeException if an IOException is encountered
87         */
88        public void store() {
89                try {
90                        eventTimes.flush();
91                } catch (IOException e) {
92                        throw new RuntimeException(e);
93                }
94        }
95}

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