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

COVERAGE SUMMARY FOR SOURCE FILE [SimulationDebugThread.java]

nameclass, %method, %block, %line, %
SimulationDebugThread.java0%   (0/1)0%   (0/26)0%   (0/168)0%   (0/55)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class SimulationDebugThread0%   (0/1)0%   (0/26)0%   (0/168)0%   (0/55)
SimulationDebugThread (IDebugTarget, ILaunch, DockModel): void 0%   (0/1)0%   (0/20)0%   (0/6)
canResume (): boolean 0%   (0/1)0%   (0/2)0%   (0/1)
canStepInto (): boolean 0%   (0/1)0%   (0/2)0%   (0/1)
canStepOver (): boolean 0%   (0/1)0%   (0/9)0%   (0/1)
canStepReturn (): boolean 0%   (0/1)0%   (0/2)0%   (0/1)
canSuspend (): boolean 0%   (0/1)0%   (0/2)0%   (0/1)
canTerminate (): boolean 0%   (0/1)0%   (0/2)0%   (0/1)
dispose (): void 0%   (0/1)0%   (0/11)0%   (0/4)
getBreakpoints (): IBreakpoint [] 0%   (0/1)0%   (0/3)0%   (0/1)
getName (): String 0%   (0/1)0%   (0/10)0%   (0/1)
getPriority (): int 0%   (0/1)0%   (0/2)0%   (0/1)
getStackFrames (): IStackFrame [] 0%   (0/1)0%   (0/3)0%   (0/1)
getTopStackFrame (): IStackFrame 0%   (0/1)0%   (0/2)0%   (0/1)
hasStackFrames (): boolean 0%   (0/1)0%   (0/2)0%   (0/1)
isStepping (): boolean 0%   (0/1)0%   (0/4)0%   (0/1)
isSuspended (): boolean 0%   (0/1)0%   (0/4)0%   (0/1)
isTerminated (): boolean 0%   (0/1)0%   (0/3)0%   (0/1)
notifyChanged (Notification): void 0%   (0/1)0%   (0/1)0%   (0/1)
resume (): void 0%   (0/1)0%   (0/5)0%   (0/2)
setSimControl (SimulationDockService): void 0%   (0/1)0%   (0/1)0%   (0/1)
stepInto (): void 0%   (0/1)0%   (0/1)0%   (0/1)
stepOver (): void 0%   (0/1)0%   (0/5)0%   (0/2)
stepReturn (): void 0%   (0/1)0%   (0/1)0%   (0/1)
suspend (): void 0%   (0/1)0%   (0/5)0%   (0/2)
terminate (): void 0%   (0/1)0%   (0/5)0%   (0/2)
update (Observable, Object): void 0%   (0/1)0%   (0/61)0%   (0/18)

