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

nameclass, %method, %block, %line, %
MemoryExperimentRunDAO.java100% (1/1)38%  (3/8)41%  (47/115)42%  (11/26)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class MemoryExperimentRunDAO100% (1/1)38%  (3/8)41%  (47/115)42%  (11/26)
addScalabilityExperimentRun (String): ExperimentRun 0%   (0/1)0%   (0/28)0%   (0/5)
get (long): ExperimentRun 0%   (0/1)0%   (0/7)0%   (0/1)
removeExperimentRun (ExperimentRun, boolean): void 0%   (0/1)0%   (0/31)0%   (0/7)
store (ExperimentRun): void 0%   (0/1)0%   (0/1)0%   (0/1)
storeAll (): void 0%   (0/1)0%   (0/1)0%   (0/1)
MemoryExperimentRunDAO (IDAOFactory): void 100% (1/1)100% (14/14)100% (5/5)
addExperimentRun (String): ExperimentRun 100% (1/1)100% (28/28)100% (5/5)
getExperimentRuns (): Collection 100% (1/1)100% (5/5)100% (1/1)

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.ExperimentRun;
8import de.uka.ipd.sdq.sensorframework.entities.Measurement;
9import de.uka.ipd.sdq.sensorframework.entities.dao.IDAOFactory;
10import de.uka.ipd.sdq.sensorframework.entities.dao.IExperimentRunDAO;
11import de.uka.ipd.sdq.sensorframework.entities.impl.ExperimentRunImpl;
12import de.uka.ipd.sdq.sensorframework.entities.impl.ScalabilityExperimentRunImpl;
13 
14/**
15 * TODO
16 *
17 */
18public class MemoryExperimentRunDAO implements IExperimentRunDAO {
19 
20        private long nextID = 0;
21        private IDAOFactory myFactory;
22        private HashMap<Long,ExperimentRun> index = new HashMap<Long, ExperimentRun>();
23        
24        public MemoryExperimentRunDAO(IDAOFactory memoryDAOFactory) {
25                this.myFactory = memoryDAOFactory;
26        }
27 
28        public synchronized ExperimentRun addExperimentRun(String p_experimentdatetime) {
29                ExperimentRun result = new ExperimentRunImpl(this.myFactory);
30                result.setExperimentRunID(nextID++);
31                result.setExperimentDateTime(p_experimentdatetime);
32                
33                index.put(result.getExperimentRunID(),result);
34                return result;
35        }
36        
37        public synchronized ExperimentRun addScalabilityExperimentRun(String p_experimentdatetime) {
38                ExperimentRun result = new ScalabilityExperimentRunImpl(this.myFactory);
39                result.setExperimentRunID(nextID++);
40                result.setExperimentDateTime(p_experimentdatetime);
41                
42                index.put(result.getExperimentRunID(),result);
43                return result;
44        }
45 
46        public synchronized ExperimentRun get(long id) {
47                return index.get(id);
48        }
49 
50        public synchronized Collection<ExperimentRun> getExperimentRuns() {
51                return Collections.unmodifiableCollection(index.values());
52        }
53 
54        public void store(ExperimentRun er) {
55        }
56 
57        public synchronized void removeExperimentRun(ExperimentRun experimentRun,
58                        boolean doCascade) {
59                if (experimentRun == null) {
60                        return;
61                }
62                
63                if ( doCascade == true ) {
64                        //remove all measurements
65                        for (Measurement measurement:experimentRun.getMeasurements()) {
66                                myFactory.createMeasurementDAO().removeMeasurement(measurement, true);
67                        }
68                }
69                index.remove(experimentRun.getExperimentRunID());                
70        }
71        
72        public void storeAll() {
73                // Nothing to do here
74        }
75        
76 
77}

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