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

COVERAGE SUMMARY FOR SOURCE FILE [SimulationProgressReportingObserver.java]

nameclass, %method, %block, %line, %
SimulationProgressReportingObserver.java0%   (0/1)0%   (0/3)0%   (0/78)0%   (0/20)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class SimulationProgressReportingObserver0%   (0/1)0%   (0/3)0%   (0/78)0%   (0/20)
SimulationProgressReportingObserver (AbstractSimulationConfig, EventAdmin, Si... 0%   (0/1)0%   (0/15)0%   (0/6)
postEvent (String, Hashtable): void 0%   (0/1)0%   (0/25)0%   (0/6)
updateStatus (int, double, long): void 0%   (0/1)0%   (0/38)0%   (0/8)

1package de.uka.ipd.sdq.simucomframework.simulationdock;
2 
3import java.util.Hashtable;
4import java.util.Map;
5 
6import org.osgi.service.event.Event;
7import org.osgi.service.event.EventAdmin;
8 
9import de.uka.ipd.sdq.simulation.AbstractSimulationConfig;
10import de.uka.ipd.sdq.simulation.IStatusObserver;
11 
12public class SimulationProgressReportingObserver implements IStatusObserver {
13        private int lastPercent = 0;
14        private AbstractSimulationConfig config;
15        private SimulationDockService myDock;
16        private EventAdmin eventAdmin;
17        
18        public SimulationProgressReportingObserver(AbstractSimulationConfig config,
19                        EventAdmin eventAdmin, SimulationDockService dock) {
20                this.config = config;
21                this.eventAdmin = eventAdmin;
22                this.myDock = dock;
23        }
24        
25        public void updateStatus(int percentDone, double currentSimTime,
26                        long measurementsTaken) {
27                if (percentDone > lastPercent ||  (config.isDebug() /* TODO: && myDock.isSuspended() */)){
28                        Hashtable<String,Object> properties = new Hashtable<String,Object>();
29                        properties.put("PERCENT_DONE", percentDone);
30                        properties.put("CURRENT_TIME", currentSimTime);
31                        properties.put("MEASUREMENTS_TAKEN", measurementsTaken);
32                        postEvent("de/uka/ipd/sdq/simucomframework/simucomdock/UPDATE_SIM_STATUS",properties);
33                        lastPercent = percentDone;
34                }
35        }
36 
37        private void postEvent(String topic, Hashtable<String,Object> newProperties) {
38                Hashtable<String,Object> properties = new Hashtable<String,Object>();
39                properties.put("DOCK_ID", myDock.getDockId());
40                properties.putAll(newProperties);
41                Event event = new Event(topic, (Map)properties);
42                eventAdmin.postEvent(event);
43        }
44        
45}

[all classes][de.uka.ipd.sdq.simucomframework.simulationdock]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov