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

nameclass, %method, %block, %line, %
StateSensorImpl.java100% (1/1)86%  (6/7)81%  (79/98)77%  (17/22)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class StateSensorImpl100% (1/1)86%  (6/7)81%  (79/98)77%  (17/22)
addState (String): State 0%   (0/1)0%   (0/15)0%   (0/3)
equals (Object): boolean 100% (1/1)83%  (20/24)71%  (5/7)
StateSensorImpl (FileDAOFactory): void 100% (1/1)100% (9/9)100% (3/3)
addSensorState (State): void 100% (1/1)100% (8/8)100% (2/2)
getInitialState (): State 100% (1/1)100% (8/8)100% (1/1)
getSensorStates (): Collection 100% (1/1)100% (28/28)100% (4/4)
setInitialState (State): void 100% (1/1)100% (6/6)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.State;
12import de.uka.ipd.sdq.sensorframework.entities.StateSensor;
13 
14/**
15 * @author Ihssane El-Oudghiri 
16 * @author Steffen Becker
17 */
18public class StateSensorImpl extends SensorImpl implements StateSensor {
19 
20        private static final long serialVersionUID = -1981199624361875277L;
21        private Long initialStateID;
22        private ArrayList<Long> sensorStateIDs;
23 
24        public StateSensorImpl(FileDAOFactory factory) {
25                super(factory);
26                sensorStateIDs = new ArrayList<Long>();
27        }
28 
29        public void addSensorState(State value) {
30                sensorStateIDs.add(value.getStateID());
31        }
32 
33        public State addState(String p_stateliteral) {
34                State state = factory.createStateDAO().addState(p_stateliteral);
35                sensorStateIDs.add(state.getStateID());
36                return state;
37        }
38 
39        @Override
40        public boolean equals(Object obj) {
41                if (!(obj instanceof StateSensorImpl))
42                        return false;
43                StateSensorImpl s = (StateSensorImpl) obj;
44                if (!(sensorID == s.getSensorID() && sensorName.equals(s
45                                .getSensorName())))
46                        return false;
47 
48                return true;
49        }
50 
51        public State getInitialState() {
52                return factory.createStateDAO().get(initialStateID);
53        }
54 
55        public Collection<State> getSensorStates() {
56                ArrayList<State> result = new ArrayList<State>();
57                for (Long id : this.sensorStateIDs) {
58                        result.add(factory.createStateDAO().get(id));
59                }
60                return Collections.unmodifiableCollection(result);
61        }
62 
63        public void setInitialState(State value) {
64                this.initialStateID = value.getStateID();
65        }
66 
67}

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