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

nameclass, %method, %block, %line, %
TimeSpanSensorAndMeasurement.java100% (1/1)50%  (3/6)39%  (41/106)35%  (8/23)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class TimeSpanSensorAndMeasurement100% (1/1)50%  (3/6)39%  (41/106)35%  (8/23)
equalTimeSpans (TimeSpanSensorAndMeasurement, TimeSpanSensorAndMeasurement): ... 0%   (0/1)0%   (0/31)0%   (0/6)
equals (Object): boolean 0%   (0/1)0%   (0/21)0%   (0/4)
store (): void 0%   (0/1)0%   (0/13)0%   (0/5)
TimeSpanSensorAndMeasurement (FileManager, ExperimentRun, Sensor): void 100% (1/1)100% (20/20)100% (4/4)
addTimeSpan (double, double): void 100% (1/1)100% (13/13)100% (3/3)
getMeasurements (): List 100% (1/1)100% (8/8)100% (1/1)

1/**
2 * 
3 */
4package de.uka.ipd.sdq.sensorframework.dao.file.entities;
5 
6import java.io.IOException;
7import java.util.ArrayList;
8import java.util.List;
9 
10import de.uka.ipd.sdq.sensorframework.dao.file.FileManager;
11import de.uka.ipd.sdq.sensorframework.entities.ExperimentRun;
12import de.uka.ipd.sdq.sensorframework.entities.Measurement;
13import de.uka.ipd.sdq.sensorframework.entities.Sensor;
14import de.uka.ipd.sdq.sensorframework.storage.lists.BackgroundMemoryList;
15import de.uka.ipd.sdq.sensorframework.storage.lists.DoubleSerialiser;
16 
17/**
18 * @author Ihssane El-Oudghiri 
19 * @author Steffen Becker
20 * 
21 */
22public class TimeSpanSensorAndMeasurement extends AbstractSensorAndMeasurements {
23 
24        private static final long serialVersionUID = 3516448762554779531L;
25        private BackgroundMemoryList<Double> timeSpans;
26 
27        public TimeSpanSensorAndMeasurement(FileManager fm, ExperimentRun er, Sensor sensor) throws IOException {
28                super(fm, er, sensor);
29                timeSpans = new BackgroundMemoryList<Double>(getMeasurementsFileName(),new DoubleSerialiser());
30                fm.addOpenList(timeSpans);
31        }
32 
33        public synchronized void addTimeSpan(double et, double ts) {
34                eventTimes.add(et);
35                timeSpans.add(ts);
36        }
37 
38        @Override
39        public boolean equals(Object obj) {
40                if (!(obj instanceof TimeSpanSensorAndMeasurement))
41                        return false;
42                TimeSpanSensorAndMeasurement sam = (TimeSpanSensorAndMeasurement) obj;
43                
44                return super.equals(obj) && equalTimeSpans(this,sam);
45        }
46 
47        private boolean equalTimeSpans(
48                        TimeSpanSensorAndMeasurement sam1,
49                        TimeSpanSensorAndMeasurement sam2) {
50                if (sam1.timeSpans.size() == sam2.timeSpans.size()) {
51                        for (int i=0; i<sam1.timeSpans.size(); i++){
52                                if (sam1.timeSpans.get(i) != sam2.timeSpans.get(i))
53                                        return false;
54                        }
55                        return true;
56                } else {
57                        return false;
58                }
59        }
60 
61        @Override
62        public synchronized List<Measurement> getMeasurements() {
63                return new TimeSpanMeasurementListWithBackgroundStore(eventTimes, timeSpans);
64        }
65 
66        @Override
67        public void store() {
68                super.store();
69                try {
70                        timeSpans.flush();
71                } catch (IOException e) {
72                        throw new RuntimeException(e);
73                }
74        }
75        
76}

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