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

nameclass, %method, %block, %line, %
ExperimentImpl.java100% (1/1)56%  (10/18)43%  (104/242)41%  (24/59)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ExperimentImpl100% (1/1)56%  (10/18)43%  (104/242)41%  (24/59)
addExperimentRun (String): ExperimentRun 0%   (0/1)0%   (0/20)0%   (0/5)
addScalabilityExperimentRun (String): ExperimentRun 0%   (0/1)0%   (0/20)0%   (0/5)
addScalabilitySensor (String): ScalabilitySensor 0%   (0/1)0%   (0/15)0%   (0/4)
addStateSensor (State, String): StateSensor 0%   (0/1)0%   (0/16)0%   (0/4)
addTimeSpanSensor (String): TimeSpanSensor 0%   (0/1)0%   (0/15)0%   (0/4)
equals (Object): boolean 0%   (0/1)0%   (0/40)0%   (0/11)
getExperimentName (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getFileName (): String 0%   (0/1)0%   (0/9)0%   (0/1)
ExperimentImpl (IDAOFactory): void 100% (1/1)100% (14/14)100% (4/4)
addExperimentRun (ExperimentRun): void 100% (1/1)100% (8/8)100% (2/2)
addSensor (Sensor): void 100% (1/1)100% (8/8)100% (2/2)
getExperimentID (): long 100% (1/1)100% (3/3)100% (1/1)
getExperimentRuns (): Collection 100% (1/1)100% (28/28)100% (4/4)
getID (): long 100% (1/1)100% (3/3)100% (1/1)
getSensors (): Collection 100% (1/1)100% (28/28)100% (4/4)
setExperimentID (long): void 100% (1/1)100% (4/4)100% (2/2)
setExperimentName (String): void 100% (1/1)100% (4/4)100% (2/2)
setFactory (FileDAOFactory): void 100% (1/1)100% (4/4)100% (2/2)

1/**
2 * 
3 */
4package de.uka.ipd.sdq.sensorframework.dao.file.entities;
5 
6import java.util.ArrayList;
7import java.util.Collection;
8import java.util.Collections;
9 
10import de.uka.ipd.sdq.sensorframework.dao.file.FileDAOFactory;
11import de.uka.ipd.sdq.sensorframework.entities.Experiment;
12import de.uka.ipd.sdq.sensorframework.entities.ExperimentRun;
13import de.uka.ipd.sdq.sensorframework.entities.ScalabilitySensor;
14import de.uka.ipd.sdq.sensorframework.entities.Sensor;
15import de.uka.ipd.sdq.sensorframework.entities.State;
16import de.uka.ipd.sdq.sensorframework.entities.StateSensor;
17import de.uka.ipd.sdq.sensorframework.entities.TimeSpanSensor;
18import de.uka.ipd.sdq.sensorframework.entities.dao.IDAOFactory;
19 
20/**
21 * @author Ihssane El-Oudghiri 
22 * 
23 */
24public class ExperimentImpl extends AbstractFileEntity implements Experiment, SerializableEntity {
25 
26        /**
27         * Serialisation ID
28         */
29        private static final long serialVersionUID = 2145970711062278629L;
30 
31        /**
32         * ID of this Experiment
33         */
34        private long experimentID;
35 
36        /**
37         * Name of this experiment
38         */
39        private String experimentName;
40 
41        /**
42         * Collection of IDs of sensors in this experiment.
43         */
44        private Collection<Long> sensors;
45 
46        /**
47         * Collection of IDs of ExperimentRuns of this experiment.
48         */
49        private Collection<Long> experimentRuns;
50 
51        public ExperimentImpl(IDAOFactory factory) {
52                super(factory);
53                sensors = new ArrayList<Long>();
54                experimentRuns = new ArrayList<Long>();
55        }
56 
57        public void addExperimentRun(ExperimentRun experimentRun) {
58                experimentRuns.add(experimentRun.getExperimentRunID());
59        }
60 
61        public ExperimentRun addExperimentRun(String experimentdatetime) {
62                ExperimentRun expRun = factory.createExperimentRunDAO()
63                                .addExperimentRun(experimentdatetime);
64                experimentRuns.add(expRun.getExperimentRunID());
65                ((ExperimentRunImpl)expRun).setParentExperimentID(this.getID());
66                
67                return expRun;
68        }
69 
70        public ExperimentRun addScalabilityExperimentRun(String experimentdatetime) {
71                ExperimentRun expRun = factory.createExperimentRunDAO()
72                                .addScalabilityExperimentRun(experimentdatetime);
73                experimentRuns.add(expRun.getExperimentRunID());
74                ((ExperimentRunImpl)expRun).setParentExperimentID(this.getID());
75                
76                return expRun;
77        }
78 
79        public ScalabilitySensor addScalabilitySensor(String sensorName) {
80                ScalabilitySensor scals = factory.createSensorDAO().addScalabilitySensor(
81                                sensorName);
82                sensors.add(scals.getSensorID());
83                return scals;
84        }
85 
86        public void addSensor(Sensor value) {
87                sensors.add(value.getSensorID());
88        }
89 
90        public StateSensor addStateSensor(State p_initialstate, String p_sensorname) {
91                StateSensor stsen = factory.createSensorDAO().addStateSensor(
92                                p_initialstate, p_sensorname);
93                sensors.add(stsen.getSensorID());
94                return stsen;
95        }
96 
97        public TimeSpanSensor addTimeSpanSensor(String sensorName) {
98                TimeSpanSensor tss = factory.createSensorDAO().addTimeSpanSensor(
99                                sensorName);
100                sensors.add(tss.getSensorID());
101                return tss;
102        }
103 
104        @Override
105        public boolean equals(Object obj) {
106                if (!(obj instanceof ExperimentImpl))
107                        return false;
108                ExperimentImpl exp = (ExperimentImpl) obj;
109 
110                if (!(experimentID == exp.getExperimentID() && experimentName
111                                .equals(exp.getExperimentName())))
112                        return false;
113 
114                if (!(experimentRuns.equals(exp.getExperimentRuns())))
115                        return false;
116 
117                if (!(sensors.equals(exp.getSensors())))
118                        return false;
119 
120                return true;
121        }
122        
123        public long getExperimentID() {
124                return experimentID;
125        }
126 
127        public String getExperimentName() {
128                return experimentName;
129        }
130        
131        public Collection<ExperimentRun> getExperimentRuns() {
132                ArrayList<ExperimentRun> result = new ArrayList<ExperimentRun>();
133                for (Long id : experimentRuns) {
134                        result.add(factory.createExperimentRunDAO().get(id));
135                }
136                return Collections.unmodifiableCollection(result);
137        }
138 
139 
140        public String getFileName() {
141                return FileDAOFactory.EXP_FILE_NAME_PREFIX + getExperimentID();
142        }
143 
144        public long getID() {
145                return this.getExperimentID();
146        }
147 
148        /*
149         * (non-Javadoc)
150         * 
151         * @see de.uka.ipd.sdq.sensorframework.entities.Experiment#getSensors()
152         */
153        public Collection<Sensor> getSensors() {
154                ArrayList<Sensor> result = new ArrayList<Sensor>();
155                for (Long id : sensors) {
156                        result.add(factory.createSensorDAO().get(id));
157                }
158                return Collections.unmodifiableCollection(result);
159        }
160 
161        public void setExperimentID(long experimentID) {
162                this.experimentID = experimentID;
163        }
164 
165        public void setExperimentName(String experimentName) {
166                this.experimentName = experimentName;
167        }
168 
169        public void setFactory(FileDAOFactory factory) {
170                this.factory = factory;
171        }
172 
173}

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