1/**
2 * 
3 */
4package de.uka.ipd.sdq.codegen.simucontroller.debug;
5 
6import java.util.Observable;
7import java.util.Observer;
8 
9import org.eclipse.debug.core.DebugEvent;
10import org.eclipse.debug.core.DebugException;
11import org.eclipse.debug.core.ILaunch;
12import org.eclipse.debug.core.model.IBreakpoint;
13import org.eclipse.debug.core.model.IDebugTarget;
14import org.eclipse.debug.core.model.IStackFrame;
15import org.eclipse.debug.core.model.IThread;
16import org.eclipse.emf.common.notify.Notification;
17 
18import de.uka.ipd.sdq.codegen.simucontroller.dockmodel.DockModel;
19import de.uka.ipd.sdq.codegen.simucontroller.dockmodel.events.DockEvent;
20import de.uka.ipd.sdq.codegen.simucontroller.dockmodel.events.DockPerformedDebugStepEvent;
21import de.uka.ipd.sdq.codegen.simucontroller.dockmodel.events.DockResumedEvent;
22import de.uka.ipd.sdq.codegen.simucontroller.dockmodel.events.DockSimTimeChangedEvent;
23import de.uka.ipd.sdq.codegen.simucontroller.dockmodel.events.DockSimulationTerminatedEvent;
24import de.uka.ipd.sdq.codegen.simucontroller.dockmodel.events.DockStartedDebugStepEvent;
25import de.uka.ipd.sdq.codegen.simucontroller.dockmodel.events.DockSuspendedEvent;
26import de.uka.ipd.sdq.simucomframework.simulationdock.SimulationDockService;
27 
28/**
29 * @author Snowball
30 *
31 */
32public class SimulationDebugThread extends SimulationDebugElement implements
33                IThread, Observer {
34 
35        private DockModel myDock;
36        private boolean isTerminated;
37 
38        public SimulationDebugThread(IDebugTarget myDebugTarget, ILaunch launch, DockModel dock) {
39                super(myDebugTarget, launch);
40 
41                if (this.myDebugTarget == null)
42                        throw new IllegalArgumentException("Debug target has to be set");
43 
44                this.myDock = dock;
45                this.myDock.addObserver(this);
46        }
47 
48        /* (non-Javadoc)
49         * @see org.eclipse.debug.core.model.IThread#getBreakpoints()
50         */
51        public IBreakpoint[] getBreakpoints() {
52                return new IBreakpoint[0];
53        }
54 
55        /* (non-Javadoc)
56         * @see org.eclipse.debug.core.model.IThread#getName()
57         */
58        public String getName() throws DebugException {
59                return "Simulation Event Processor - SimTime: "+this.myDock.getSimTime();
60        }
61 
62        /* (non-Javadoc)
63         * @see org.eclipse.debug.core.model.IThread#getPriority()
64         */
65        public int getPriority() throws DebugException {
66                return 0;
67        }
68 
69        /* (non-Javadoc)
70         * @see org.eclipse.debug.core.model.IThread#getStackFrames()
71         */
72        public IStackFrame[] getStackFrames() throws DebugException {
73                return new IStackFrame[0];
74        }
75 
76        /* (non-Javadoc)
77         * @see org.eclipse.debug.core.model.IThread#getTopStackFrame()
78         */
79        public IStackFrame getTopStackFrame() throws DebugException {
80                return null;
81        }
82 
83        /* (non-Javadoc)
84         * @see org.eclipse.debug.core.model.IThread#hasStackFrames()
85         */
86        public boolean hasStackFrames() throws DebugException {
87                return false;
88        }
89 
90        /* (non-Javadoc)
91         * @see org.eclipse.debug.core.model.ISuspendResume#canResume()
92         */
93        public boolean canResume() {
94                return true;
95        }
96 
97        /* (non-Javadoc)
98         * @see org.eclipse.debug.core.model.ISuspendResume#canSuspend()
99         */
100        public boolean canSuspend() {
101                return true;
102        }
103 
104        /* (non-Javadoc)
105         * @see org.eclipse.debug.core.model.ISuspendResume#isSuspended()
106         */
107        public boolean isSuspended() {
108                return myDock.isSuspended();
109        }
110 
111        /* (non-Javadoc)
112         * @see org.eclipse.debug.core.model.ISuspendResume#resume()
113         */
114        public void resume() throws DebugException {
115                myDock.getService().resume();
116        }
117 
118        /* (non-Javadoc)
119         * @see org.eclipse.debug.core.model.ISuspendResume#suspend()
120         */
121        public void suspend() throws DebugException {
122                myDock.getService().suspend();
123        }
124 
125        /* (non-Javadoc)
126         * @see org.eclipse.debug.core.model.IStep#canStepInto()
127         */
128        public boolean canStepInto() {
129                return false;
130        }
131 
132        /* (non-Javadoc)
133         * @see org.eclipse.debug.core.model.IStep#canStepOver()
134         */
135        public boolean canStepOver() {
136                return myDebugTarget == null ? false : myDebugTarget.isSuspended();
137        }
138 
139        /* (non-Javadoc)
140         * @see org.eclipse.debug.core.model.IStep#canStepReturn()
141         */
142        public boolean canStepReturn() {
143                return false;
144        }
145 
146        /* (non-Javadoc)
147         * @see org.eclipse.debug.core.model.IStep#isStepping()
148         */
149        public boolean isStepping() {
150                return myDock.isStepping();
151        }
152 
153        /* (non-Javadoc)
154         * @see org.eclipse.debug.core.model.IStep#stepInto()
155         */
156        public void stepInto() throws DebugException {
157        }
158 
159        /* (non-Javadoc)
160         * @see org.eclipse.debug.core.model.IStep#stepOver()
161         */
162        public void stepOver() throws DebugException {
163                myDock.getService().step();
164        }
165 
166        /* (non-Javadoc)
167         * @see org.eclipse.debug.core.model.IStep#stepReturn()
168         */
169        public void stepReturn() throws DebugException {
170        }
171 
172        /* (non-Javadoc)
173         * @see org.eclipse.debug.core.model.ITerminate#canTerminate()
174         */
175        public boolean canTerminate() {
176                return true;
177        }
178 
179        /* (non-Javadoc)
180         * @see org.eclipse.debug.core.model.ITerminate#isTerminated()
181         */
182        public boolean isTerminated() {
183                return this.isTerminated;
184        }
185 
186        /* (non-Javadoc)
187         * @see org.eclipse.debug.core.model.ITerminate#terminate()
188         */
189        public void terminate() throws DebugException {
190                myDock.getService().stopSimulation();
191        }
192 
193        public void setSimControl(SimulationDockService service) {
194        }
195 
196        public void update(Observable o, Object arg) {
197                if (arg instanceof DockEvent) {
198                        DockEvent dockEvent = (DockEvent) arg;
199                        if (dockEvent.comesFrom(this.myDock)) {
200                                if (dockEvent instanceof DockResumedEvent) {
201                                        fireEvent(this, DebugEvent.RESUME);
202                                }
203                                if (dockEvent instanceof DockSuspendedEvent) {
204                                        fireEvent(this, DebugEvent.SUSPEND);
205                                }
206                                if (dockEvent instanceof DockPerformedDebugStepEvent) {
207                                        fireEvent(this, DebugEvent.STEP_END);
208                                }
209                                if (dockEvent instanceof DockStartedDebugStepEvent) {
210                                        fireEvent(this, DebugEvent.STEP_OVER);
211                                }
212                                if (dockEvent instanceof DockSimTimeChangedEvent) {
213                                        if (this.getDebugTarget().isSuspended()){ 
214                                                // Only in suspend mode update the UI, otherwise too many event will cause a
215                                                // deadlock of the debug view
216                                                fireEvent(this, DebugEvent.CHANGE);
217                                        }
218                                }
219                                if (dockEvent instanceof DockSimulationTerminatedEvent) {
220                                        this.isTerminated = true;
221                                        fireEvent(this, DebugEvent.TERMINATE);
222                                }
223                        }
224                }
225        }
226 
227        public void dispose() {
228                this.myDock.deleteObserver(this);
229                this.myDock = null;
230                this.myDebugTarget = null;
231        }
232 
233        @Override
234        public void notifyChanged(Notification notification) {
235        }
236 
237}

[all classes][de.uka.ipd.sdq.codegen.simucontroller.debug]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov