1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.featureconfig.impl; |
8 | |
9 | import de.uka.ipd.sdq.featureconfig.*; |
10 | import org.eclipse.emf.ecore.EClass; |
11 | import org.eclipse.emf.ecore.EDataType; |
12 | import org.eclipse.emf.ecore.EObject; |
13 | import org.eclipse.emf.ecore.EPackage; |
14 | import org.eclipse.emf.ecore.impl.EFactoryImpl; |
15 | import org.eclipse.emf.ecore.plugin.EcorePlugin; |
16 | |
17 | import de.uka.ipd.sdq.featureconfig.ConfigNode; |
18 | import de.uka.ipd.sdq.featureconfig.ConfigState; |
19 | import de.uka.ipd.sdq.featureconfig.Configuration; |
20 | import de.uka.ipd.sdq.featureconfig.DoubleAttributeValue; |
21 | import de.uka.ipd.sdq.featureconfig.FeatureConfig; |
22 | import de.uka.ipd.sdq.featureconfig.FeatureConfigState; |
23 | import de.uka.ipd.sdq.featureconfig.IntegerAttributeValue; |
24 | import de.uka.ipd.sdq.featureconfig.featureconfigFactory; |
25 | import de.uka.ipd.sdq.featureconfig.featureconfigPackage; |
26 | |
27 | /** |
28 | * <!-- begin-user-doc --> |
29 | * An implementation of the model <b>Factory</b>. |
30 | * <!-- end-user-doc --> |
31 | * @generated |
32 | */ |
33 | public class featureconfigFactoryImpl extends EFactoryImpl implements featureconfigFactory { |
34 | /** |
35 | * Creates the default factory implementation. |
36 | * <!-- begin-user-doc --> |
37 | * <!-- end-user-doc --> |
38 | * @generated |
39 | */ |
40 | public static featureconfigFactory init() { |
41 | try { |
42 | featureconfigFactory thefeatureconfigFactory = (featureconfigFactory)EPackage.Registry.INSTANCE.getEFactory("http://sdq.ipd.uka.de/FeatureConfig/2.0"); |
43 | if (thefeatureconfigFactory != null) { |
44 | return thefeatureconfigFactory; |
45 | } |
46 | } |
47 | catch (Exception exception) { |
48 | EcorePlugin.INSTANCE.log(exception); |
49 | } |
50 | return new featureconfigFactoryImpl(); |
51 | } |
52 | |
53 | /** |
54 | * Creates an instance of the factory. |
55 | * <!-- begin-user-doc --> |
56 | * <!-- end-user-doc --> |
57 | * @generated |
58 | */ |
59 | public featureconfigFactoryImpl() { |
60 | super(); |
61 | } |
62 | |
63 | /** |
64 | * <!-- begin-user-doc --> |
65 | * <!-- end-user-doc --> |
66 | * @generated |
67 | */ |
68 | @Override |
69 | public EObject create(EClass eClass) { |
70 | switch (eClass.getClassifierID()) { |
71 | case featureconfigPackage.CONFIG_NODE: return createConfigNode(); |
72 | case featureconfigPackage.FEATURE_CONFIG: return createFeatureConfig(); |
73 | case featureconfigPackage.CONFIGURATION: return createConfiguration(); |
74 | case featureconfigPackage.INTEGER_ATTRIBUTE_VALUE: return createIntegerAttributeValue(); |
75 | case featureconfigPackage.DOUBLE_ATTRIBUTE_VALUE: return createDoubleAttributeValue(); |
76 | case featureconfigPackage.STRING_ATTRIBUTE_VALUE: return createStringAttributeValue(); |
77 | case featureconfigPackage.EXTERNAL_OBJECT_ATTRIBUTE_VALUE: return createExternalObjectAttributeValue(); |
78 | default: |
79 | throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); |
80 | } |
81 | } |
82 | |
83 | /** |
84 | * <!-- begin-user-doc --> |
85 | * <!-- end-user-doc --> |
86 | * @generated |
87 | */ |
88 | @Override |
89 | public Object createFromString(EDataType eDataType, String initialValue) { |
90 | switch (eDataType.getClassifierID()) { |
91 | case featureconfigPackage.CONFIG_STATE: |
92 | return createConfigStateFromString(eDataType, initialValue); |
93 | case featureconfigPackage.FEATURE_CONFIG_STATE: |
94 | return createFeatureConfigStateFromString(eDataType, initialValue); |
95 | default: |
96 | throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); |
97 | } |
98 | } |
99 | |
100 | /** |
101 | * <!-- begin-user-doc --> |
102 | * <!-- end-user-doc --> |
103 | * @generated |
104 | */ |
105 | @Override |
106 | public String convertToString(EDataType eDataType, Object instanceValue) { |
107 | switch (eDataType.getClassifierID()) { |
108 | case featureconfigPackage.CONFIG_STATE: |
109 | return convertConfigStateToString(eDataType, instanceValue); |
110 | case featureconfigPackage.FEATURE_CONFIG_STATE: |
111 | return convertFeatureConfigStateToString(eDataType, instanceValue); |
112 | default: |
113 | throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); |
114 | } |
115 | } |
116 | |
117 | /** |
118 | * <!-- begin-user-doc --> |
119 | * <!-- end-user-doc --> |
120 | * @generated |
121 | */ |
122 | public ConfigNode createConfigNode() { |
123 | ConfigNodeImpl configNode = new ConfigNodeImpl(); |
124 | return configNode; |
125 | } |
126 | |
127 | /** |
128 | * <!-- begin-user-doc --> |
129 | * <!-- end-user-doc --> |
130 | * @generated |
131 | */ |
132 | public FeatureConfig createFeatureConfig() { |
133 | FeatureConfigImpl featureConfig = new FeatureConfigImpl(); |
134 | return featureConfig; |
135 | } |
136 | |
137 | /** |
138 | * <!-- begin-user-doc --> |
139 | * <!-- end-user-doc --> |
140 | * @generated |
141 | */ |
142 | public Configuration createConfiguration() { |
143 | ConfigurationImpl configuration = new ConfigurationImpl(); |
144 | return configuration; |
145 | } |
146 | |
147 | /** |
148 | * <!-- begin-user-doc --> |
149 | * <!-- end-user-doc --> |
150 | * @generated |
151 | */ |
152 | public IntegerAttributeValue createIntegerAttributeValue() { |
153 | IntegerAttributeValueImpl integerAttributeValue = new IntegerAttributeValueImpl(); |
154 | return integerAttributeValue; |
155 | } |
156 | |
157 | /** |
158 | * <!-- begin-user-doc --> |
159 | * <!-- end-user-doc --> |
160 | * @generated |
161 | */ |
162 | public DoubleAttributeValue createDoubleAttributeValue() { |
163 | DoubleAttributeValueImpl doubleAttributeValue = new DoubleAttributeValueImpl(); |
164 | return doubleAttributeValue; |
165 | } |
166 | |
167 | /** |
168 | * <!-- begin-user-doc --> |
169 | * <!-- end-user-doc --> |
170 | * @generated |
171 | */ |
172 | public StringAttributeValue createStringAttributeValue() { |
173 | StringAttributeValueImpl stringAttributeValue = new StringAttributeValueImpl(); |
174 | return stringAttributeValue; |
175 | } |
176 | |
177 | /** |
178 | * <!-- begin-user-doc --> |
179 | * <!-- end-user-doc --> |
180 | * @generated |
181 | */ |
182 | public ExternalObjectAttributeValue createExternalObjectAttributeValue() { |
183 | ExternalObjectAttributeValueImpl externalObjectAttributeValue = new ExternalObjectAttributeValueImpl(); |
184 | return externalObjectAttributeValue; |
185 | } |
186 | |
187 | /** |
188 | * <!-- begin-user-doc --> |
189 | * <!-- end-user-doc --> |
190 | * @generated |
191 | */ |
192 | public ConfigState createConfigStateFromString(EDataType eDataType, String initialValue) { |
193 | ConfigState result = ConfigState.get(initialValue); |
194 | if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); |
195 | return result; |
196 | } |
197 | |
198 | /** |
199 | * <!-- begin-user-doc --> |
200 | * <!-- end-user-doc --> |
201 | * @generated |
202 | */ |
203 | public String convertConfigStateToString(EDataType eDataType, Object instanceValue) { |
204 | return instanceValue == null ? null : instanceValue.toString(); |
205 | } |
206 | |
207 | /** |
208 | * <!-- begin-user-doc --> |
209 | * <!-- end-user-doc --> |
210 | * @generated |
211 | */ |
212 | public FeatureConfigState createFeatureConfigStateFromString(EDataType eDataType, String initialValue) { |
213 | FeatureConfigState result = FeatureConfigState.get(initialValue); |
214 | if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); |
215 | return result; |
216 | } |
217 | |
218 | /** |
219 | * <!-- begin-user-doc --> |
220 | * <!-- end-user-doc --> |
221 | * @generated |
222 | */ |
223 | public String convertFeatureConfigStateToString(EDataType eDataType, Object instanceValue) { |
224 | return instanceValue == null ? null : instanceValue.toString(); |
225 | } |
226 | |
227 | /** |
228 | * <!-- begin-user-doc --> |
229 | * <!-- end-user-doc --> |
230 | * @generated |
231 | */ |
232 | public featureconfigPackage getfeatureconfigPackage() { |
233 | return (featureconfigPackage)getEPackage(); |
234 | } |
235 | |
236 | /** |
237 | * <!-- begin-user-doc --> |
238 | * <!-- end-user-doc --> |
239 | * @deprecated |
240 | * @generated |
241 | */ |
242 | @Deprecated |
243 | public static featureconfigPackage getPackage() { |
244 | return featureconfigPackage.eINSTANCE; |
245 | } |
246 | |
247 | } //featureconfigFactoryImpl |