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

COVERAGE SUMMARY FOR SOURCE FILE [PalladioComponentModelVisualIDRegistry.java]

nameclass, %method, %block, %line, %
PalladioComponentModelVisualIDRegistry.java0%   (0/1)0%   (0/10)0%   (0/288)0%   (0/113)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class PalladioComponentModelVisualIDRegistry0%   (0/1)0%   (0/10)0%   (0/288)0%   (0/113)
PalladioComponentModelVisualIDRegistry (): void 0%   (0/1)0%   (0/3)0%   (0/1)
canCreateNode (View, int): boolean 0%   (0/1)0%   (0/124)0%   (0/50)
getDiagramVisualID (EObject): int 0%   (0/1)0%   (0/18)0%   (0/7)
getLinkWithClassVisualID (EObject): int 0%   (0/1)0%   (0/6)0%   (0/3)
getModelID (View): String 0%   (0/1)0%   (0/30)0%   (0/7)
getNodeVisualID (View, EObject): int 0%   (0/1)0%   (0/65)0%   (0/28)
getType (int): String 0%   (0/1)0%   (0/3)0%   (0/1)
getVisualID (String): int 0%   (0/1)0%   (0/21)0%   (0/9)
getVisualID (View): int 0%   (0/1)0%   (0/16)0%   (0/6)
isDiagram (ResourceEnvironment): boolean 0%   (0/1)0%   (0/2)0%   (0/1)

