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

COVERAGE SUMMARY FOR SOURCE FILE [CallsToLinkResourcesMap.java]

nameclass, %method, %block, %line, %
CallsToLinkResourcesMap.java0%   (0/1)0%   (0/3)0%   (0/72)0%   (0/19)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class CallsToLinkResourcesMap0%   (0/1)0%   (0/3)0%   (0/72)0%   (0/19)
CallsToLinkResourcesMap (): void 0%   (0/1)0%   (0/8)0%   (0/2)
get (ExternalCallAction, AllocationContext): CommunicationLinkResourceSpecifi... 0%   (0/1)0%   (0/35)0%   (0/8)
put (ExternalCallAction, AllocationContext, CommunicationLinkResourceSpecific... 0%   (0/1)0%   (0/29)0%   (0/9)

1package de.uka.ipd.sdq.pcmsolver.transformations;
2 
3import java.util.ArrayList;
4import java.util.HashMap;
5import java.util.List;
6import java.util.Map;
7 
8import de.uka.ipd.sdq.pcm.allocation.AllocationContext;
9import de.uka.ipd.sdq.pcm.resourceenvironment.CommunicationLinkResourceSpecification;
10import de.uka.ipd.sdq.pcm.seff.ExternalCallAction;
11import de.uka.ipd.sdq.pcmsolver.Pair;
12 
13/**
14 * Stores triples of {@link ExternalCallAction}, {@link AllocationContext}, and
15 * {@link CommunicationLinkResourceSpecification} to retrieve the linking
16 * resource used if the call is issued to the allocation context. So to say,
17 * realizes something like a Map<ExternalCallAction,Map<AllocationContext,
18 * CommunicationLinkResourceSpecification>>. But does not use only maps
19 * internally because not so many elements are expected.
20 * 
21 * @author martens
22 * 
23 */
24class CallsToLinkResourcesMap {
25 
26        /**
27         * 
28         */
29        Map<ExternalCallAction, List<Pair<AllocationContext, CommunicationLinkResourceSpecification>>> internalMap = new HashMap<ExternalCallAction, List<Pair<AllocationContext, CommunicationLinkResourceSpecification>>>();
30 
31        /**
32         * 
33         * @param eca
34         * @param allCtx
35         * @return
36         */
37        public CommunicationLinkResourceSpecification get(ExternalCallAction eca,
38                        AllocationContext allCtx) {
39                List<Pair<AllocationContext, CommunicationLinkResourceSpecification>> listForEca = internalMap
40                                .get(eca);
41                if (listForEca == null) {
42                        return null;
43                }
44                for (Pair<AllocationContext, CommunicationLinkResourceSpecification> pair : listForEca) {
45                        if (pair.getFirst().getId().equals(allCtx.getId())) {
46                                return pair.getSecond();
47                        }
48                }
49                return null;
50        }
51 
52        /**
53         * 
54         * @param eca
55         * @param nextAllCtx
56         * @param clrs
57         */
58        public void put(ExternalCallAction eca, AllocationContext nextAllCtx,
59                        CommunicationLinkResourceSpecification clrs) {
60                Pair<AllocationContext, CommunicationLinkResourceSpecification> pair = new Pair<AllocationContext, CommunicationLinkResourceSpecification>(
61                                nextAllCtx, clrs);
62                List<Pair<AllocationContext, CommunicationLinkResourceSpecification>> listForEca = internalMap
63                                .get(eca);
64                if (listForEca == null) {
65                        listForEca = new ArrayList<Pair<AllocationContext, CommunicationLinkResourceSpecification>>();
66                        internalMap.put(eca, listForEca);
67                }
68                listForEca.add(pair);
69 
70        }
71}

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