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

COVERAGE SUMMARY FOR SOURCE FILE [Transformation.java]

nameclass, %method, %block, %line, %
Transformation.java0%   (0/2)0%   (0/28)0%   (0/349)0%   (0/76)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class Transformation0%   (0/1)0%   (0/22)0%   (0/259)0%   (0/59)
Transformation (): void 0%   (0/1)0%   (0/11)0%   (0/4)
fromDataString (String): Transformation 0%   (0/1)0%   (0/9)0%   (0/3)
getCompletion (): RegisteredCompletion 0%   (0/1)0%   (0/13)0%   (0/4)
getConfigFileURI (): String 0%   (0/1)0%   (0/6)0%   (0/1)
getFeatureFileURI (): String 0%   (0/1)0%   (0/6)0%   (0/1)
getMetamodelFileURI (): String 0%   (0/1)0%   (0/16)0%   (0/4)
getOptionalModelFileURI (): String 0%   (0/1)0%   (0/6)0%   (0/1)
getQVTFileURI (): String 0%   (0/1)0%   (0/16)0%   (0/4)
getQVTType (): Transformation$TransformationQVTType 0%   (0/1)0%   (0/24)0%   (0/7)
getType (): TransformationType 0%   (0/1)0%   (0/7)0%   (0/1)
isEnabled (): Boolean 0%   (0/1)0%   (0/8)0%   (0/1)
readFromDataString (String): void 0%   (0/1)0%   (0/30)0%   (0/5)
setCompletion (String): void 0%   (0/1)0%   (0/7)0%   (0/2)
setConfigFileURI (String): void 0%   (0/1)0%   (0/7)0%   (0/2)
setEnabled (Boolean): void 0%   (0/1)0%   (0/8)0%   (0/2)
setFeatureFileURI (String): void 0%   (0/1)0%   (0/7)0%   (0/2)
setMetamodelFileURI (String): void 0%   (0/1)0%   (0/7)0%   (0/2)
setOptionalModelFileURI (String): void 0%   (0/1)0%   (0/7)0%   (0/2)
setQVTFileURI (String): void 0%   (0/1)0%   (0/7)0%   (0/2)
setQVTType (Transformation$TransformationQVTType): void 0%   (0/1)0%   (0/8)0%   (0/2)
setType (TransformationType): void 0%   (0/1)0%   (0/8)0%   (0/2)
toDataString (): String 0%   (0/1)0%   (0/41)0%   (0/5)
     
class Transformation$TransformationQVTType0%   (0/1)0%   (0/6)0%   (0/90)0%   (0/17)
<static initializer> 0%   (0/1)0%   (0/34)0%   (0/4)
Transformation$TransformationQVTType (String, int): void 0%   (0/1)0%   (0/5)0%   (0/1)
fromString (String): Transformation$TransformationQVTType 0%   (0/1)0%   (0/18)0%   (0/7)
toString (): String 0%   (0/1)0%   (0/12)0%   (0/5)
valueOf (String): Transformation$TransformationQVTType 0%   (0/1)0%   (0/5)0%   (0/1)
values (): Transformation$TransformationQVTType [] 0%   (0/1)0%   (0/16)0%   (0/1)