1/*
2 * Copyright 2009, SDQ, IPD, Uni Karlsruhe (TH)
3 */
4package de.uka.ipd.sdq.pcm.gmf.resource.part;
5 
6import org.eclipse.core.runtime.Platform;
7import org.eclipse.emf.ecore.EAnnotation;
8import org.eclipse.emf.ecore.EObject;
9import org.eclipse.gmf.runtime.notation.Diagram;
10import org.eclipse.gmf.runtime.notation.View;
11 
12import de.uka.ipd.sdq.pcm.gmf.resource.edit.parts.CommunicationLinkResourceSpecificationEditPart;
13import de.uka.ipd.sdq.pcm.gmf.resource.edit.parts.CommunicationLinkResourceSpecificationFailureProbabilityEditPart;
14import de.uka.ipd.sdq.pcm.gmf.resource.edit.parts.CommunicationLinkResourceSpecificationLatencyLabelEditPart;
15import de.uka.ipd.sdq.pcm.gmf.resource.edit.parts.CommunicationLinkResourceSpecificationThroughputLabelEditPart;
16import de.uka.ipd.sdq.pcm.gmf.resource.edit.parts.LinkingResource2EditPart;
17import de.uka.ipd.sdq.pcm.gmf.resource.edit.parts.LinkingResourceEntityNameEditPart;
18import de.uka.ipd.sdq.pcm.gmf.resource.edit.parts.LinkingResourceNetworkSwitchCompartmentEditPart;
19import de.uka.ipd.sdq.pcm.gmf.resource.edit.parts.ProcessingResourceSpecificationActiveResourceTypeLabelEditPart;
20import de.uka.ipd.sdq.pcm.gmf.resource.edit.parts.ProcessingResourceSpecificationEditPart;
21import de.uka.ipd.sdq.pcm.gmf.resource.edit.parts.ProcessingResourceSpecificationMTTFEditPart;
22import de.uka.ipd.sdq.pcm.gmf.resource.edit.parts.ProcessingResourceSpecificationMTTREditPart;
23import de.uka.ipd.sdq.pcm.gmf.resource.edit.parts.ProcessingResourceSpecificationNumberOfReplicasEditPart;
24import de.uka.ipd.sdq.pcm.gmf.resource.edit.parts.ProcessingResourceSpecificationProcessingResourceSpecificationCompartmentEditPart;
25import de.uka.ipd.sdq.pcm.gmf.resource.edit.parts.ProcessingResourceSpecificationSchedulingPolicyEditPart;
26import de.uka.ipd.sdq.pcm.gmf.resource.edit.parts.ResourceContainerEditPart;
27import de.uka.ipd.sdq.pcm.gmf.resource.edit.parts.ResourceContainerEntityNameEditPart;
28import de.uka.ipd.sdq.pcm.gmf.resource.edit.parts.ResourceContainerResourceContainerCompartmentEditPart;
29import de.uka.ipd.sdq.pcm.gmf.resource.edit.parts.ResourceEnvironmentEditPart;
30import de.uka.ipd.sdq.pcm.gmf.resource.edit.parts.WrappingLabel2EditPart;
31import de.uka.ipd.sdq.pcm.gmf.resource.edit.parts.WrappingLabelEditPart;
32import de.uka.ipd.sdq.pcm.resourceenvironment.ResourceEnvironment;
33import de.uka.ipd.sdq.pcm.resourceenvironment.ResourceenvironmentPackage;
34 
35/**
36 * This registry is used to determine which type of visual object should be
37 * created for the corresponding Diagram, Node, ChildNode or Link represented
38 * by a domain model object.
39 * 
40 * @generated
41 */
42public class PalladioComponentModelVisualIDRegistry {
43 
44        /**
45         * @generated
46         */
47        private static final String DEBUG_KEY = "de.uka.ipd.sdq.pcm.gmf.resource/debug/visualID"; //$NON-NLS-1$
48 
49        /**
50         * @generated
51         */
52        public static int getVisualID(View view) {
53                if (view instanceof Diagram) {
54                        if (ResourceEnvironmentEditPart.MODEL_ID.equals(view.getType())) {
55                                return ResourceEnvironmentEditPart.VISUAL_ID;
56                        } else {
57                                return -1;
58                        }
59                }
60                return de.uka.ipd.sdq.pcm.gmf.resource.part.PalladioComponentModelVisualIDRegistry
61                                .getVisualID(view.getType());
62        }
63 
64        /**
65         * @generated
66         */
67        public static String getModelID(View view) {
68                View diagram = view.getDiagram();
69                while (view != diagram) {
70                        EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
71                        if (annotation != null) {
72                                return (String) annotation.getDetails().get("modelID"); //$NON-NLS-1$
73                        }
74                        view = (View) view.eContainer();
75                }
76                return diagram != null ? diagram.getType() : null;
77        }
78 
79        /**
80         * @generated
81         */
82        public static int getVisualID(String type) {
83                try {
84                        return Integer.parseInt(type);
85                } catch (NumberFormatException e) {
86                        if (Boolean.TRUE.toString().equalsIgnoreCase(
87                                        Platform.getDebugOption(DEBUG_KEY))) {
88                                PalladioComponentModelDiagramEditorPlugin.getInstance()
89                                                .logError(
90                                                                "Unable to parse view type as a visualID number: "
91                                                                                + type);
92                        }
93                }
94                return -1;
95        }
96 
97        /**
98         * @generated
99         */
100        public static String getType(int visualID) {
101                return String.valueOf(visualID);
102        }
103 
104        /**
105         * @generated
106         */
107        public static int getDiagramVisualID(EObject domainElement) {
108                if (domainElement == null) {
109                        return -1;
110                }
111                if (ResourceenvironmentPackage.eINSTANCE.getResourceEnvironment()
112                                .isSuperTypeOf(domainElement.eClass())
113                                && isDiagram((ResourceEnvironment) domainElement)) {
114                        return ResourceEnvironmentEditPart.VISUAL_ID;
115                }
116                return -1;
117        }
118 
119        /**
120         * @generated
121         */
122        public static int getNodeVisualID(View containerView, EObject domainElement) {
123                if (domainElement == null) {
124                        return -1;
125                }
126                String containerModelID = de.uka.ipd.sdq.pcm.gmf.resource.part.PalladioComponentModelVisualIDRegistry
127                                .getModelID(containerView);
128                if (!ResourceEnvironmentEditPart.MODEL_ID.equals(containerModelID)) {
129                        return -1;
130                }
131                int containerVisualID;
132                if (ResourceEnvironmentEditPart.MODEL_ID.equals(containerModelID)) {
133                        containerVisualID = de.uka.ipd.sdq.pcm.gmf.resource.part.PalladioComponentModelVisualIDRegistry
134                                        .getVisualID(containerView);
135                } else {
136                        if (containerView instanceof Diagram) {
137                                containerVisualID = ResourceEnvironmentEditPart.VISUAL_ID;
138                        } else {
139                                return -1;
140                        }
141                }
142                switch (containerVisualID) {
143                case ResourceContainerResourceContainerCompartmentEditPart.VISUAL_ID:
144                        if (ResourceenvironmentPackage.eINSTANCE
145                                        .getProcessingResourceSpecification().isSuperTypeOf(
146                                                        domainElement.eClass())) {
147                                return ProcessingResourceSpecificationEditPart.VISUAL_ID;
148                        }
149                        break;
150                case LinkingResourceNetworkSwitchCompartmentEditPart.VISUAL_ID:
151                        if (ResourceenvironmentPackage.eINSTANCE
152                                        .getCommunicationLinkResourceSpecification().isSuperTypeOf(
153                                                        domainElement.eClass())) {
154                                return CommunicationLinkResourceSpecificationEditPart.VISUAL_ID;
155                        }
156                        break;
157                case ResourceEnvironmentEditPart.VISUAL_ID:
158                        if (ResourceenvironmentPackage.eINSTANCE.getResourceContainer()
159                                        .isSuperTypeOf(domainElement.eClass())) {
160                                return ResourceContainerEditPart.VISUAL_ID;
161                        }
162                        if (ResourceenvironmentPackage.eINSTANCE.getLinkingResource()
163                                        .isSuperTypeOf(domainElement.eClass())) {
164                                return LinkingResource2EditPart.VISUAL_ID;
165                        }
166                        break;
167                }
168                return -1;
169        }
170 
171        /**
172         * @generated
173         */
174        public static boolean canCreateNode(View containerView, int nodeVisualID) {
175                String containerModelID = de.uka.ipd.sdq.pcm.gmf.resource.part.PalladioComponentModelVisualIDRegistry
176                                .getModelID(containerView);
177                if (!ResourceEnvironmentEditPart.MODEL_ID.equals(containerModelID)) {
178                        return false;
179                }
180                int containerVisualID;
181                if (ResourceEnvironmentEditPart.MODEL_ID.equals(containerModelID)) {
182                        containerVisualID = de.uka.ipd.sdq.pcm.gmf.resource.part.PalladioComponentModelVisualIDRegistry
183                                        .getVisualID(containerView);
184                } else {
185                        if (containerView instanceof Diagram) {
186                                containerVisualID = ResourceEnvironmentEditPart.VISUAL_ID;
187                        } else {
188                                return false;
189                        }
190                }
191                switch (containerVisualID) {
192                case ResourceContainerEditPart.VISUAL_ID:
193                        if (ResourceContainerEntityNameEditPart.VISUAL_ID == nodeVisualID) {
194                                return true;
195                        }
196                        if (ResourceContainerResourceContainerCompartmentEditPart.VISUAL_ID == nodeVisualID) {
197                                return true;
198                        }
199                        break;
200                case LinkingResource2EditPart.VISUAL_ID:
201                        if (LinkingResourceEntityNameEditPart.VISUAL_ID == nodeVisualID) {
202                                return true;
203                        }
204                        if (LinkingResourceNetworkSwitchCompartmentEditPart.VISUAL_ID == nodeVisualID) {
205                                return true;
206                        }
207                        break;
208                case ProcessingResourceSpecificationEditPart.VISUAL_ID:
209                        if (ProcessingResourceSpecificationMTTFEditPart.VISUAL_ID == nodeVisualID) {
210                                return true;
211                        }
212                        if (ProcessingResourceSpecificationMTTREditPart.VISUAL_ID == nodeVisualID) {
213                                return true;
214                        }
215                        if (ProcessingResourceSpecificationSchedulingPolicyEditPart.VISUAL_ID == nodeVisualID) {
216                                return true;
217                        }
218                        if (ProcessingResourceSpecificationNumberOfReplicasEditPart.VISUAL_ID == nodeVisualID) {
219                                return true;
220                        }
221                        if (WrappingLabelEditPart.VISUAL_ID == nodeVisualID) {
222                                return true;
223                        }
224                        if (ProcessingResourceSpecificationActiveResourceTypeLabelEditPart.VISUAL_ID == nodeVisualID) {
225                                return true;
226                        }
227                        if (ProcessingResourceSpecificationProcessingResourceSpecificationCompartmentEditPart.VISUAL_ID == nodeVisualID) {
228                                return true;
229                        }
230                        break;
231                case CommunicationLinkResourceSpecificationEditPart.VISUAL_ID:
232                        if (CommunicationLinkResourceSpecificationFailureProbabilityEditPart.VISUAL_ID == nodeVisualID) {
233                                return true;
234                        }
235                        if (CommunicationLinkResourceSpecificationLatencyLabelEditPart.VISUAL_ID == nodeVisualID) {
236                                return true;
237                        }
238                        if (CommunicationLinkResourceSpecificationThroughputLabelEditPart.VISUAL_ID == nodeVisualID) {
239                                return true;
240                        }
241                        if (WrappingLabel2EditPart.VISUAL_ID == nodeVisualID) {
242                                return true;
243                        }
244                        break;
245                case ResourceContainerResourceContainerCompartmentEditPart.VISUAL_ID:
246                        if (ProcessingResourceSpecificationEditPart.VISUAL_ID == nodeVisualID) {
247                                return true;
248                        }
249                        break;
250                case LinkingResourceNetworkSwitchCompartmentEditPart.VISUAL_ID:
251                        if (CommunicationLinkResourceSpecificationEditPart.VISUAL_ID == nodeVisualID) {
252                                return true;
253                        }
254                        break;
255                case ResourceEnvironmentEditPart.VISUAL_ID:
256                        if (ResourceContainerEditPart.VISUAL_ID == nodeVisualID) {
257                                return true;
258                        }
259                        if (LinkingResource2EditPart.VISUAL_ID == nodeVisualID) {
260                                return true;
261                        }
262                        break;
263                }
264                return false;
265        }
266 
267        /**
268         * @generated
269         */
270        public static int getLinkWithClassVisualID(EObject domainElement) {
271                if (domainElement == null) {
272                        return -1;
273                }
274                return -1;
275        }
276 
277        /**
278         * User can change implementation of this method to handle some specific
279         * situations not covered by default logic.
280         * 
281         * @generated
282         */
283        private static boolean isDiagram(ResourceEnvironment element) {
284                return true;
285        }
286 
287}

[all classes][de.uka.ipd.sdq.pcm.gmf.resource.part]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov