| /* |
| * Copyright (c) 2011 CEA and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * Kenn Hussey (CEA) - initial API and implementation |
| * |
| */ |
| package org.eclipse.uml2.types.internal.impl; |
| |
| import org.eclipse.emf.ecore.EDataType; |
| import org.eclipse.emf.ecore.EPackage; |
| import org.eclipse.emf.ecore.impl.EPackageImpl; |
| import org.eclipse.uml2.types.TypesFactory; |
| import org.eclipse.uml2.types.TypesPackage; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model <b>Package</b>. |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public class TypesPackageImpl |
| extends EPackageImpl |
| implements TypesPackage { |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| private EDataType booleanEDataType = null; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| private EDataType integerEDataType = null; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| private EDataType realEDataType = null; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| private EDataType stringEDataType = null; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| private EDataType unlimitedNaturalEDataType = null; |
| |
| /** |
| * Creates an instance of the model <b>Package</b>, registered with |
| * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package |
| * package URI value. |
| * <p>Note: the correct way to create the package is via the static |
| * factory method {@link #init init()}, which also performs |
| * initialization of the package, or returns the registered package, |
| * if one already exists. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see org.eclipse.emf.ecore.EPackage.Registry |
| * @see org.eclipse.uml2.types.TypesPackage#eNS_URI |
| * @see #init() |
| * @generated |
| */ |
| private TypesPackageImpl() { |
| super(eNS_URI, TypesFactory.eINSTANCE); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| private static boolean isInited = false; |
| |
| /** |
| * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. |
| * |
| * <p>This method is used to initialize {@link TypesPackage#eINSTANCE} when that field is accessed. |
| * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #eNS_URI |
| * @see #createPackageContents() |
| * @see #initializePackageContents() |
| * @generated |
| */ |
| public static TypesPackage init() { |
| if (isInited) |
| return (TypesPackage) EPackage.Registry.INSTANCE |
| .getEPackage(TypesPackage.eNS_URI); |
| |
| // Obtain or create and register package |
| TypesPackageImpl theTypesPackage = (TypesPackageImpl) (EPackage.Registry.INSTANCE |
| .get(eNS_URI) instanceof TypesPackageImpl |
| ? EPackage.Registry.INSTANCE.get(eNS_URI) |
| : new TypesPackageImpl()); |
| |
| isInited = true; |
| |
| // Create package meta-data objects |
| theTypesPackage.createPackageContents(); |
| |
| // Initialize created meta-data |
| theTypesPackage.initializePackageContents(); |
| |
| // Mark meta-data to indicate it can't be changed |
| theTypesPackage.freeze(); |
| |
| // Update the registry and return the package |
| EPackage.Registry.INSTANCE.put(TypesPackage.eNS_URI, theTypesPackage); |
| return theTypesPackage; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EDataType getBoolean() { |
| return booleanEDataType; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EDataType getInteger() { |
| return integerEDataType; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EDataType getReal() { |
| return realEDataType; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EDataType getString() { |
| return stringEDataType; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EDataType getUnlimitedNatural() { |
| return unlimitedNaturalEDataType; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public TypesFactory getTypesFactory() { |
| return (TypesFactory) getEFactoryInstance(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| private boolean isCreated = false; |
| |
| /** |
| * Creates the meta-model objects for the package. This method is |
| * guarded to have no affect on any invocation but its first. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void createPackageContents() { |
| if (isCreated) |
| return; |
| isCreated = true; |
| |
| // Create data types |
| booleanEDataType = createEDataType(BOOLEAN); |
| integerEDataType = createEDataType(INTEGER); |
| realEDataType = createEDataType(REAL); |
| stringEDataType = createEDataType(STRING); |
| unlimitedNaturalEDataType = createEDataType(UNLIMITED_NATURAL); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| private boolean isInitialized = false; |
| |
| /** |
| * Complete the initialization of the package and its meta-model. This |
| * method is guarded to have no affect on any invocation but its first. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void initializePackageContents() { |
| if (isInitialized) |
| return; |
| isInitialized = true; |
| |
| // Initialize package |
| setName(eNAME); |
| setNsPrefix(eNS_PREFIX); |
| setNsURI(eNS_URI); |
| |
| // Initialize data types |
| initEDataType(booleanEDataType, boolean.class, |
| "Boolean", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ |
| initEDataType(integerEDataType, int.class, |
| "Integer", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ |
| initEDataType(realEDataType, double.class, |
| "Real", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ |
| initEDataType(stringEDataType, String.class, |
| "String", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ |
| initEDataType(unlimitedNaturalEDataType, int.class, |
| "UnlimitedNatural", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ |
| |
| // Create resource |
| createResource(eNS_URI); |
| } |
| |
| } //TypesPackageImpl |