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

COVERAGE SUMMARY FOR SOURCE FILE [AbstractComponentBuilder.java]

nameclass, %method, %block, %line, %
AbstractComponentBuilder.java0%   (0/1)0%   (0/11)0%   (0/115)0%   (0/28)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AbstractComponentBuilder0%   (0/1)0%   (0/11)0%   (0/115)0%   (0/28)
<static initializer> 0%   (0/1)0%   (0/3)0%   (0/2)
AbstractComponentBuilder (PCMAndCompletionModelHolder, String): void 0%   (0/1)0%   (0/11)0%   (0/4)
addOperationProvidedRole (OperationInterface, String): OperationProvidedRole 0%   (0/1)0%   (0/17)0%   (0/5)
addOperationRequiredRole (OperationInterface, String): OperationRequiredRole 0%   (0/1)0%   (0/17)0%   (0/5)
build (): void 0%   (0/1)0%   (0/9)0%   (0/2)
findResourceType (String): ProcessingResourceType 0%   (0/1)0%   (0/40)0%   (0/4)
getAssemblyContext (): AssemblyContext 0%   (0/1)0%   (0/3)0%   (0/1)
getComponent (): RepositoryComponent 0%   (0/1)0%   (0/3)0%   (0/1)
getNextCounter (): int 0%   (0/1)0%   (0/6)0%   (0/2)
getOperationProvidedRole (): OperationProvidedRole 0%   (0/1)0%   (0/3)0%   (0/1)
getOperationRequiredRole (): OperationRequiredRole 0%   (0/1)0%   (0/3)0%   (0/1)

1package de.uka.ipd.sdq.pcm.transformations.builder.abstractbuilder;
2 
3import de.uka.ipd.sdq.pcm.core.composition.AssemblyContext;
4import de.uka.ipd.sdq.pcm.repository.OperationInterface;
5import de.uka.ipd.sdq.pcm.repository.OperationProvidedRole;
6import de.uka.ipd.sdq.pcm.repository.OperationRequiredRole;
7import de.uka.ipd.sdq.pcm.repository.ProvidedRole;
8import de.uka.ipd.sdq.pcm.repository.RepositoryComponent;
9import de.uka.ipd.sdq.pcm.repository.RepositoryFactory;
10import de.uka.ipd.sdq.pcm.repository.RequiredRole;
11import de.uka.ipd.sdq.pcm.resourcetype.ProcessingResourceType;
12import de.uka.ipd.sdq.pcm.resourcetype.ResourceType;
13import de.uka.ipd.sdq.pcm.transformations.builder.IComponentBuilder;
14import de.uka.ipd.sdq.pcm.transformations.builder.util.PCMAndCompletionModelHolder;
15 
16/**
17 * Replaces the passed AssemblyConnector with a completion
18 * @author  Snowball
19 */
20public abstract class AbstractComponentBuilder
21implements IComponentBuilder {
22        
23        /**
24         */
25        protected RepositoryComponent myComponent;
26        protected OperationProvidedRole myOperationProvidedRole;
27        protected OperationRequiredRole myOperationRequiredRole;
28        protected AssemblyContext myAssemblyContext;
29        protected PCMAndCompletionModelHolder myModels;
30        
31        private static int counter = 0;
32 
33        public AbstractComponentBuilder(PCMAndCompletionModelHolder models, String componentName) {
34                this.myComponent = createComponent(componentName);
35                this.myModels = models;
36        }
37        
38        protected abstract RepositoryComponent createComponent(String componentName);
39        
40        public AssemblyContext getAssemblyContext() {
41                return myAssemblyContext;
42        }
43 
44        protected OperationProvidedRole addOperationProvidedRole(OperationInterface interf, String roleName) {
45                OperationProvidedRole result = RepositoryFactory.eINSTANCE.createOperationProvidedRole();
46                result.setProvidedInterface__OperationProvidedRole(interf);
47                result.setEntityName(roleName);
48                myComponent.getProvidedRoles_InterfaceProvidingEntity().add(result);
49                return result;
50        }
51 
52        protected OperationRequiredRole addOperationRequiredRole(OperationInterface interf, String roleName) {
53                OperationRequiredRole result = RepositoryFactory.eINSTANCE.createOperationRequiredRole();
54                result.setRequiredInterface__OperationRequiredRole(interf);
55                result.setEntityName(roleName);
56                myComponent.getRequiredRoles_InterfaceRequiringEntity().add(result);
57                return result;
58        }
59 
60        public OperationProvidedRole getOperationProvidedRole() {
61                return myOperationProvidedRole;
62        }
63 
64        public OperationRequiredRole getOperationRequiredRole() {
65                return myOperationRequiredRole;
66        }
67        
68        protected int getNextCounter(){
69                counter++;
70                return counter;
71        }
72 
73        public RepositoryComponent getComponent() {
74                return myComponent;
75        }
76 
77        public void build() {
78                myModels.getCompletionRepository().getComponents__Repository().add(myComponent);
79        }
80        
81        protected ProcessingResourceType findResourceType(String nameFragment) {
82                for (ResourceType type : myModels.getResourceRepository().getAvailableResourceTypes_ResourceRepository()){
83                        if (type instanceof ProcessingResourceType && type.getEntityName().toLowerCase().contains(nameFragment.toLowerCase()))
84                                return (ProcessingResourceType) type;
85                }
86                throw new RuntimeException("Neccessary resourcetype "+nameFragment+" not found");
87        }
88}

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