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

COVERAGE SUMMARY FOR SOURCE FILE [MemoryMeasurementDAO.java]

nameclass, %method, %block, %line, %
MemoryMeasurementDAO.java100% (1/1)43%  (3/7)59%  (82/139)59%  (19/32)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class MemoryMeasurementDAO100% (1/1)43%  (3/7)59%  (82/139)59%  (19/32)
addScalabilityMeasurement (ScalabilitySensor, Double [], double): Scalability... 0%   (0/1)0%   (0/34)0%   (0/7)
get (long): Measurement 0%   (0/1)0%   (0/7)0%   (0/1)
getMeasurements (): Collection 0%   (0/1)0%   (0/5)0%   (0/1)
removeMeasurement (Measurement, boolean): void 0%   (0/1)0%   (0/11)0%   (0/4)
MemoryMeasurementDAO (IDAOFactory): void 100% (1/1)100% (14/14)100% (5/5)
addStateMeasurement (StateSensor, State, double): StateMeasurement 100% (1/1)100% (34/34)100% (7/7)
addTimeSpanMeasurement (TimeSpanSensor, double, double): TimeSpanMeasurement 100% (1/1)100% (34/34)100% (7/7)

1package de.uka.ipd.sdq.sensorframework.dao.memory;
2 
3import java.util.Collection;
4import java.util.Collections;
5import java.util.HashMap;
6 
7import de.uka.ipd.sdq.sensorframework.entities.Measurement;
8import de.uka.ipd.sdq.sensorframework.entities.ScalabilityMeasurement;
9import de.uka.ipd.sdq.sensorframework.entities.ScalabilitySensor;
10import de.uka.ipd.sdq.sensorframework.entities.State;
11import de.uka.ipd.sdq.sensorframework.entities.StateMeasurement;
12import de.uka.ipd.sdq.sensorframework.entities.StateSensor;
13import de.uka.ipd.sdq.sensorframework.entities.TimeSpanMeasurement;
14import de.uka.ipd.sdq.sensorframework.entities.TimeSpanSensor;
15import de.uka.ipd.sdq.sensorframework.entities.dao.IDAOFactory;
16import de.uka.ipd.sdq.sensorframework.entities.dao.IMeasurementDAO;
17import de.uka.ipd.sdq.sensorframework.entities.impl.ScalabilityMeasurementImpl;
18import de.uka.ipd.sdq.sensorframework.entities.impl.StateMeasurementImpl;
19import de.uka.ipd.sdq.sensorframework.entities.impl.TimeSpanMeasurementImpl;
20 
21/**
22 * TODO
23 *
24 */
25public class MemoryMeasurementDAO implements IMeasurementDAO {
26 
27        private long nextID = 0;
28        private IDAOFactory myFactory;
29        private HashMap<Long, Measurement> index = new HashMap<Long, Measurement>();
30        
31        public MemoryMeasurementDAO(IDAOFactory myFactory){
32                this.myFactory = myFactory;
33        }
34        
35        public synchronized StateMeasurement addStateMeasurement(StateSensor p_sensor,
36                        State p_sensorstate, double p_eventtime) {
37                StateMeasurement result = new StateMeasurementImpl(myFactory);
38                result.setMeasurementID(nextID++);
39                result.setEventTime(p_eventtime);
40                result.setSensor(p_sensor);
41                result.setSensorState(p_sensorstate);
42                
43                index.put(result.getMeasurementID(), result);
44                return result;
45        }
46 
47        public synchronized TimeSpanMeasurement addTimeSpanMeasurement(TimeSpanSensor p_sensor,
48                        double p_eventtime, double p_timespan) {
49                TimeSpanMeasurement result = new TimeSpanMeasurementImpl(myFactory);
50                result.setMeasurementID(nextID++);
51                result.setEventTime(p_eventtime);
52                result.setSensor(p_sensor);
53                result.setTimeSpan(p_timespan);
54 
55                index.put(result.getMeasurementID(), result);
56                return result;
57        }
58        
59        public synchronized ScalabilityMeasurement addScalabilityMeasurement(ScalabilitySensor p_sensor,
60                        Double[] p_params, double p_result ) {
61                ScalabilityMeasurement result = new ScalabilityMeasurementImpl(myFactory);
62                result.setMeasurementID(nextID++);
63                result.setEventTime(p_result);
64                result.setSensor(p_sensor);
65                result.setParameters(p_params);
66 
67                index.put(result.getMeasurementID(), result);
68                return result;
69        }
70 
71        public synchronized Measurement get(long id) {
72                return index.get(id);
73        }
74 
75        public synchronized Collection<Measurement> getMeasurements() {
76                return Collections.unmodifiableCollection(index.values());
77        }
78 
79        public synchronized void removeMeasurement(Measurement measurement, boolean doCascade) {
80                if (measurement == null) {
81                        return;
82                }
83                                
84                index.remove(measurement.getMeasurementID());                
85        }
86}

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