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

COVERAGE SUMMARY FOR SOURCE FILE [AllInstancesTransformer.java]

nameclass, %method, %block, %line, %
AllInstancesTransformer.java0%   (0/1)0%   (0/2)0%   (0/55)0%   (0/16)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AllInstancesTransformer0%   (0/1)0%   (0/2)0%   (0/55)0%   (0/16)
AllInstancesTransformer (EClassifier, EObject): void 0%   (0/1)0%   (0/9)0%   (0/4)
transform (): void 0%   (0/1)0%   (0/46)0%   (0/12)

1package de.uka.ipd.sdq.pcm.transformations;
2 
3import java.util.Set;
4 
5import org.eclipse.emf.ecore.EClass;
6import org.eclipse.emf.ecore.EClassifier;
7import org.eclipse.emf.ecore.EObject;
8import org.eclipse.emf.query.ocl.conditions.BooleanOCLCondition;
9import org.eclipse.emf.query.statements.FROM;
10import org.eclipse.emf.query.statements.SELECT;
11import org.eclipse.emf.query.statements.WHERE;
12import org.eclipse.ocl.OCL;
13 
14import de.uka.ipd.sdq.workflow.exceptions.JobFailedException;
15 
16public abstract class AllInstancesTransformer<T> {
17 
18        private EObject rootNode;
19        private EClassifier eClass;
20 
21        public AllInstancesTransformer(EClassifier eClass, EObject rootNode) {
22                super();
23                this.rootNode = rootNode;
24                this.eClass = eClass;
25        }
26 
27        @SuppressWarnings("unchecked")
28        public void transform() throws JobFailedException {
29                OCL ocl = org.eclipse.ocl.ecore.OCL.newInstance();
30 
31                try {
32                        Set<EObject> result = (Set<EObject>) new SELECT(
33                                    new FROM(rootNode),
34                                    new WHERE(new BooleanOCLCondition<EClassifier, EClass, EObject>(
35                                            ocl.getEnvironment(),
36                                        "true",
37                                        eClass))).getEObjects();
38                        for(EObject eObject : result) {
39                        transform((T)eObject);
40                        }
41            } catch (Exception ex) {
42                        throw new JobFailedException("Transformation failed",ex);
43            }
44        }
45 
46        protected abstract void transform(T object);
47}

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