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

COVERAGE SUMMARY FOR SOURCE FILE [TakeSimulatedTimeStrategy.java]

nameclass, %method, %block, %line, %
TakeSimulatedTimeStrategy.java0%   (0/1)0%   (0/2)0%   (0/72)0%   (0/15)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class TakeSimulatedTimeStrategy0%   (0/1)0%   (0/2)0%   (0/72)0%   (0/15)
TakeSimulatedTimeStrategy (): void 0%   (0/1)0%   (0/3)0%   (0/1)
takeSample (String, Object []): ProbeSample 0%   (0/1)0%   (0/69)0%   (0/14)

1package de.uka.ipd.sdq.simucomframework.probes;
2 
3import static javax.measure.unit.SI.SECOND;
4 
5import javax.measure.Measure;
6import javax.measure.quantity.Duration;
7import javax.measure.unit.SI;
8 
9import de.uka.ipd.sdq.probespec.framework.ProbeSample;
10import de.uka.ipd.sdq.probespec.framework.ProbeType;
11import de.uka.ipd.sdq.probespec.framework.probes.IProbeStrategy;
12import de.uka.ipd.sdq.simulation.abstractsimengine.ISimulationControl;
13 
14/**
15 * ProbeStrategy which is able to measure the current simulated time. The
16 * simulated time's unit is assumed to be {@link SI#SECOND}.
17 *
18 * @author Philipp Merkle
19 *
20 */
21public class TakeSimulatedTimeStrategy implements IProbeStrategy {
22 
23        /**
24         * @param o
25         *            expects a {@link ISimulationControl}
26         */
27        public ProbeSample<Double, Duration> takeSample(String probeId, Object... o) {
28                double simTime = 0;
29                if (o.length >= 1 && (o[0] instanceof ISimulationControl || o[0] instanceof Double)) {
30                        if (o[0] instanceof ISimulationControl) {
31                                ISimulationControl simControl = (ISimulationControl) o[0];
32                                simTime = simControl.getCurrentSimulationTime();
33                        } else {
34                                simTime = (Double) o[0];
35                        }
36                } else {
37                        throw new IllegalArgumentException(
38                                        "Expected an argument implementing "
39                                                        + ISimulationControl.class.getSimpleName()
40                                                        + " or an argument of type " + Double.class.getSimpleName() + ".");
41                }
42 
43                // Here it is assumed that the simulation time's unit is SI.SECOND
44                Measure<Double, Duration> time = Measure.valueOf(simTime, SECOND);
45                ProbeSample<Double, Duration> sample = new ProbeSample<Double, Duration>(
46                                time, probeId, ProbeType.CURRENT_TIME);
47 
48                return sample;
49        }
50 
51}

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