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

COVERAGE SUMMARY FOR SOURCE FILE [ExampleTakeCurrentTimeStrategy.java]

nameclass, %method, %block, %line, %
ExampleTakeCurrentTimeStrategy.java0%   (0/1)0%   (0/2)0%   (0/74)0%   (0/15)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ExampleTakeCurrentTimeStrategy0%   (0/1)0%   (0/2)0%   (0/74)0%   (0/15)
ExampleTakeCurrentTimeStrategy (): void 0%   (0/1)0%   (0/3)0%   (0/1)
takeSample (String, Object []): ProbeSample 0%   (0/1)0%   (0/71)0%   (0/14)

1package de.uka.ipd.sdq.probespec.framework.probes.example;
2 
3import static javax.measure.unit.SI.MILLI;
4import static javax.measure.unit.SI.SECOND;
5 
6import javax.measure.Measure;
7import javax.measure.quantity.Duration;
8import javax.measure.unit.SI;
9 
10import de.uka.ipd.sdq.probespec.framework.ProbeSample;
11import de.uka.ipd.sdq.probespec.framework.ProbeType;
12import de.uka.ipd.sdq.probespec.framework.probes.IProbeStrategy;
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 ExampleTakeCurrentTimeStrategy implements IProbeStrategy {
22 
23        /**
24         * @param o
25         *            expects a {@link SimpleSimulationContext}
26         */
27        @Override
28        public ProbeSample<Double, Duration> takeSample(final String probeId,
29                        final Object... o) {
30                SimpleSimulationContext simContext = null;
31                if (o.length >= 1 && o[0] instanceof SimpleSimulationContext) {
32                        simContext = (SimpleSimulationContext) o[0];
33                } else {
34                        if (o.length == 0) {
35                                throw new IllegalArgumentException("Missing argument of type "
36                                                + SimpleSimulationContext.class.getSimpleName() + ".");
37                        } else {
38                                throw new IllegalArgumentException("Expected an argument of type "
39                                                + SimpleSimulationContext.class.getSimpleName()
40                                                + " but was " + o[0].getClass().getSimpleName() + ".");        
41                        }
42                }
43 
44                Measure<Double, Duration> time = Measure.valueOf((double) simContext
45                                .getSimulatedTime(), MILLI(SECOND));
46                ProbeSample<Double, Duration> sample = new ProbeSample<Double, Duration>(
47                                time, probeId, ProbeType.CURRENT_TIME);
48                return sample;
49        }
50 
51}

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