1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.dsexplore.qml.contracttype.QMLContractType.impl; |
8 | |
9 | import de.uka.ipd.sdq.dsexplore.qml.contracttype.QMLContractType.*; |
10 | |
11 | import org.eclipse.emf.ecore.EClass; |
12 | import org.eclipse.emf.ecore.EDataType; |
13 | import org.eclipse.emf.ecore.EObject; |
14 | import org.eclipse.emf.ecore.EPackage; |
15 | |
16 | import org.eclipse.emf.ecore.impl.EFactoryImpl; |
17 | |
18 | import org.eclipse.emf.ecore.plugin.EcorePlugin; |
19 | |
20 | /** |
21 | * <!-- begin-user-doc --> |
22 | * An implementation of the model <b>Factory</b>. |
23 | * <!-- end-user-doc --> |
24 | * @generated |
25 | */ |
26 | public class QMLContractTypeFactoryImpl extends EFactoryImpl implements QMLContractTypeFactory { |
27 | /** |
28 | * Creates the default factory implementation. |
29 | * <!-- begin-user-doc --> |
30 | * <!-- end-user-doc --> |
31 | * @generated |
32 | */ |
33 | public static QMLContractTypeFactory init() { |
34 | try { |
35 | QMLContractTypeFactory theQMLContractTypeFactory = (QMLContractTypeFactory)EPackage.Registry.INSTANCE.getEFactory("http:///QMLContractType.ecore"); |
36 | if (theQMLContractTypeFactory != null) { |
37 | return theQMLContractTypeFactory; |
38 | } |
39 | } |
40 | catch (Exception exception) { |
41 | EcorePlugin.INSTANCE.log(exception); |
42 | } |
43 | return new QMLContractTypeFactoryImpl(); |
44 | } |
45 | |
46 | /** |
47 | * Creates an instance of the factory. |
48 | * <!-- begin-user-doc --> |
49 | * <!-- end-user-doc --> |
50 | * @generated |
51 | */ |
52 | public QMLContractTypeFactoryImpl() { |
53 | super(); |
54 | } |
55 | |
56 | /** |
57 | * <!-- begin-user-doc --> |
58 | * <!-- end-user-doc --> |
59 | * @generated |
60 | */ |
61 | @Override |
62 | public EObject create(EClass eClass) { |
63 | switch (eClass.getClassifierID()) { |
64 | case QMLContractTypePackage.DIMENSION_TYPE_SET: return createDimensionTypeSet(); |
65 | case QMLContractTypePackage.RELATION_SEMANTICS: return createRelationSemantics(); |
66 | case QMLContractTypePackage.ELEMENT: return createElement(); |
67 | case QMLContractTypePackage.ORDER: return createOrder(); |
68 | case QMLContractTypePackage.DIMENSION_TYPE_ENUM: return createDimensionTypeEnum(); |
69 | case QMLContractTypePackage.UNIT: return createUnit(); |
70 | case QMLContractTypePackage.DIMENSION_TYPE_NUMERIC: return createDimensionTypeNumeric(); |
71 | case QMLContractTypePackage.NUMERIC_RANGE: return createNumericRange(); |
72 | case QMLContractTypePackage.QML_CONTRACT_TYPE: return createQMLContractType(); |
73 | case QMLContractTypePackage.UNIT_REPOSITORY: return createUnitRepository(); |
74 | case QMLContractTypePackage.DIMENSION_TYPE_REPOSITORY: return createDimensionTypeRepository(); |
75 | case QMLContractTypePackage.DIMENSION: return createDimension(); |
76 | default: |
77 | throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); |
78 | } |
79 | } |
80 | |
81 | /** |
82 | * <!-- begin-user-doc --> |
83 | * <!-- end-user-doc --> |
84 | * @generated |
85 | */ |
86 | @Override |
87 | public Object createFromString(EDataType eDataType, String initialValue) { |
88 | switch (eDataType.getClassifierID()) { |
89 | case QMLContractTypePackage.ENUM_RELATION_SEMANTICS: |
90 | return createEnumRelationSemanticsFromString(eDataType, initialValue); |
91 | case QMLContractTypePackage.ENUM_NUMERIC_DOMAIN: |
92 | return createEnumNumericDomainFromString(eDataType, initialValue); |
93 | default: |
94 | throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); |
95 | } |
96 | } |
97 | |
98 | /** |
99 | * <!-- begin-user-doc --> |
100 | * <!-- end-user-doc --> |
101 | * @generated |
102 | */ |
103 | @Override |
104 | public String convertToString(EDataType eDataType, Object instanceValue) { |
105 | switch (eDataType.getClassifierID()) { |
106 | case QMLContractTypePackage.ENUM_RELATION_SEMANTICS: |
107 | return convertEnumRelationSemanticsToString(eDataType, instanceValue); |
108 | case QMLContractTypePackage.ENUM_NUMERIC_DOMAIN: |
109 | return convertEnumNumericDomainToString(eDataType, instanceValue); |
110 | default: |
111 | throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); |
112 | } |
113 | } |
114 | |
115 | /** |
116 | * <!-- begin-user-doc --> |
117 | * <!-- end-user-doc --> |
118 | * @generated |
119 | */ |
120 | public DimensionTypeSet createDimensionTypeSet() { |
121 | DimensionTypeSetImpl dimensionTypeSet = new DimensionTypeSetImpl(); |
122 | return dimensionTypeSet; |
123 | } |
124 | |
125 | /** |
126 | * <!-- begin-user-doc --> |
127 | * <!-- end-user-doc --> |
128 | * @generated |
129 | */ |
130 | public RelationSemantics createRelationSemantics() { |
131 | RelationSemanticsImpl relationSemantics = new RelationSemanticsImpl(); |
132 | return relationSemantics; |
133 | } |
134 | |
135 | /** |
136 | * <!-- begin-user-doc --> |
137 | * <!-- end-user-doc --> |
138 | * @generated |
139 | */ |
140 | public Element createElement() { |
141 | ElementImpl element = new ElementImpl(); |
142 | return element; |
143 | } |
144 | |
145 | /** |
146 | * <!-- begin-user-doc --> |
147 | * <!-- end-user-doc --> |
148 | * @generated |
149 | */ |
150 | public Order createOrder() { |
151 | OrderImpl order = new OrderImpl(); |
152 | return order; |
153 | } |
154 | |
155 | /** |
156 | * <!-- begin-user-doc --> |
157 | * <!-- end-user-doc --> |
158 | * @generated |
159 | */ |
160 | public DimensionTypeEnum createDimensionTypeEnum() { |
161 | DimensionTypeEnumImpl dimensionTypeEnum = new DimensionTypeEnumImpl(); |
162 | return dimensionTypeEnum; |
163 | } |
164 | |
165 | /** |
166 | * <!-- begin-user-doc --> |
167 | * <!-- end-user-doc --> |
168 | * @generated |
169 | */ |
170 | public Unit createUnit() { |
171 | UnitImpl unit = new UnitImpl(); |
172 | return unit; |
173 | } |
174 | |
175 | /** |
176 | * <!-- begin-user-doc --> |
177 | * <!-- end-user-doc --> |
178 | * @generated |
179 | */ |
180 | public DimensionTypeNumeric createDimensionTypeNumeric() { |
181 | DimensionTypeNumericImpl dimensionTypeNumeric = new DimensionTypeNumericImpl(); |
182 | return dimensionTypeNumeric; |
183 | } |
184 | |
185 | /** |
186 | * <!-- begin-user-doc --> |
187 | * <!-- end-user-doc --> |
188 | * @generated |
189 | */ |
190 | public NumericRange createNumericRange() { |
191 | NumericRangeImpl numericRange = new NumericRangeImpl(); |
192 | return numericRange; |
193 | } |
194 | |
195 | /** |
196 | * <!-- begin-user-doc --> |
197 | * <!-- end-user-doc --> |
198 | * @generated |
199 | */ |
200 | public QMLContractType createQMLContractType() { |
201 | QMLContractTypeImpl qmlContractType = new QMLContractTypeImpl(); |
202 | return qmlContractType; |
203 | } |
204 | |
205 | /** |
206 | * <!-- begin-user-doc --> |
207 | * <!-- end-user-doc --> |
208 | * @generated |
209 | */ |
210 | public UnitRepository createUnitRepository() { |
211 | UnitRepositoryImpl unitRepository = new UnitRepositoryImpl(); |
212 | return unitRepository; |
213 | } |
214 | |
215 | /** |
216 | * <!-- begin-user-doc --> |
217 | * <!-- end-user-doc --> |
218 | * @generated |
219 | */ |
220 | public DimensionTypeRepository createDimensionTypeRepository() { |
221 | DimensionTypeRepositoryImpl dimensionTypeRepository = new DimensionTypeRepositoryImpl(); |
222 | return dimensionTypeRepository; |
223 | } |
224 | |
225 | /** |
226 | * <!-- begin-user-doc --> |
227 | * <!-- end-user-doc --> |
228 | * @generated |
229 | */ |
230 | public Dimension createDimension() { |
231 | DimensionImpl dimension = new DimensionImpl(); |
232 | return dimension; |
233 | } |
234 | |
235 | /** |
236 | * <!-- begin-user-doc --> |
237 | * <!-- end-user-doc --> |
238 | * @generated |
239 | */ |
240 | public EnumRelationSemantics createEnumRelationSemanticsFromString(EDataType eDataType, String initialValue) { |
241 | EnumRelationSemantics result = EnumRelationSemantics.get(initialValue); |
242 | if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); |
243 | return result; |
244 | } |
245 | |
246 | /** |
247 | * <!-- begin-user-doc --> |
248 | * <!-- end-user-doc --> |
249 | * @generated |
250 | */ |
251 | public String convertEnumRelationSemanticsToString(EDataType eDataType, Object instanceValue) { |
252 | return instanceValue == null ? null : instanceValue.toString(); |
253 | } |
254 | |
255 | /** |
256 | * <!-- begin-user-doc --> |
257 | * <!-- end-user-doc --> |
258 | * @generated |
259 | */ |
260 | public EnumNumericDomain createEnumNumericDomainFromString(EDataType eDataType, String initialValue) { |
261 | EnumNumericDomain result = EnumNumericDomain.get(initialValue); |
262 | if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); |
263 | return result; |
264 | } |
265 | |
266 | /** |
267 | * <!-- begin-user-doc --> |
268 | * <!-- end-user-doc --> |
269 | * @generated |
270 | */ |
271 | public String convertEnumNumericDomainToString(EDataType eDataType, Object instanceValue) { |
272 | return instanceValue == null ? null : instanceValue.toString(); |
273 | } |
274 | |
275 | /** |
276 | * <!-- begin-user-doc --> |
277 | * <!-- end-user-doc --> |
278 | * @generated |
279 | */ |
280 | public QMLContractTypePackage getQMLContractTypePackage() { |
281 | return (QMLContractTypePackage)getEPackage(); |
282 | } |
283 | |
284 | /** |
285 | * <!-- begin-user-doc --> |
286 | * <!-- end-user-doc --> |
287 | * @deprecated |
288 | * @generated |
289 | */ |
290 | @Deprecated |
291 | public static QMLContractTypePackage getPackage() { |
292 | return QMLContractTypePackage.eINSTANCE; |
293 | } |
294 | |
295 | } //QMLContractTypeFactoryImpl |