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

nameclass, %method, %block, %line, %
TakePassiveResourceStateStrategy.java0%   (0/1)0%   (0/2)0%   (0/53)0%   (0/12)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class TakePassiveResourceStateStrategy0%   (0/1)0%   (0/2)0%   (0/53)0%   (0/12)
TakePassiveResourceStateStrategy (): void 0%   (0/1)0%   (0/3)0%   (0/1)
takeSample (String, Object []): ProbeSample 0%   (0/1)0%   (0/50)0%   (0/11)

1package de.uka.ipd.sdq.simucomframework.probes;
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;
9import de.uka.ipd.sdq.scheduler.IPassiveResource;
10 
11/**
12 * ProbeStrategy which is able to measure the state of a
13 * {@link IPassiveResource}. The state is calculated as follows:
14 * <code>state = capacity - available</code>.
15 *
16 * @author Philipp Merkle
17 *
18 */
19public class TakePassiveResourceStateStrategy implements IProbeStrategy {
20 
21        /**
22         * @param o
23         *            expects a {@link IPassiveResource}
24         */
25        public ProbeSample<Integer, Dimensionless> takeSample(String probeId,
26                        Object... o) {
27                IPassiveResource r = null;
28                if (o.length >= 1 && o[0] instanceof IPassiveResource) {
29                        r = (IPassiveResource) o[0];
30                } else {
31                        throw new IllegalArgumentException("Expected an argument of type "
32                                        + IPassiveResource.class.getSimpleName() + ".");
33                }
34 
35                int state = r.getCapacity() - r.getAvailable();
36                Measure<Integer, Dimensionless> stateMeasure = Measure.valueOf(state,
37                                Dimensionless.UNIT);
38                ProbeSample<Integer, Dimensionless> sample = new ProbeSample<Integer, Dimensionless>(
39                                stateMeasure, probeId, ProbeType.RESOURCE_STATE);
40 
41                return sample;
42        }
43 
44}

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