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

COVERAGE SUMMARY FOR SOURCE FILE [SSJSimProcess.java]

nameclass, %method, %block, %line, %
SSJSimProcess.java0%   (0/2)0%   (0/10)0%   (0/103)0%   (0/25)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class SSJSimProcess0%   (0/1)0%   (0/8)0%   (0/88)0%   (0/22)
<static initializer> 0%   (0/1)0%   (0/4)0%   (0/2)
SSJSimProcess (AbstractSimProcessDelegator, String): void 0%   (0/1)0%   (0/25)0%   (0/6)
access$0 (SSJSimProcess): 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/36)0%   (0/9)
simIsRunning (): boolean 0%   (0/1)0%   (0/9)0%   (0/1)
     
class SSJSimProcess$10%   (0/1)0%   (0/2)0%   (0/15)0%   (0/5)
SSJSimProcess$1 (SSJSimProcess, Simulator): void 0%   (0/1)0%   (0/7)0%   (0/2)
actions (): void 0%   (0/1)0%   (0/8)0%   (0/3)

1/**
2 * 
3 */
4package de.uka.ipd.sdq.simulation.abstractsimengine.ssj;
5 
6import org.apache.log4j.Logger;
7 
8import sun.reflect.generics.reflectiveObjects.NotImplementedException;
9import umontreal.iro.lecuyer.simevents.Event;
10import umontreal.iro.lecuyer.simevents.Simulator;
11import de.uka.ipd.sdq.simulation.abstractsimengine.AbstractSimProcessDelegator;
12import de.uka.ipd.sdq.simulation.abstractsimengine.processes.ProcessState;
13import de.uka.ipd.sdq.simulation.abstractsimengine.processes.SimProcessThreadingStrategy;
14import de.uka.ipd.sdq.simulation.abstractsimengine.processes.SimulatedProcess;
15 
16/**
17 * Simulation Process implementation for SSJ
18 * 
19 * @author Snowball, Michael H. & Jens (bugfixing, refactorings, cleanup) 
20 */
21public class SSJSimProcess extends SimulatedProcess {
22 
23    public static final Logger logger = Logger.getLogger(SSJSimProcess.class);
24 
25    /**
26     * Underlying abstract simulation process
27     */
28    public final AbstractSimProcessDelegator myAbstractProcess;
29    
30    /**
31     * Reference to the actual and concrete simulation engine 
32     */
33    private final Simulator sim;
34    
35    /**
36         * Reference to the underlying SSJ experiment 
37         */
38        private final SSJExperiment ssjExperiment;
39 
40    /**
41     * Constructor
42     * @param myProcess Underlying abstract sim process
43     * @param name an ID
44     */
45    public SSJSimProcess(AbstractSimProcessDelegator myProcess, String name) {
46        super(new SimProcessThreadingStrategy());
47        this.myAbstractProcess = myProcess;
48        this.ssjExperiment = (SSJExperiment) myAbstractProcess.getModel().getSimulationControl();
49        this.sim = ssjExperiment.getSimulator();
50 
51        startProcess(processStrategy);
52    }
53 
54    /* (non-Javadoc)
55     * @see de.uka.ipd.sdq.simulation.abstractsimengine.ISimProcess#scheduleAt(double)
56     */
57    public void scheduleAt(double delay) {
58        if (!isTerminated()) {
59                if (this.myProcessState != ProcessState.SUSPENDED) {
60                        throw new IllegalStateException("Tried to schedule thread which was not suspended ["
61                                        + this.myAbstractProcess.getId() + "]");
62                }
63 
64                // Resume process immediately to force process cleanup
65                if (!simIsRunning()) {
66                        resume();
67                }
68 
69            new Event(sim) {
70                @Override
71                public void actions() {
72                    if (!isTerminated()) {
73                        resume();
74                    }
75                }
76            }.schedule(delay);
77        }
78    }
79 
80    private boolean simIsRunning() {
81        return !ssjExperiment.getSimulator().isStopped();
82    }
83 
84    @Override
85    protected AbstractSimProcessDelegator getAbstractProcess() {
86        return this.myAbstractProcess;
87    }
88 
89    @Override
90    public boolean isScheduled() {
91        throw new NotImplementedException();
92    }
93 
94    @Override
95    public void reschedule(double delay) {
96        throw new NotImplementedException();
97    }
98 
99}

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