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

COVERAGE SUMMARY FOR SOURCE FILE [DemandConsumerStrategiesRegistry.java]

nameclass, %method, %block, %line, %
DemandConsumerStrategiesRegistry.java0%   (0/1)0%   (0/5)0%   (0/46)0%   (0/11)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class DemandConsumerStrategiesRegistry0%   (0/1)0%   (0/5)0%   (0/46)0%   (0/11)
<static initializer> 0%   (0/1)0%   (0/5)0%   (0/2)
DemandConsumerStrategiesRegistry (): void 0%   (0/1)0%   (0/8)0%   (0/3)
getStrategyFor (ResourceTypeEnum): IDemandStrategy 0%   (0/1)0%   (0/24)0%   (0/3)
registerStrategyFor (ResourceTypeEnum, IDemandStrategy): void 0%   (0/1)0%   (0/7)0%   (0/2)
singleton (): DemandConsumerStrategiesRegistry 0%   (0/1)0%   (0/2)0%   (0/1)

1package de.uka.ipd.sdq.prototype.framework.strategies;
2 
3import java.util.HashMap;
4 
5import de.uka.ipd.sdq.measurement.strategies.activeresource.IDemandStrategy;
6import de.uka.ipd.sdq.measurement.strategies.activeresource.ResourceTypeEnum;
7 
8public class DemandConsumerStrategiesRegistry {
9 
10        private HashMap<ResourceTypeEnum,IDemandStrategy> strategiesHash = new HashMap<ResourceTypeEnum, IDemandStrategy>();
11        private static DemandConsumerStrategiesRegistry singletonInstance = new DemandConsumerStrategiesRegistry();
12        
13        private DemandConsumerStrategiesRegistry() {
14        }
15 
16        public static DemandConsumerStrategiesRegistry singleton() {
17                return singletonInstance;
18        }
19        
20        public void registerStrategyFor(ResourceTypeEnum resourceType, IDemandStrategy strategy){
21                strategiesHash.put(resourceType, strategy);
22        }
23        
24        public IDemandStrategy getStrategyFor(ResourceTypeEnum resource) {
25                if(!strategiesHash.containsKey(resource)) {
26                        // TODO: This is a temporary J2EE hack, only simulate CPUs.
27//                        double procRate = 10;
28//                        System.out.println("Warning: the CPU strategy has been hard-codedly set to a processing rate of "+procRate);
29//                        IDemandStrategy strategy = new FibonacciDemand();
30//                        strategy.initializeStrategy(DegreeOfAccuracyEnum.MEDIUM,procRate);
31//                        strategiesHash.put(resource,strategy);
32//                        return strategy;
33                        throw new RuntimeException("Requested Resourcestrategy >"+resource+"< is not registered!");
34                }
35                
36                return strategiesHash.get(resource);
37        }
38}

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