1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.units.impl; |
8 | |
9 | import de.uka.ipd.sdq.units.BaseUnit; |
10 | import de.uka.ipd.sdq.units.Unit; |
11 | import de.uka.ipd.sdq.units.UnitCarryingElement; |
12 | import de.uka.ipd.sdq.units.UnitLiteral; |
13 | import de.uka.ipd.sdq.units.UnitMultiplication; |
14 | import de.uka.ipd.sdq.units.UnitPower; |
15 | import de.uka.ipd.sdq.units.UnitRepository; |
16 | import de.uka.ipd.sdq.units.UnitsFactory; |
17 | import de.uka.ipd.sdq.units.UnitsPackage; |
18 | |
19 | import org.eclipse.emf.ecore.EAttribute; |
20 | import org.eclipse.emf.ecore.EClass; |
21 | import org.eclipse.emf.ecore.EPackage; |
22 | import org.eclipse.emf.ecore.EReference; |
23 | |
24 | import org.eclipse.emf.ecore.impl.EPackageImpl; |
25 | |
26 | /** |
27 | * <!-- begin-user-doc --> |
28 | * An implementation of the model <b>Package</b>. |
29 | * <!-- end-user-doc --> |
30 | * @generated |
31 | */ |
32 | public class UnitsPackageImpl extends EPackageImpl implements UnitsPackage { |
33 | /** |
34 | * <!-- begin-user-doc --> |
35 | * <!-- end-user-doc --> |
36 | * @generated |
37 | */ |
38 | public static final String copyright = "Copyright 2007-2009, SDQ, IPD, U Karlsruhe"; |
39 | |
40 | /** |
41 | * <!-- begin-user-doc --> |
42 | * <!-- end-user-doc --> |
43 | * @generated |
44 | */ |
45 | private EClass unitCarryingElementEClass = null; |
46 | |
47 | /** |
48 | * <!-- begin-user-doc --> |
49 | * <!-- end-user-doc --> |
50 | * @generated |
51 | */ |
52 | private EClass unitEClass = null; |
53 | |
54 | /** |
55 | * <!-- begin-user-doc --> |
56 | * <!-- end-user-doc --> |
57 | * @generated |
58 | */ |
59 | private EClass baseUnitEClass = null; |
60 | |
61 | /** |
62 | * <!-- begin-user-doc --> |
63 | * <!-- end-user-doc --> |
64 | * @generated |
65 | */ |
66 | private EClass unitRepositoryEClass = null; |
67 | |
68 | /** |
69 | * <!-- begin-user-doc --> |
70 | * <!-- end-user-doc --> |
71 | * @generated |
72 | */ |
73 | private EClass unitMultiplicationEClass = null; |
74 | |
75 | /** |
76 | * <!-- begin-user-doc --> |
77 | * <!-- end-user-doc --> |
78 | * @generated |
79 | */ |
80 | private EClass unitPowerEClass = null; |
81 | |
82 | /** |
83 | * <!-- begin-user-doc --> |
84 | * <!-- end-user-doc --> |
85 | * @generated |
86 | */ |
87 | private EClass unitLiteralEClass = null; |
88 | |
89 | /** |
90 | * Creates an instance of the model <b>Package</b>, registered with |
91 | * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package |
92 | * package URI value. |
93 | * <p>Note: the correct way to create the package is via the static |
94 | * factory method {@link #init init()}, which also performs |
95 | * initialization of the package, or returns the registered package, |
96 | * if one already exists. |
97 | * <!-- begin-user-doc --> |
98 | * <!-- end-user-doc --> |
99 | * @see org.eclipse.emf.ecore.EPackage.Registry |
100 | * @see de.uka.ipd.sdq.units.UnitsPackage#eNS_URI |
101 | * @see #init() |
102 | * @generated |
103 | */ |
104 | private UnitsPackageImpl() { |
105 | super(eNS_URI, UnitsFactory.eINSTANCE); |
106 | } |
107 | |
108 | /** |
109 | * <!-- begin-user-doc --> |
110 | * <!-- end-user-doc --> |
111 | * @generated |
112 | */ |
113 | private static boolean isInited = false; |
114 | |
115 | /** |
116 | * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. |
117 | * |
118 | * <p>This method is used to initialize {@link UnitsPackage#eINSTANCE} when that field is accessed. |
119 | * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. |
120 | * <!-- begin-user-doc --> |
121 | * <!-- end-user-doc --> |
122 | * @see #eNS_URI |
123 | * @see #createPackageContents() |
124 | * @see #initializePackageContents() |
125 | * @generated |
126 | */ |
127 | public static UnitsPackage init() { |
128 | if (isInited) return (UnitsPackage)EPackage.Registry.INSTANCE.getEPackage(UnitsPackage.eNS_URI); |
129 | |
130 | // Obtain or create and register package |
131 | UnitsPackageImpl theUnitsPackage = (UnitsPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof UnitsPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new UnitsPackageImpl()); |
132 | |
133 | isInited = true; |
134 | |
135 | // Create package meta-data objects |
136 | theUnitsPackage.createPackageContents(); |
137 | |
138 | // Initialize created meta-data |
139 | theUnitsPackage.initializePackageContents(); |
140 | |
141 | // Mark meta-data to indicate it can't be changed |
142 | theUnitsPackage.freeze(); |
143 | |
144 | |
145 | // Update the registry and return the package |
146 | EPackage.Registry.INSTANCE.put(UnitsPackage.eNS_URI, theUnitsPackage); |
147 | return theUnitsPackage; |
148 | } |
149 | |
150 | /** |
151 | * <!-- begin-user-doc --> |
152 | * <!-- end-user-doc --> |
153 | * @generated |
154 | */ |
155 | public EClass getUnitCarryingElement() { |
156 | return unitCarryingElementEClass; |
157 | } |
158 | |
159 | /** |
160 | * <!-- begin-user-doc --> |
161 | * <!-- end-user-doc --> |
162 | * @generated |
163 | */ |
164 | public EReference getUnitCarryingElement_Unit() { |
165 | return (EReference)unitCarryingElementEClass.getEStructuralFeatures().get(0); |
166 | } |
167 | |
168 | /** |
169 | * <!-- begin-user-doc --> |
170 | * <!-- end-user-doc --> |
171 | * @generated |
172 | */ |
173 | public EAttribute getUnitCarryingElement_UnitSpecification() { |
174 | return (EAttribute)unitCarryingElementEClass.getEStructuralFeatures().get(1); |
175 | } |
176 | |
177 | /** |
178 | * <!-- begin-user-doc --> |
179 | * <!-- end-user-doc --> |
180 | * @generated |
181 | */ |
182 | public EClass getUnit() { |
183 | return unitEClass; |
184 | } |
185 | |
186 | /** |
187 | * <!-- begin-user-doc --> |
188 | * <!-- end-user-doc --> |
189 | * @generated |
190 | */ |
191 | public EClass getBaseUnit() { |
192 | return baseUnitEClass; |
193 | } |
194 | |
195 | /** |
196 | * <!-- begin-user-doc --> |
197 | * <!-- end-user-doc --> |
198 | * @generated |
199 | */ |
200 | public EAttribute getBaseUnit_Name() { |
201 | return (EAttribute)baseUnitEClass.getEStructuralFeatures().get(0); |
202 | } |
203 | |
204 | /** |
205 | * <!-- begin-user-doc --> |
206 | * <!-- end-user-doc --> |
207 | * @generated |
208 | */ |
209 | public EClass getUnitRepository() { |
210 | return unitRepositoryEClass; |
211 | } |
212 | |
213 | /** |
214 | * <!-- begin-user-doc --> |
215 | * <!-- end-user-doc --> |
216 | * @generated |
217 | */ |
218 | public EReference getUnitRepository_Units() { |
219 | return (EReference)unitRepositoryEClass.getEStructuralFeatures().get(0); |
220 | } |
221 | |
222 | /** |
223 | * <!-- begin-user-doc --> |
224 | * <!-- end-user-doc --> |
225 | * @generated |
226 | */ |
227 | public EClass getUnitMultiplication() { |
228 | return unitMultiplicationEClass; |
229 | } |
230 | |
231 | /** |
232 | * <!-- begin-user-doc --> |
233 | * <!-- end-user-doc --> |
234 | * @generated |
235 | */ |
236 | public EReference getUnitMultiplication_Units() { |
237 | return (EReference)unitMultiplicationEClass.getEStructuralFeatures().get(0); |
238 | } |
239 | |
240 | /** |
241 | * <!-- begin-user-doc --> |
242 | * <!-- end-user-doc --> |
243 | * @generated |
244 | */ |
245 | public EClass getUnitPower() { |
246 | return unitPowerEClass; |
247 | } |
248 | |
249 | /** |
250 | * <!-- begin-user-doc --> |
251 | * <!-- end-user-doc --> |
252 | * @generated |
253 | */ |
254 | public EReference getUnitPower_Unit() { |
255 | return (EReference)unitPowerEClass.getEStructuralFeatures().get(0); |
256 | } |
257 | |
258 | /** |
259 | * <!-- begin-user-doc --> |
260 | * <!-- end-user-doc --> |
261 | * @generated |
262 | */ |
263 | public EAttribute getUnitPower_Exponent() { |
264 | return (EAttribute)unitPowerEClass.getEStructuralFeatures().get(1); |
265 | } |
266 | |
267 | /** |
268 | * <!-- begin-user-doc --> |
269 | * <!-- end-user-doc --> |
270 | * @generated |
271 | */ |
272 | public EClass getUnitLiteral() { |
273 | return unitLiteralEClass; |
274 | } |
275 | |
276 | /** |
277 | * <!-- begin-user-doc --> |
278 | * <!-- end-user-doc --> |
279 | * @generated |
280 | */ |
281 | public EReference getUnitLiteral_BaseUnit() { |
282 | return (EReference)unitLiteralEClass.getEStructuralFeatures().get(0); |
283 | } |
284 | |
285 | /** |
286 | * <!-- begin-user-doc --> |
287 | * <!-- end-user-doc --> |
288 | * @generated |
289 | */ |
290 | public UnitsFactory getUnitsFactory() { |
291 | return (UnitsFactory)getEFactoryInstance(); |
292 | } |
293 | |
294 | /** |
295 | * <!-- begin-user-doc --> |
296 | * <!-- end-user-doc --> |
297 | * @generated |
298 | */ |
299 | private boolean isCreated = false; |
300 | |
301 | /** |
302 | * Creates the meta-model objects for the package. This method is |
303 | * guarded to have no affect on any invocation but its first. |
304 | * <!-- begin-user-doc --> |
305 | * <!-- end-user-doc --> |
306 | * @generated |
307 | */ |
308 | public void createPackageContents() { |
309 | if (isCreated) return; |
310 | isCreated = true; |
311 | |
312 | // Create classes and their features |
313 | unitCarryingElementEClass = createEClass(UNIT_CARRYING_ELEMENT); |
314 | createEReference(unitCarryingElementEClass, UNIT_CARRYING_ELEMENT__UNIT); |
315 | createEAttribute(unitCarryingElementEClass, UNIT_CARRYING_ELEMENT__UNIT_SPECIFICATION); |
316 | |
317 | unitEClass = createEClass(UNIT); |
318 | |
319 | baseUnitEClass = createEClass(BASE_UNIT); |
320 | createEAttribute(baseUnitEClass, BASE_UNIT__NAME); |
321 | |
322 | unitRepositoryEClass = createEClass(UNIT_REPOSITORY); |
323 | createEReference(unitRepositoryEClass, UNIT_REPOSITORY__UNITS); |
324 | |
325 | unitMultiplicationEClass = createEClass(UNIT_MULTIPLICATION); |
326 | createEReference(unitMultiplicationEClass, UNIT_MULTIPLICATION__UNITS); |
327 | |
328 | unitPowerEClass = createEClass(UNIT_POWER); |
329 | createEReference(unitPowerEClass, UNIT_POWER__UNIT); |
330 | createEAttribute(unitPowerEClass, UNIT_POWER__EXPONENT); |
331 | |
332 | unitLiteralEClass = createEClass(UNIT_LITERAL); |
333 | createEReference(unitLiteralEClass, UNIT_LITERAL__BASE_UNIT); |
334 | } |
335 | |
336 | /** |
337 | * <!-- begin-user-doc --> |
338 | * <!-- end-user-doc --> |
339 | * @generated |
340 | */ |
341 | private boolean isInitialized = false; |
342 | |
343 | /** |
344 | * Complete the initialization of the package and its meta-model. This |
345 | * method is guarded to have no affect on any invocation but its first. |
346 | * <!-- begin-user-doc --> |
347 | * <!-- end-user-doc --> |
348 | * @generated |
349 | */ |
350 | public void initializePackageContents() { |
351 | if (isInitialized) return; |
352 | isInitialized = true; |
353 | |
354 | // Initialize package |
355 | setName(eNAME); |
356 | setNsPrefix(eNS_PREFIX); |
357 | setNsURI(eNS_URI); |
358 | |
359 | // Create type parameters |
360 | |
361 | // Set bounds for type parameters |
362 | |
363 | // Add supertypes to classes |
364 | unitMultiplicationEClass.getESuperTypes().add(this.getUnit()); |
365 | unitPowerEClass.getESuperTypes().add(this.getUnit()); |
366 | unitLiteralEClass.getESuperTypes().add(this.getUnit()); |
367 | |
368 | // Initialize classes and features; add operations and parameters |
369 | initEClass(unitCarryingElementEClass, UnitCarryingElement.class, "UnitCarryingElement", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); |
370 | initEReference(getUnitCarryingElement_Unit(), this.getUnit(), null, "unit", null, 0, 1, UnitCarryingElement.class, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); |
371 | initEAttribute(getUnitCarryingElement_UnitSpecification(), ecorePackage.getEString(), "unitSpecification", null, 1, 1, UnitCarryingElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); |
372 | |
373 | initEClass(unitEClass, Unit.class, "Unit", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); |
374 | |
375 | initEClass(baseUnitEClass, BaseUnit.class, "BaseUnit", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); |
376 | initEAttribute(getBaseUnit_Name(), ecorePackage.getEString(), "name", null, 1, 1, BaseUnit.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); |
377 | |
378 | initEClass(unitRepositoryEClass, UnitRepository.class, "UnitRepository", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); |
379 | initEReference(getUnitRepository_Units(), this.getBaseUnit(), null, "units", null, 0, -1, UnitRepository.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); |
380 | |
381 | initEClass(unitMultiplicationEClass, UnitMultiplication.class, "UnitMultiplication", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); |
382 | initEReference(getUnitMultiplication_Units(), this.getUnit(), null, "units", null, 1, -1, UnitMultiplication.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); |
383 | |
384 | initEClass(unitPowerEClass, UnitPower.class, "UnitPower", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); |
385 | initEReference(getUnitPower_Unit(), this.getUnit(), null, "unit", null, 1, 1, UnitPower.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); |
386 | initEAttribute(getUnitPower_Exponent(), ecorePackage.getEInt(), "exponent", null, 1, 1, UnitPower.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); |
387 | |
388 | initEClass(unitLiteralEClass, UnitLiteral.class, "UnitLiteral", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); |
389 | initEReference(getUnitLiteral_BaseUnit(), this.getBaseUnit(), null, "baseUnit", null, 1, 1, UnitLiteral.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED); |
390 | |
391 | // Create resource |
392 | createResource(eNS_URI); |
393 | |
394 | // Create annotations |
395 | // http:///org/eclipse/emf/ecore/util/ExtendedMetaData |
396 | createExtendedMetaDataAnnotations(); |
397 | } |
398 | |
399 | /** |
400 | * Initializes the annotations for <b>http:///org/eclipse/emf/ecore/util/ExtendedMetaData</b>. |
401 | * <!-- begin-user-doc --> |
402 | * <!-- end-user-doc --> |
403 | * @generated |
404 | */ |
405 | protected void createExtendedMetaDataAnnotations() { |
406 | String source = "http:///org/eclipse/emf/ecore/util/ExtendedMetaData"; |
407 | addAnnotation |
408 | (getUnitCarryingElement_Unit(), |
409 | source, |
410 | new String[] { |
411 | "name", "", |
412 | "namespace", "" |
413 | }); |
414 | addAnnotation |
415 | (getBaseUnit_Name(), |
416 | source, |
417 | new String[] { |
418 | "name", "", |
419 | "namespace", "" |
420 | }); |
421 | } |
422 | |
423 | } //UnitsPackageImpl |