1package de.uka.ipd.sdq.cip.configuration;
2 
3import java.util.HashMap;
4import java.util.Map;
5 
6import de.uka.ipd.sdq.cip.ConstantsContainer;
7import de.uka.ipd.sdq.cip.completions.RegisteredCompletion;
8import de.uka.ipd.sdq.cip.completions.RegisteredCompletions;
9 
10/**
11 * Transformation contains the configuration
12 * for a single Completion. 
13 * 
14 * @author Thomas Schuischel
15 * 
16 */
17public class Transformation {
18        
19        public enum TransformationQVTType {
20                NONE,
21                QVTR,
22                QVTO;
23                
24                public String toString(){
25                        if(this == QVTR)
26                                return "QVTR";
27                        else if(this == QVTO)
28                                return "QVTO";
29                        
30                        return "QVTR";
31                }
32                
33                public static TransformationQVTType fromString(String value){
34                        if(value == null)
35                                return QVTR;
36                        
37                        if(value.equalsIgnoreCase  ("QVTR"))
38                                return QVTR;
39                        else if(value.equalsIgnoreCase  ("QVTO"))
40                                return QVTO;
41                        
42                        return QVTR;
43                }
44        }
45        
46        Map<String, String> keyValueMap = null; 
47        
48        public Transformation() {
49                keyValueMap =  new HashMap<String, String>();
50        }
51 
52        public String toDataString() {
53                
54                String data = "";
55                
56                // write key-value combinations back to string
57                for ( String key : keyValueMap.keySet() )
58                {
59                        data += key + "="+keyValueMap.get(key) + ";";
60                }
61                
62                // remove last semikolon
63                data = data.replaceFirst(";$","");
64                
65                return data;
66        }
67        
68        public void readFromDataString(String data) {
69                String[] dataStrings = data.split(";", -1);
70                
71                // read key-value combinations from string
72                for(int i= 0; i< dataStrings.length; i++)
73                {
74                        String[] keyValueData = dataStrings[i].split("=");
75                        keyValueMap.put(keyValueData[0], keyValueData[1]);
76                }
77        }
78        
79        public static Transformation fromDataString(String data) {
80                Transformation transformation = new Transformation();
81                transformation.readFromDataString(data);
82                return transformation;
83        }
84        
85        public Boolean isEnabled() {
86                return Boolean.parseBoolean(keyValueMap.get("enabled"));
87        }
88        
89        public void setEnabled(Boolean enabled) {
90                keyValueMap.put("enabled", enabled.toString());
91        }
92        
93        public TransformationType getType() {
94                return TransformationType.fromString(keyValueMap.get("type"));
95        }
96        
97        public void setType(TransformationType type) {
98                keyValueMap.put("type", type.toString());
99        }
100        
101        public TransformationQVTType getQVTType() {
102                if(getType() == TransformationType.REGISTERED){
103                        RegisteredCompletion completion = getCompletion();
104                        
105                        if(completion == null)
106                                return TransformationQVTType.NONE;
107                        
108                        if(completion.containsCategory(ConstantsContainer.QVTO_Category))
109                                return TransformationQVTType.QVTO;
110                }
111                
112                return TransformationQVTType.fromString(keyValueMap.get("qvtrType"));
113        }
114        
115        public void setQVTType(TransformationQVTType qvtType) {
116                keyValueMap.put("qvtrType", qvtType.toString());
117        }
118        
119        public RegisteredCompletion getCompletion() {
120                String ID = keyValueMap.get("id");
121                
122                if(ID == null)
123                        return null;
124                
125                return RegisteredCompletions.findCompletion(ID);
126        }
127        
128        public void setCompletion(String ID) {
129                keyValueMap.put("id",ID);
130        }
131 
132        public void setFeatureFileURI(String featureFileURI) {
133                keyValueMap.put("featureFileURI", featureFileURI);
134        }
135        
136        public String getFeatureFileURI() {
137                return keyValueMap.get("featureFileURI");
138        }
139 
140        public void setConfigFileURI(String configFileURI) {
141                keyValueMap.put("configFileURI", configFileURI);        
142        }
143        
144        public String getConfigFileURI() {
145                return keyValueMap.get("configFileURI");        
146        }
147 
148        public void setMetamodelFileURI(String metamodelFileURI) {
149                keyValueMap.put("metamodelFileURI", metamodelFileURI);                
150        }
151        
152        public String getMetamodelFileURI() {
153                if(getType() == TransformationType.REGISTERED){
154                        RegisteredCompletion completion = getCompletion();
155                        return completion.getMetamodel();
156                }
157                
158                return keyValueMap.get("metamodelFileURI");        
159        }
160 
161        public void setQVTFileURI(String qvtFileURI) {
162                keyValueMap.put("qvtFileURI", qvtFileURI);        
163        }
164        
165        public String getQVTFileURI() {
166                if(getType() == TransformationType.REGISTERED){
167                        RegisteredCompletion completion = getCompletion();
168                        return completion.getQvtscript();
169                }
170                
171                return keyValueMap.get("qvtFileURI");        
172        }
173 
174        /**
175         * Set an optional additional model to be used in the transformation.
176         * 
177         * @param optionalModelFileURI The URI to the model.
178         */
179        public void setOptionalModelFileURI(String optionalModelFileURI) {
180                keyValueMap.put("optionalModelFileURI", optionalModelFileURI);        
181        }
182        
183        /**
184         * Get an optional additional model to be used in the transformation.
185         * 
186         * @return The URI to the model.
187         */
188        public String getOptionalModelFileURI() {
189                return keyValueMap.get("optionalModelFileURI");        
190        }
191}

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