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

nameclass, %method, %block, %line, %
StateSensorAndMeasurement.java100% (1/1)38%  (3/8)51%  (42/82)40%  (8/20)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class StateSensorAndMeasurement100% (1/1)38%  (3/8)51%  (42/82)40%  (8/20)
equals (Object): boolean 0%   (0/1)0%   (0/22)0%   (0/4)
getStates (): List 0%   (0/1)0%   (0/3)0%   (0/1)
serializeChildren (): void 0%   (0/1)0%   (0/1)0%   (0/1)
setFactory (FileDAOFactory): void 0%   (0/1)0%   (0/1)0%   (0/1)
store (): void 0%   (0/1)0%   (0/13)0%   (0/5)
StateSensorAndMeasurement (FileManager, ExperimentRun, Sensor): void 100% (1/1)100% (22/22)100% (4/4)
addState (double, State): void 100% (1/1)100% (12/12)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.FileDAOFactory;
11import de.uka.ipd.sdq.sensorframework.dao.file.FileManager;
12import de.uka.ipd.sdq.sensorframework.entities.ExperimentRun;
13import de.uka.ipd.sdq.sensorframework.entities.Measurement;
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.storage.lists.BackgroundMemoryList;
18 
19/**
20 * @author Ihssane El-Oudghiri 
21 */
22public class StateSensorAndMeasurement extends AbstractSensorAndMeasurements {
23 
24        private static final long serialVersionUID = -7553464522648015852L;
25        private BackgroundMemoryList<State> states;
26 
27        public StateSensorAndMeasurement(FileManager fm, ExperimentRun er, Sensor sensor) throws IOException {
28                super(fm, er, sensor);
29                states = new BackgroundMemoryList<State>(getMeasurementsFileName(),new StateSerializer((StateSensor) sensor));
30                fm.addOpenList(states);
31        }
32 
33        public void addState(double et, State state) {
34                eventTimes.add(et);
35                states.add(state);
36        }
37 
38        @Override
39        public boolean equals(Object obj) {
40                if (!(obj instanceof StateSensorAndMeasurement))
41                        return false;
42                StateSensorAndMeasurement sam = (StateSensorAndMeasurement) obj;
43                return (super.equals(obj)) && (getStates().equals(sam.getStates()));
44        }
45 
46        @Override
47        public List<Measurement> getMeasurements() {
48                return new StateMeasurementListWithBackgroundStore(eventTimes, states);
49        }
50 
51        public List<State> getStates() {
52                return states;
53        }
54 
55        public void serializeChildren() {
56                // Nothing to serialize here
57        }
58 
59        public void setFactory(FileDAOFactory factory) {
60        }
61 
62        @Override
63        public void store() {
64                super.store();
65                try {
66                        states.flush();
67                } catch (IOException e) {
68                        throw new RuntimeException(e);
69                }
70        }
71        
72}

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