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

nameclass, %method, %block, %line, %
ExampleTakeCPUDemandStrategy.java0%   (0/1)0%   (0/2)0%   (0/65)0%   (0/19)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ExampleTakeCPUDemandStrategy0%   (0/1)0%   (0/2)0%   (0/65)0%   (0/19)
ExampleTakeCPUDemandStrategy (): void 0%   (0/1)0%   (0/3)0%   (0/1)
takeSample (String, Object []): ProbeSample 0%   (0/1)0%   (0/62)0%   (0/18)

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 ExampleTakeCPUDemandStrategy implements IProbeStrategy {
11 
12        /**
13         * @param o
14         *            expects a {@link ISimpleDemanding} and a
15         *            {@link ASimpleActiveResource} in arbitrary order
16         */
17        @Override
18        public ProbeSample<Double, Dimensionless> takeSample(String probeId,
19                        Object... o) {
20                ISimpleDemanding demanding = null;
21                ASimpleActiveResource resource = null;
22                for (Object object : o) {
23                        if (object instanceof ISimpleDemanding) {
24                                demanding = (ISimpleDemanding) object;
25                        } else if (object instanceof SimpleCPUResource) {
26                                resource = (ASimpleActiveResource) object;
27                        }
28                }
29                if (demanding == null) {
30                        throw new IllegalArgumentException(
31                                        "Expected an argument implementing IExampleDemanding.");
32                }
33                if (resource == null) {
34                        throw new IllegalArgumentException(
35                                        "Expected an argument of type SimpleCPUResource.");
36                }
37 
38                Measure<Double, Dimensionless> demand = Measure.valueOf(demanding
39                                .getDemand(resource), Dimensionless.UNIT);
40                ProbeSample<Double, Dimensionless> sample = new ProbeSample<Double, Dimensionless>(
41                                demand, probeId, ProbeType.RESOURCE_DEMAND);
42 
43                return sample;
44        }
45 
46}

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