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

COVERAGE SUMMARY FOR SOURCE FILE [SimulatedLinkingResourceContainer.java]

nameclass, %method, %block, %line, %
SimulatedLinkingResourceContainer.java0%   (0/1)0%   (0/6)0%   (0/116)0%   (0/38)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class SimulatedLinkingResourceContainer0%   (0/1)0%   (0/6)0%   (0/116)0%   (0/38)
SimulatedLinkingResourceContainer (SimuComModel, String): void 0%   (0/1)0%   (0/5)0%   (0/2)
addActiveResource (String, String, String, String, String, String, String, Do... 0%   (0/1)0%   (0/29)0%   (0/7)
getLinkingResourceId (): String 0%   (0/1)0%   (0/21)0%   (0/8)
getLinkingResourceTypeId (): String 0%   (0/1)0%   (0/21)0%   (0/8)
getLinkingResourceTypeName (): String 0%   (0/1)0%   (0/21)0%   (0/8)
loadActiveResource (SimuComSimProcess, String, String, double): void 0%   (0/1)0%   (0/19)0%   (0/5)

1package de.uka.ipd.sdq.simucomframework.resources;
2 
3import java.util.Iterator;
4import java.util.Map.Entry;
5 
6import de.uka.ipd.sdq.simucomframework.SimuComSimProcess;
7import de.uka.ipd.sdq.simucomframework.exceptions.ResourceContainerIsMissingRequiredResourceType;
8import de.uka.ipd.sdq.simucomframework.model.SimuComModel;
9 
10public class SimulatedLinkingResourceContainer extends
11                AbstractSimulatedResourceContainer {
12 
13        public SimulatedLinkingResourceContainer(SimuComModel myModel, String id) {
14                super(myModel, id);
15        }
16 
17        public void addActiveResource(String id, String typeID,
18                        String resourceContainerID, String resourceTypeID,
19                        String description, String throughput, String latencySpec,
20                        Double failureProbability) {
21                SimulatedLinkingResource r = new SimulatedLinkingResource(id, myModel,
22                                typeID, resourceContainerID, resourceTypeID, description,
23                                throughput, latencySpec, failureProbability);
24                activeResources.put(typeID, r);
25                
26                // setup calculators
27                // TODO: setup waiting time calculator
28                // CalculatorHelper.setupWaitingTimeCalculator(r);
29                CalculatorHelper.setupDemandCalculator(r, this.myModel);
30                CalculatorHelper.setupStateCalculator(r, this.myModel);
31        }
32 
33        /**
34         * Retrieves the id of the first (i.e. the one and only) communication link
35         * resource specification.
36         * 
37         * @return the id of the communication link resource specification
38         */
39        public String getLinkingResourceId() {
40                Iterator<Entry<String, AbstractScheduledResource>> iterator = activeResources
41                                .entrySet().iterator();
42                while (iterator.hasNext()) {
43                        Entry<String, AbstractScheduledResource> entry = iterator.next();
44                        SimulatedLinkingResource resource = (SimulatedLinkingResource) entry
45                                        .getValue();
46                        return resource.getId();
47                }
48                return null;
49        }
50        
51        public void loadActiveResource(SimuComSimProcess requestingProcess, String originResourceContainerID, String typeID, double demand) {
52                AbstractScheduledResource resource = activeResources.get(typeID);
53                if (resource == null) {
54                        throw new ResourceContainerIsMissingRequiredResourceType(typeID);
55                }
56                resource.consumeResource(requestingProcess, 1, demand);
57        }
58 
59        /**
60         * Retrieves the id of the resource type of the first (i.e. the one and
61         * only) communication link resource specification.
62         * 
63         * @return the resource type id
64         */
65        public String getLinkingResourceTypeId() {
66                Iterator<Entry<String, AbstractScheduledResource>> iterator = activeResources
67                                .entrySet().iterator();
68                while (iterator.hasNext()) {
69                        Entry<String, AbstractScheduledResource> entry = iterator.next();
70                        SimulatedLinkingResource resource = (SimulatedLinkingResource) entry
71                                        .getValue();
72                        return resource.getResourceTypeId();
73                }
74                return null;
75        }
76 
77        /**
78         * Retrieves the resource type name of the first (i.e. the one and only)
79         * communication link resource specification.
80         * 
81         * @return the resource type name of the communication link resource
82         *         specification
83         */
84        public String getLinkingResourceTypeName() {
85                Iterator<Entry<String, AbstractScheduledResource>> iterator = activeResources
86                                .entrySet().iterator();
87                while (iterator.hasNext()) {
88                        Entry<String, AbstractScheduledResource> entry = iterator.next();
89                        SimulatedLinkingResource resource = (SimulatedLinkingResource) entry
90                                        .getValue();
91                        return resource.getName();
92                }
93                return null;
94        }
95}

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