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

nameclass, %method, %block, %line, %
ScalabilitySensorAndMeasurement.java0%   (0/1)0%   (0/6)0%   (0/133)0%   (0/29)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ScalabilitySensorAndMeasurement0%   (0/1)0%   (0/6)0%   (0/133)0%   (0/29)
ScalabilitySensorAndMeasurement (FileManager, ExperimentRun, Sensor): void 0%   (0/1)0%   (0/22)0%   (0/6)
addResult (Double [], double): void 0%   (0/1)0%   (0/12)0%   (0/3)
equalTimeSpans (ScalabilitySensorAndMeasurement, ScalabilitySensorAndMeasurem... 0%   (0/1)0%   (0/31)0%   (0/6)
equals (Object): boolean 0%   (0/1)0%   (0/21)0%   (0/4)
getMeasurements (): List 0%   (0/1)0%   (0/34)0%   (0/5)
store (): void 0%   (0/1)0%   (0/13)0%   (0/5)

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.ScalabilitySensor;
14import de.uka.ipd.sdq.sensorframework.entities.Sensor;
15import de.uka.ipd.sdq.sensorframework.storage.lists.BackgroundMemoryList;
16 
17/**
18 * @author Ihssane El-Oudghiri 
19 * @author Steffen Becker
20 */
21public class ScalabilitySensorAndMeasurement extends AbstractSensorAndMeasurements {
22 
23        private static final long serialVersionUID = 3516448762784779531L;
24        private BackgroundMemoryList<Double[]> timeSpans;
25 
26        public ScalabilitySensorAndMeasurement(FileManager fm, ExperimentRun er, Sensor sensor) throws IOException {
27                super(fm, er, sensor);
28                timeSpans = new BackgroundMemoryList<Double[]>(
29                                getMeasurementsFileName(),
30                                new ParameterValueSerialiser((ScalabilitySensor)sensor));
31                fm.addOpenList(timeSpans);
32        }
33 
34        public synchronized void addResult(Double[] ts, double et) {
35                eventTimes.add(et);
36                timeSpans.add(ts);
37        }
38 
39        @Override
40        public boolean equals(Object obj) {
41                if (!(obj instanceof ScalabilitySensorAndMeasurement))
42                        return false;
43                ScalabilitySensorAndMeasurement sam = (ScalabilitySensorAndMeasurement) obj;
44                
45                return super.equals(obj) && equalTimeSpans(this,sam);
46        }
47 
48        private boolean equalTimeSpans(
49                        ScalabilitySensorAndMeasurement sam1,
50                        ScalabilitySensorAndMeasurement sam2) {
51                if (sam1.timeSpans.size() == sam2.timeSpans.size()) {
52                        for (int i=0; i<sam1.timeSpans.size(); i++){
53                                if (sam1.timeSpans.get(i) != sam2.timeSpans.get(i))
54                                        return false;
55                        }
56                        return true;
57                } else {
58                        return false;
59                }
60        }
61 
62        @Override
63        public synchronized List<Measurement> getMeasurements() {
64                ArrayList<Measurement> m = new ArrayList<Measurement>();
65                for (int i = 0; i < timeSpans.size(); i++) {
66                        m.add(new ScalabilityMeasurementImpl(i, eventTimes.get(i), timeSpans
67                                        .get(i)));
68                }
69                return m;
70        }
71 
72        @Override
73        public void store() {
74                super.store();
75                try {
76                        timeSpans.flush();
77                } catch (IOException e) {
78                        throw new RuntimeException(e);
79                }
80        }
81        
82}

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