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 [ExampleTakeSEFFParameterStrategy.java]

nameclass, %method, %block, %line, %
ExampleTakeSEFFParameterStrategy.java0%   (0/1)0%   (0/2)0%   (0/113)0%   (0/29)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ExampleTakeSEFFParameterStrategy0%   (0/1)0%   (0/2)0%   (0/113)0%   (0/29)
ExampleTakeSEFFParameterStrategy (): void 0%   (0/1)0%   (0/3)0%   (0/1)
takeSample (String, Object []): ProbeSample 0%   (0/1)0%   (0/110)0%   (0/28)

1package de.uka.ipd.sdq.probespec.framework.probes.example;
2 
3import javax.measure.Measure;
4import javax.measure.quantity.Dimensionless;
5 
6import de.uka.ipd.sdq.probespec.framework.ProbeSample;
7import de.uka.ipd.sdq.probespec.framework.ProbeType;
8import de.uka.ipd.sdq.probespec.framework.probes.IProbeStrategy;
9 
10public class ExampleTakeSEFFParameterStrategy implements IProbeStrategy {
11 
12        /**
13         * @param o
14         *            expects a {@link SimpleSEFFParameter}
15         */
16        @SuppressWarnings("unchecked")
17        @Override
18        public ProbeSample<?, Dimensionless> takeSample(String probeId, Object... o) {
19                SimpleSEFFParameter<?> parameter;
20                if (o[0] instanceof SimpleSEFFParameter) {
21                        parameter = (SimpleSEFFParameter<?>) o[0];
22                } else {
23                        throw new IllegalArgumentException("Expected an argument of type "
24                                        + SimpleSEFFParameter.class.getSimpleName() + ".");
25                }
26 
27                ProbeSample<?, Dimensionless> sample = null;
28                if (parameter.getValue() instanceof Double) {
29                        Measure<Double, Dimensionless> value = Measure.valueOf(
30                                        (Double) parameter.getValue(), Dimensionless.UNIT);
31                        sample = new ProbeSample<Double, Dimensionless>(value, probeId,
32                                        ProbeType.SEFF_PARAMETER);
33                } else if (parameter.getValue() instanceof Float) {
34                        Measure<Float, Dimensionless> value = Measure.valueOf(
35                                        (Float) parameter.getValue(), Dimensionless.UNIT);
36                        sample = new ProbeSample<Float, Dimensionless>(value, probeId,
37                                        ProbeType.SEFF_PARAMETER);
38                } else if (parameter.getValue() instanceof Integer) {
39                        Measure<Integer, Dimensionless> value = Measure.valueOf(
40                                        (Integer) parameter.getValue(), Dimensionless.UNIT);
41                        sample = new ProbeSample<Integer, Dimensionless>(value, probeId,
42                                        ProbeType.SEFF_PARAMETER);
43                } else if (parameter.getValue() instanceof Long) {
44                        Measure<Long, Dimensionless> value = Measure.valueOf(
45                                        (Long) parameter.getValue(), Dimensionless.UNIT);
46                        sample = new ProbeSample<Long, Dimensionless>(value, probeId,
47                                        ProbeType.SEFF_PARAMETER);
48                } else {
49                        throw new IllegalArgumentException(
50                                        "Expected an argument containing a value of type Double, Float, Integer or Long.");
51                }
52 
53                return sample;
54        }
55}

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