1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.featuremodel.impl; |
8 | |
9 | import de.uka.ipd.sdq.featuremodel.*; |
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.featuremodel.AttributeTypes; |
18 | import de.uka.ipd.sdq.featuremodel.ContinousIntervalRange; |
19 | import de.uka.ipd.sdq.featuremodel.DoubleAttribute; |
20 | import de.uka.ipd.sdq.featuremodel.Feature; |
21 | import de.uka.ipd.sdq.featuremodel.FeatureDiagram; |
22 | import de.uka.ipd.sdq.featuremodel.FeatureGroup; |
23 | import de.uka.ipd.sdq.featuremodel.IntegerAttribute; |
24 | import de.uka.ipd.sdq.featuremodel.IntegerIntervalRange; |
25 | import de.uka.ipd.sdq.featuremodel.ProhibitsConstraint; |
26 | import de.uka.ipd.sdq.featuremodel.RequiredConstraint; |
27 | import de.uka.ipd.sdq.featuremodel.Simple; |
28 | import de.uka.ipd.sdq.featuremodel.featuremodelFactory; |
29 | import de.uka.ipd.sdq.featuremodel.featuremodelPackage; |
30 | |
31 | /** |
32 | * <!-- begin-user-doc --> |
33 | * An implementation of the model <b>Factory</b>. |
34 | * <!-- end-user-doc --> |
35 | * @generated |
36 | */ |
37 | public class featuremodelFactoryImpl extends EFactoryImpl implements featuremodelFactory { |
38 | /** |
39 | * Creates the default factory implementation. |
40 | * <!-- begin-user-doc --> |
41 | * <!-- end-user-doc --> |
42 | * @generated |
43 | */ |
44 | public static featuremodelFactory init() { |
45 | try { |
46 | featuremodelFactory thefeaturemodelFactory = (featuremodelFactory)EPackage.Registry.INSTANCE.getEFactory("http://sdq.ipd.uka.de/FeatureModel/2.0"); |
47 | if (thefeaturemodelFactory != null) { |
48 | return thefeaturemodelFactory; |
49 | } |
50 | } |
51 | catch (Exception exception) { |
52 | EcorePlugin.INSTANCE.log(exception); |
53 | } |
54 | return new featuremodelFactoryImpl(); |
55 | } |
56 | |
57 | /** |
58 | * Creates an instance of the factory. |
59 | * <!-- begin-user-doc --> |
60 | * <!-- end-user-doc --> |
61 | * @generated |
62 | */ |
63 | public featuremodelFactoryImpl() { |
64 | super(); |
65 | } |
66 | |
67 | /** |
68 | * <!-- begin-user-doc --> |
69 | * <!-- end-user-doc --> |
70 | * @generated |
71 | */ |
72 | @Override |
73 | public EObject create(EClass eClass) { |
74 | switch (eClass.getClassifierID()) { |
75 | case featuremodelPackage.FEATURE: return createFeature(); |
76 | case featuremodelPackage.SIMPLE: return createSimple(); |
77 | case featuremodelPackage.FEATURE_GROUP: return createFeatureGroup(); |
78 | case featuremodelPackage.FEATURE_DIAGRAM: return createFeatureDiagram(); |
79 | case featuremodelPackage.REQUIRED_CONSTRAINT: return createRequiredConstraint(); |
80 | case featuremodelPackage.PROHIBITS_CONSTRAINT: return createProhibitsConstraint(); |
81 | case featuremodelPackage.INTEGER_INTERVAL_RANGE: return createIntegerIntervalRange(); |
82 | case featuremodelPackage.CONTINOUS_INTERVAL_RANGE: return createContinousIntervalRange(); |
83 | case featuremodelPackage.INTEGER_ATTRIBUTE: return createIntegerAttribute(); |
84 | case featuremodelPackage.DOUBLE_ATTRIBUTE: return createDoubleAttribute(); |
85 | case featuremodelPackage.STRING_ATTRIBUTE: return createStringAttribute(); |
86 | case featuremodelPackage.EXTERNAL_OBJECT_ATTRIBUTE: return createExternalObjectAttribute(); |
87 | default: |
88 | throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); |
89 | } |
90 | } |
91 | |
92 | /** |
93 | * <!-- begin-user-doc --> |
94 | * <!-- end-user-doc --> |
95 | * @generated |
96 | */ |
97 | @Override |
98 | public Object createFromString(EDataType eDataType, String initialValue) { |
99 | switch (eDataType.getClassifierID()) { |
100 | case featuremodelPackage.ATTRIBUTE_TYPES: |
101 | return createAttributeTypesFromString(eDataType, initialValue); |
102 | default: |
103 | throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); |
104 | } |
105 | } |
106 | |
107 | /** |
108 | * <!-- begin-user-doc --> |
109 | * <!-- end-user-doc --> |
110 | * @generated |
111 | */ |
112 | @Override |
113 | public String convertToString(EDataType eDataType, Object instanceValue) { |
114 | switch (eDataType.getClassifierID()) { |
115 | case featuremodelPackage.ATTRIBUTE_TYPES: |
116 | return convertAttributeTypesToString(eDataType, instanceValue); |
117 | default: |
118 | throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); |
119 | } |
120 | } |
121 | |
122 | /** |
123 | * <!-- begin-user-doc --> |
124 | * <!-- end-user-doc --> |
125 | * @generated |
126 | */ |
127 | public Feature createFeature() { |
128 | FeatureImpl feature = new FeatureImpl(); |
129 | return feature; |
130 | } |
131 | |
132 | /** |
133 | * <!-- begin-user-doc --> |
134 | * <!-- end-user-doc --> |
135 | * @generated |
136 | */ |
137 | public Simple createSimple() { |
138 | SimpleImpl simple = new SimpleImpl(); |
139 | return simple; |
140 | } |
141 | |
142 | /** |
143 | * <!-- begin-user-doc --> |
144 | * <!-- end-user-doc --> |
145 | * @generated |
146 | */ |
147 | public FeatureGroup createFeatureGroup() { |
148 | FeatureGroupImpl featureGroup = new FeatureGroupImpl(); |
149 | return featureGroup; |
150 | } |
151 | |
152 | /** |
153 | * <!-- begin-user-doc --> |
154 | * <!-- end-user-doc --> |
155 | * @generated |
156 | */ |
157 | public FeatureDiagram createFeatureDiagram() { |
158 | FeatureDiagramImpl featureDiagram = new FeatureDiagramImpl(); |
159 | return featureDiagram; |
160 | } |
161 | |
162 | /** |
163 | * <!-- begin-user-doc --> |
164 | * <!-- end-user-doc --> |
165 | * @generated |
166 | */ |
167 | public IntegerIntervalRange createIntegerIntervalRange() { |
168 | IntegerIntervalRangeImpl integerIntervalRange = new IntegerIntervalRangeImpl(); |
169 | return integerIntervalRange; |
170 | } |
171 | |
172 | /** |
173 | * <!-- begin-user-doc --> |
174 | * <!-- end-user-doc --> |
175 | * @generated |
176 | */ |
177 | public ContinousIntervalRange createContinousIntervalRange() { |
178 | ContinousIntervalRangeImpl continousIntervalRange = new ContinousIntervalRangeImpl(); |
179 | return continousIntervalRange; |
180 | } |
181 | |
182 | /** |
183 | * <!-- begin-user-doc --> |
184 | * <!-- end-user-doc --> |
185 | * @generated |
186 | */ |
187 | public IntegerAttribute createIntegerAttribute() { |
188 | IntegerAttributeImpl integerAttribute = new IntegerAttributeImpl(); |
189 | return integerAttribute; |
190 | } |
191 | |
192 | /** |
193 | * <!-- begin-user-doc --> |
194 | * <!-- end-user-doc --> |
195 | * @generated |
196 | */ |
197 | public DoubleAttribute createDoubleAttribute() { |
198 | DoubleAttributeImpl doubleAttribute = new DoubleAttributeImpl(); |
199 | return doubleAttribute; |
200 | } |
201 | |
202 | /** |
203 | * <!-- begin-user-doc --> |
204 | * <!-- end-user-doc --> |
205 | * @generated |
206 | */ |
207 | public StringAttribute createStringAttribute() { |
208 | StringAttributeImpl stringAttribute = new StringAttributeImpl(); |
209 | return stringAttribute; |
210 | } |
211 | |
212 | /** |
213 | * <!-- begin-user-doc --> |
214 | * <!-- end-user-doc --> |
215 | * @generated |
216 | */ |
217 | public ExternalObjectAttribute createExternalObjectAttribute() { |
218 | ExternalObjectAttributeImpl externalObjectAttribute = new ExternalObjectAttributeImpl(); |
219 | return externalObjectAttribute; |
220 | } |
221 | |
222 | /** |
223 | * <!-- begin-user-doc --> |
224 | * <!-- end-user-doc --> |
225 | * @generated |
226 | */ |
227 | public RequiredConstraint createRequiredConstraint() { |
228 | RequiredConstraintImpl requiredConstraint = new RequiredConstraintImpl(); |
229 | return requiredConstraint; |
230 | } |
231 | |
232 | /** |
233 | * <!-- begin-user-doc --> |
234 | * <!-- end-user-doc --> |
235 | * @generated |
236 | */ |
237 | public ProhibitsConstraint createProhibitsConstraint() { |
238 | ProhibitsConstraintImpl prohibitsConstraint = new ProhibitsConstraintImpl(); |
239 | return prohibitsConstraint; |
240 | } |
241 | |
242 | /** |
243 | * <!-- begin-user-doc --> |
244 | * <!-- end-user-doc --> |
245 | * @generated |
246 | */ |
247 | public AttributeTypes createAttributeTypesFromString(EDataType eDataType, String initialValue) { |
248 | AttributeTypes result = AttributeTypes.get(initialValue); |
249 | if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); |
250 | return result; |
251 | } |
252 | |
253 | /** |
254 | * <!-- begin-user-doc --> |
255 | * <!-- end-user-doc --> |
256 | * @generated |
257 | */ |
258 | public String convertAttributeTypesToString(EDataType eDataType, Object instanceValue) { |
259 | return instanceValue == null ? null : instanceValue.toString(); |
260 | } |
261 | |
262 | /** |
263 | * <!-- begin-user-doc --> |
264 | * <!-- end-user-doc --> |
265 | * @generated |
266 | */ |
267 | public featuremodelPackage getfeaturemodelPackage() { |
268 | return (featuremodelPackage)getEPackage(); |
269 | } |
270 | |
271 | /** |
272 | * <!-- begin-user-doc --> |
273 | * <!-- end-user-doc --> |
274 | * @deprecated |
275 | * @generated |
276 | */ |
277 | @Deprecated |
278 | public static featuremodelPackage getPackage() { |
279 | return featuremodelPackage.eINSTANCE; |
280 | } |
281 | |
282 | } //featuremodelFactoryImpl |