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

COVERAGE SUMMARY FOR SOURCE FILE [DesmoJSimProcess.java]

nameclass, %method, %block, %line, %
DesmoJSimProcess.java0%   (0/2)0%   (0/9)0%   (0/104)0%   (0/23)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class DesmoJSimProcess0%   (0/1)0%   (0/7)0%   (0/87)0%   (0/20)
DesmoJSimProcess (AbstractSimProcessDelegator, DesmoJModel, String): void 0%   (0/1)0%   (0/23)0%   (0/6)
access$0 (DesmoJSimProcess): void 0%   (0/1)0%   (0/3)0%   (0/1)
getAbstractProcess (): AbstractSimProcessDelegator 0%   (0/1)0%   (0/3)0%   (0/1)
isScheduled (): boolean 0%   (0/1)0%   (0/4)0%   (0/1)
reschedule (double): void 0%   (0/1)0%   (0/4)0%   (0/1)
scheduleAt (double): void 0%   (0/1)0%   (0/41)0%   (0/9)
simIsRunning (): boolean 0%   (0/1)0%   (0/9)0%   (0/1)
     
class DesmoJSimProcess$10%   (0/1)0%   (0/2)0%   (0/17)0%   (0/5)
DesmoJSimProcess$1 (DesmoJSimProcess, Model, String, boolean): void 0%   (0/1)0%   (0/9)0%   (0/2)
eventRoutine (): void 0%   (0/1)0%   (0/8)0%   (0/3)

1/**
2 * 
3 */
4package de.uka.ipd.sdq.simulation.abstractsimengine.desmoj;
5 
6import sun.reflect.generics.reflectiveObjects.NotImplementedException;
7import de.uka.ipd.sdq.simulation.abstractsimengine.AbstractSimProcessDelegator;
8import de.uka.ipd.sdq.simulation.abstractsimengine.processes.ProcessState;
9import de.uka.ipd.sdq.simulation.abstractsimengine.processes.SimProcessThreadingStrategy;
10import de.uka.ipd.sdq.simulation.abstractsimengine.processes.SimulatedProcess;
11import desmoj.core.simulator.ExternalEvent;
12import desmoj.core.simulator.TimeSpan;
13 
14/**
15 * @author Steffen Becker
16 * @author Philipp Merkle
17 */
18public class DesmoJSimProcess extends SimulatedProcess {
19 
20    private AbstractSimProcessDelegator myAbstractProcess;
21 
22    private DesmoJModel model;
23 
24    /**
25     * Reference to the underlying experiment
26     */
27    private final DesmoJExperiment experiment;
28 
29    public DesmoJSimProcess(AbstractSimProcessDelegator process, DesmoJModel model, String name) {
30        super(new SimProcessThreadingStrategy());
31        this.myAbstractProcess = process;
32        this.model = model;
33        this.experiment = (DesmoJExperiment) myAbstractProcess.getModel().getSimulationControl();
34 
35        startProcess(processStrategy);
36    }
37 
38    public void scheduleAt(double delay) {
39        if (!isTerminated()) {
40            if (this.myProcessState != ProcessState.SUSPENDED) {
41                throw new IllegalStateException("Tried to schedule thread which was not suspended ["
42                        + this.myAbstractProcess.getId() + "]");
43            }
44 
45            // Resume process immediately to force process cleanup
46            if (!simIsRunning()) {
47                resume();
48            }
49 
50            // TODO set event name
51            new ExternalEvent(this.model, "TODO event name", false) {
52                @Override
53                public void eventRoutine() {
54                    if (!isTerminated()) {
55                        resume();
56                    }
57                }
58            }.schedule(new TimeSpan(delay));
59        }
60    }
61 
62    private boolean simIsRunning() {
63        // do not use isRunning method here, since !isRunning != isStopped
64        return !experiment.getExperiment().isStopped();
65    }
66 
67    @Override
68    protected AbstractSimProcessDelegator getAbstractProcess() {
69        return this.myAbstractProcess;
70    }
71 
72    @Override
73    public boolean isScheduled() {
74        throw new NotImplementedException();
75    }
76 
77    @Override
78    public void reschedule(double delay) {
79        throw new NotImplementedException();
80    }
81 
82}

[all classes][de.uka.ipd.sdq.simulation.abstractsimengine.desmoj]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov