1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.stoex.impl; |
8 | |
9 | import org.eclipse.emf.ecore.EClass; |
10 | import org.eclipse.emf.ecore.EDataType; |
11 | import org.eclipse.emf.ecore.EObject; |
12 | import org.eclipse.emf.ecore.EPackage; |
13 | import org.eclipse.emf.ecore.impl.EFactoryImpl; |
14 | import org.eclipse.emf.ecore.plugin.EcorePlugin; |
15 | |
16 | import de.uka.ipd.sdq.stoex.BoolLiteral; |
17 | import de.uka.ipd.sdq.stoex.BooleanOperations; |
18 | import de.uka.ipd.sdq.stoex.BooleanOperatorExpression; |
19 | import de.uka.ipd.sdq.stoex.CompareExpression; |
20 | import de.uka.ipd.sdq.stoex.CompareOperations; |
21 | import de.uka.ipd.sdq.stoex.DoubleLiteral; |
22 | import de.uka.ipd.sdq.stoex.FunctionLiteral; |
23 | import de.uka.ipd.sdq.stoex.IfElseExpression; |
24 | import de.uka.ipd.sdq.stoex.IntLiteral; |
25 | import de.uka.ipd.sdq.stoex.NamespaceReference; |
26 | import de.uka.ipd.sdq.stoex.NegativeExpression; |
27 | import de.uka.ipd.sdq.stoex.NotExpression; |
28 | import de.uka.ipd.sdq.stoex.Parenthesis; |
29 | import de.uka.ipd.sdq.stoex.PowerExpression; |
30 | import de.uka.ipd.sdq.stoex.ProbabilityFunctionLiteral; |
31 | import de.uka.ipd.sdq.stoex.ProductExpression; |
32 | import de.uka.ipd.sdq.stoex.ProductOperations; |
33 | import de.uka.ipd.sdq.stoex.RandomVariable; |
34 | import de.uka.ipd.sdq.stoex.StoexFactory; |
35 | import de.uka.ipd.sdq.stoex.StoexPackage; |
36 | import de.uka.ipd.sdq.stoex.StringLiteral; |
37 | import de.uka.ipd.sdq.stoex.TermExpression; |
38 | import de.uka.ipd.sdq.stoex.TermOperations; |
39 | import de.uka.ipd.sdq.stoex.Variable; |
40 | import de.uka.ipd.sdq.stoex.VariableReference; |
41 | |
42 | /** |
43 | * <!-- begin-user-doc --> |
44 | * An implementation of the model <b>Factory</b>. |
45 | * <!-- end-user-doc --> |
46 | * @generated |
47 | */ |
48 | public class StoexFactoryImpl extends EFactoryImpl implements StoexFactory { |
49 | /** |
50 | * <!-- begin-user-doc --> |
51 | * <!-- end-user-doc --> |
52 | * @generated |
53 | */ |
54 | public static final String copyright = "Copyright 2007-2009, SDQ, IPD, U Karlsruhe"; |
55 | |
56 | /** |
57 | * Creates the default factory implementation. |
58 | * <!-- begin-user-doc --> |
59 | * <!-- end-user-doc --> |
60 | * @generated |
61 | */ |
62 | public static StoexFactory init() { |
63 | try { |
64 | StoexFactory theStoexFactory = (StoexFactory)EPackage.Registry.INSTANCE.getEFactory("http://sdq.ipd.uka.de/StochasticExpressions/1.0"); |
65 | if (theStoexFactory != null) { |
66 | return theStoexFactory; |
67 | } |
68 | } |
69 | catch (Exception exception) { |
70 | EcorePlugin.INSTANCE.log(exception); |
71 | } |
72 | return new StoexFactoryImpl(); |
73 | } |
74 | |
75 | /** |
76 | * Creates an instance of the factory. |
77 | * <!-- begin-user-doc --> |
78 | * <!-- end-user-doc --> |
79 | * @generated |
80 | */ |
81 | public StoexFactoryImpl() { |
82 | super(); |
83 | } |
84 | |
85 | /** |
86 | * <!-- begin-user-doc --> |
87 | * <!-- end-user-doc --> |
88 | * @generated |
89 | */ |
90 | @Override |
91 | public EObject create(EClass eClass) { |
92 | switch (eClass.getClassifierID()) { |
93 | case StoexPackage.VARIABLE_REFERENCE: return createVariableReference(); |
94 | case StoexPackage.NAMESPACE_REFERENCE: return createNamespaceReference(); |
95 | case StoexPackage.VARIABLE: return createVariable(); |
96 | case StoexPackage.TERM_EXPRESSION: return createTermExpression(); |
97 | case StoexPackage.PRODUCT_EXPRESSION: return createProductExpression(); |
98 | case StoexPackage.PROBABILITY_FUNCTION_LITERAL: return createProbabilityFunctionLiteral(); |
99 | case StoexPackage.PARENTHESIS: return createParenthesis(); |
100 | case StoexPackage.INT_LITERAL: return createIntLiteral(); |
101 | case StoexPackage.DOUBLE_LITERAL: return createDoubleLiteral(); |
102 | case StoexPackage.COMPARE_EXPRESSION: return createCompareExpression(); |
103 | case StoexPackage.BOOL_LITERAL: return createBoolLiteral(); |
104 | case StoexPackage.STRING_LITERAL: return createStringLiteral(); |
105 | case StoexPackage.POWER_EXPRESSION: return createPowerExpression(); |
106 | case StoexPackage.BOOLEAN_OPERATOR_EXPRESSION: return createBooleanOperatorExpression(); |
107 | case StoexPackage.NOT_EXPRESSION: return createNotExpression(); |
108 | case StoexPackage.NEGATIVE_EXPRESSION: return createNegativeExpression(); |
109 | case StoexPackage.FUNCTION_LITERAL: return createFunctionLiteral(); |
110 | case StoexPackage.IF_ELSE_EXPRESSION: return createIfElseExpression(); |
111 | case StoexPackage.RANDOM_VARIABLE: return createRandomVariable(); |
112 | default: |
113 | throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); |
114 | } |
115 | } |
116 | |
117 | /** |
118 | * <!-- begin-user-doc --> |
119 | * <!-- end-user-doc --> |
120 | * @generated |
121 | */ |
122 | @Override |
123 | public Object createFromString(EDataType eDataType, String initialValue) { |
124 | switch (eDataType.getClassifierID()) { |
125 | case StoexPackage.TERM_OPERATIONS: |
126 | return createTermOperationsFromString(eDataType, initialValue); |
127 | case StoexPackage.PRODUCT_OPERATIONS: |
128 | return createProductOperationsFromString(eDataType, initialValue); |
129 | case StoexPackage.COMPARE_OPERATIONS: |
130 | return createCompareOperationsFromString(eDataType, initialValue); |
131 | case StoexPackage.BOOLEAN_OPERATIONS: |
132 | return createBooleanOperationsFromString(eDataType, initialValue); |
133 | default: |
134 | throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); |
135 | } |
136 | } |
137 | |
138 | /** |
139 | * <!-- begin-user-doc --> |
140 | * <!-- end-user-doc --> |
141 | * @generated |
142 | */ |
143 | @Override |
144 | public String convertToString(EDataType eDataType, Object instanceValue) { |
145 | switch (eDataType.getClassifierID()) { |
146 | case StoexPackage.TERM_OPERATIONS: |
147 | return convertTermOperationsToString(eDataType, instanceValue); |
148 | case StoexPackage.PRODUCT_OPERATIONS: |
149 | return convertProductOperationsToString(eDataType, instanceValue); |
150 | case StoexPackage.COMPARE_OPERATIONS: |
151 | return convertCompareOperationsToString(eDataType, instanceValue); |
152 | case StoexPackage.BOOLEAN_OPERATIONS: |
153 | return convertBooleanOperationsToString(eDataType, instanceValue); |
154 | default: |
155 | throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); |
156 | } |
157 | } |
158 | |
159 | /** |
160 | * <!-- begin-user-doc --> |
161 | * <!-- end-user-doc --> |
162 | * @generated |
163 | */ |
164 | public VariableReference createVariableReference() { |
165 | VariableReferenceImpl variableReference = new VariableReferenceImpl(); |
166 | return variableReference; |
167 | } |
168 | |
169 | /** |
170 | * <!-- begin-user-doc --> |
171 | * <!-- end-user-doc --> |
172 | * @generated |
173 | */ |
174 | public NamespaceReference createNamespaceReference() { |
175 | NamespaceReferenceImpl namespaceReference = new NamespaceReferenceImpl(); |
176 | return namespaceReference; |
177 | } |
178 | |
179 | /** |
180 | * <!-- begin-user-doc --> |
181 | * <!-- end-user-doc --> |
182 | * @generated |
183 | */ |
184 | public Variable createVariable() { |
185 | VariableImpl variable = new VariableImpl(); |
186 | return variable; |
187 | } |
188 | |
189 | /** |
190 | * <!-- begin-user-doc --> |
191 | * <!-- end-user-doc --> |
192 | * @generated |
193 | */ |
194 | public TermExpression createTermExpression() { |
195 | TermExpressionImpl termExpression = new TermExpressionImpl(); |
196 | return termExpression; |
197 | } |
198 | |
199 | /** |
200 | * <!-- begin-user-doc --> |
201 | * <!-- end-user-doc --> |
202 | * @generated |
203 | */ |
204 | public RandomVariable createRandomVariable() { |
205 | RandomVariableImpl randomVariable = new RandomVariableImpl(); |
206 | return randomVariable; |
207 | } |
208 | |
209 | /** |
210 | * <!-- begin-user-doc --> |
211 | * <!-- end-user-doc --> |
212 | * @generated |
213 | */ |
214 | public ProductExpression createProductExpression() { |
215 | ProductExpressionImpl productExpression = new ProductExpressionImpl(); |
216 | return productExpression; |
217 | } |
218 | |
219 | /** |
220 | * <!-- begin-user-doc --> |
221 | * <!-- end-user-doc --> |
222 | * @generated |
223 | */ |
224 | public ProbabilityFunctionLiteral createProbabilityFunctionLiteral() { |
225 | ProbabilityFunctionLiteralImpl probabilityFunctionLiteral = new ProbabilityFunctionLiteralImpl(); |
226 | return probabilityFunctionLiteral; |
227 | } |
228 | |
229 | /** |
230 | * <!-- begin-user-doc --> |
231 | * <!-- end-user-doc --> |
232 | * @generated |
233 | */ |
234 | public Parenthesis createParenthesis() { |
235 | ParenthesisImpl parenthesis = new ParenthesisImpl(); |
236 | return parenthesis; |
237 | } |
238 | |
239 | /** |
240 | * <!-- begin-user-doc --> |
241 | * <!-- end-user-doc --> |
242 | * @generated |
243 | */ |
244 | public IntLiteral createIntLiteral() { |
245 | IntLiteralImpl intLiteral = new IntLiteralImpl(); |
246 | return intLiteral; |
247 | } |
248 | |
249 | /** |
250 | * <!-- begin-user-doc --> |
251 | * <!-- end-user-doc --> |
252 | * @generated |
253 | */ |
254 | public DoubleLiteral createDoubleLiteral() { |
255 | DoubleLiteralImpl doubleLiteral = new DoubleLiteralImpl(); |
256 | return doubleLiteral; |
257 | } |
258 | |
259 | /** |
260 | * <!-- begin-user-doc --> |
261 | * <!-- end-user-doc --> |
262 | * @generated |
263 | */ |
264 | public CompareExpression createCompareExpression() { |
265 | CompareExpressionImpl compareExpression = new CompareExpressionImpl(); |
266 | return compareExpression; |
267 | } |
268 | |
269 | /** |
270 | * <!-- begin-user-doc --> |
271 | * <!-- end-user-doc --> |
272 | * @generated |
273 | */ |
274 | public BoolLiteral createBoolLiteral() { |
275 | BoolLiteralImpl boolLiteral = new BoolLiteralImpl(); |
276 | return boolLiteral; |
277 | } |
278 | |
279 | /** |
280 | * <!-- begin-user-doc --> |
281 | * <!-- end-user-doc --> |
282 | * @generated |
283 | */ |
284 | public StringLiteral createStringLiteral() { |
285 | StringLiteralImpl stringLiteral = new StringLiteralImpl(); |
286 | return stringLiteral; |
287 | } |
288 | |
289 | /** |
290 | * <!-- begin-user-doc --> |
291 | * <!-- end-user-doc --> |
292 | * @generated |
293 | */ |
294 | public PowerExpression createPowerExpression() { |
295 | PowerExpressionImpl powerExpression = new PowerExpressionImpl(); |
296 | return powerExpression; |
297 | } |
298 | |
299 | /** |
300 | * <!-- begin-user-doc --> |
301 | * <!-- end-user-doc --> |
302 | * @generated |
303 | */ |
304 | public BooleanOperatorExpression createBooleanOperatorExpression() { |
305 | BooleanOperatorExpressionImpl booleanOperatorExpression = new BooleanOperatorExpressionImpl(); |
306 | return booleanOperatorExpression; |
307 | } |
308 | |
309 | /** |
310 | * <!-- begin-user-doc --> |
311 | * <!-- end-user-doc --> |
312 | * @generated |
313 | */ |
314 | public NotExpression createNotExpression() { |
315 | NotExpressionImpl notExpression = new NotExpressionImpl(); |
316 | return notExpression; |
317 | } |
318 | |
319 | /** |
320 | * <!-- begin-user-doc --> |
321 | * <!-- end-user-doc --> |
322 | * @generated |
323 | */ |
324 | public NegativeExpression createNegativeExpression() { |
325 | NegativeExpressionImpl negativeExpression = new NegativeExpressionImpl(); |
326 | return negativeExpression; |
327 | } |
328 | |
329 | /** |
330 | * <!-- begin-user-doc --> |
331 | * <!-- end-user-doc --> |
332 | * @generated |
333 | */ |
334 | public FunctionLiteral createFunctionLiteral() { |
335 | FunctionLiteralImpl functionLiteral = new FunctionLiteralImpl(); |
336 | return functionLiteral; |
337 | } |
338 | |
339 | /** |
340 | * <!-- begin-user-doc --> |
341 | * <!-- end-user-doc --> |
342 | * @generated |
343 | */ |
344 | public IfElseExpression createIfElseExpression() { |
345 | IfElseExpressionImpl ifElseExpression = new IfElseExpressionImpl(); |
346 | return ifElseExpression; |
347 | } |
348 | |
349 | /** |
350 | * <!-- begin-user-doc --> |
351 | * <!-- end-user-doc --> |
352 | * @generated |
353 | */ |
354 | public TermOperations createTermOperationsFromString(EDataType eDataType, String initialValue) { |
355 | TermOperations result = TermOperations.get(initialValue); |
356 | if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); |
357 | return result; |
358 | } |
359 | |
360 | /** |
361 | * <!-- begin-user-doc --> |
362 | * <!-- end-user-doc --> |
363 | * @generated |
364 | */ |
365 | public String convertTermOperationsToString(EDataType eDataType, Object instanceValue) { |
366 | return instanceValue == null ? null : instanceValue.toString(); |
367 | } |
368 | |
369 | /** |
370 | * <!-- begin-user-doc --> |
371 | * <!-- end-user-doc --> |
372 | * @generated |
373 | */ |
374 | public ProductOperations createProductOperationsFromString(EDataType eDataType, String initialValue) { |
375 | ProductOperations result = ProductOperations.get(initialValue); |
376 | if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); |
377 | return result; |
378 | } |
379 | |
380 | /** |
381 | * <!-- begin-user-doc --> |
382 | * <!-- end-user-doc --> |
383 | * @generated |
384 | */ |
385 | public String convertProductOperationsToString(EDataType eDataType, Object instanceValue) { |
386 | return instanceValue == null ? null : instanceValue.toString(); |
387 | } |
388 | |
389 | /** |
390 | * <!-- begin-user-doc --> |
391 | * <!-- end-user-doc --> |
392 | * @generated |
393 | */ |
394 | public CompareOperations createCompareOperationsFromString(EDataType eDataType, String initialValue) { |
395 | CompareOperations result = CompareOperations.get(initialValue); |
396 | if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); |
397 | return result; |
398 | } |
399 | |
400 | /** |
401 | * <!-- begin-user-doc --> |
402 | * <!-- end-user-doc --> |
403 | * @generated |
404 | */ |
405 | public String convertCompareOperationsToString(EDataType eDataType, Object instanceValue) { |
406 | return instanceValue == null ? null : instanceValue.toString(); |
407 | } |
408 | |
409 | /** |
410 | * <!-- begin-user-doc --> |
411 | * <!-- end-user-doc --> |
412 | * @generated |
413 | */ |
414 | public BooleanOperations createBooleanOperationsFromString(EDataType eDataType, String initialValue) { |
415 | BooleanOperations result = BooleanOperations.get(initialValue); |
416 | if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); |
417 | return result; |
418 | } |
419 | |
420 | /** |
421 | * <!-- begin-user-doc --> |
422 | * <!-- end-user-doc --> |
423 | * @generated |
424 | */ |
425 | public String convertBooleanOperationsToString(EDataType eDataType, Object instanceValue) { |
426 | return instanceValue == null ? null : instanceValue.toString(); |
427 | } |
428 | |
429 | /** |
430 | * <!-- begin-user-doc --> |
431 | * <!-- end-user-doc --> |
432 | * @generated |
433 | */ |
434 | public StoexPackage getStoexPackage() { |
435 | return (StoexPackage)getEPackage(); |
436 | } |
437 | |
438 | /** |
439 | * <!-- begin-user-doc --> |
440 | * <!-- end-user-doc --> |
441 | * @deprecated |
442 | * @generated |
443 | */ |
444 | @Deprecated |
445 | public static StoexPackage getPackage() { |
446 | return StoexPackage.eINSTANCE; |
447 | } |
448 | |
449 | } //StoexFactoryImpl |