| /** |
| * Copyright (c) 2011-2015 EclipseSource Muenchen GmbH and others. |
| * |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License 2.0 |
| * which accompanies this distribution, and is available at |
| * https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * Johannes Faltermeier - initial API and implementation |
| */ |
| package org.eclipse.emf.ecp.common.test.model.impl; |
| |
| import org.eclipse.emf.ecore.EAttribute; |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.EPackage; |
| import org.eclipse.emf.ecore.EReference; |
| import org.eclipse.emf.ecore.impl.EPackageImpl; |
| import org.eclipse.emf.ecp.common.test.model.Base; |
| import org.eclipse.emf.ecp.common.test.model.Test1; |
| import org.eclipse.emf.ecp.common.test.model.Test2; |
| import org.eclipse.emf.ecp.common.test.model.Test3; |
| import org.eclipse.emf.ecp.common.test.model.Test4; |
| import org.eclipse.emf.ecp.common.test.model.TestFactory; |
| import org.eclipse.emf.ecp.common.test.model.TestPackage; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model <b>Package</b>. |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public class TestPackageImpl extends EPackageImpl implements TestPackage { |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| private EClass baseEClass = null; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| private EClass test1EClass = null; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| private EClass test2EClass = null; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| private EClass test3EClass = null; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| private EClass test4EClass = 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.emf.ecp.common.test.model.TestPackage#eNS_URI |
| * @see #init() |
| * @generated |
| */ |
| private TestPackageImpl() { |
| super(eNS_URI, TestFactory.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 TestPackage#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 TestPackage init() { |
| if (isInited) { |
| return (TestPackage) EPackage.Registry.INSTANCE.getEPackage(TestPackage.eNS_URI); |
| } |
| |
| // Obtain or create and register package |
| final TestPackageImpl theTestPackage = (TestPackageImpl) (EPackage.Registry.INSTANCE |
| .get(eNS_URI) instanceof TestPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new TestPackageImpl()); |
| |
| isInited = true; |
| |
| // Create package meta-data objects |
| theTestPackage.createPackageContents(); |
| |
| // Initialize created meta-data |
| theTestPackage.initializePackageContents(); |
| |
| // Mark meta-data to indicate it can't be changed |
| theTestPackage.freeze(); |
| |
| // Update the registry and return the package |
| EPackage.Registry.INSTANCE.put(TestPackage.eNS_URI, theTestPackage); |
| return theTestPackage; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public EClass getBase() { |
| return baseEClass; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public EAttribute getBase_SingleAttribute() { |
| return (EAttribute) baseEClass.getEStructuralFeatures().get(0); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public EAttribute getBase_SingleAttributeUnsettable() { |
| return (EAttribute) baseEClass.getEStructuralFeatures().get(1); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public EAttribute getBase_MultiAttribute() { |
| return (EAttribute) baseEClass.getEStructuralFeatures().get(2); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public EAttribute getBase_MultiAttributeUnsettable() { |
| return (EAttribute) baseEClass.getEStructuralFeatures().get(3); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public EReference getBase_Child() { |
| return (EReference) baseEClass.getEStructuralFeatures().get(4); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public EReference getBase_ChildUnsettable() { |
| return (EReference) baseEClass.getEStructuralFeatures().get(5); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public EReference getBase_Children() { |
| return (EReference) baseEClass.getEStructuralFeatures().get(6); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public EReference getBase_ChildrenUnsettable() { |
| return (EReference) baseEClass.getEStructuralFeatures().get(7); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public EClass getTest1() { |
| return test1EClass; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public EAttribute getTest1_Derived() { |
| return (EAttribute) test1EClass.getEStructuralFeatures().get(0); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public EClass getTest2() { |
| return test2EClass; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public EAttribute getTest2_Derived() { |
| return (EAttribute) test2EClass.getEStructuralFeatures().get(0); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public EClass getTest3() { |
| return test3EClass; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public EAttribute getTest3_Derived() { |
| return (EAttribute) test3EClass.getEStructuralFeatures().get(0); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public EClass getTest4() { |
| return test4EClass; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public EAttribute getTest4_Derived() { |
| return (EAttribute) test4EClass.getEStructuralFeatures().get(0); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public TestFactory getTestFactory() { |
| return (TestFactory) 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 classes and their features |
| baseEClass = createEClass(BASE); |
| createEAttribute(baseEClass, BASE__SINGLE_ATTRIBUTE); |
| createEAttribute(baseEClass, BASE__SINGLE_ATTRIBUTE_UNSETTABLE); |
| createEAttribute(baseEClass, BASE__MULTI_ATTRIBUTE); |
| createEAttribute(baseEClass, BASE__MULTI_ATTRIBUTE_UNSETTABLE); |
| createEReference(baseEClass, BASE__CHILD); |
| createEReference(baseEClass, BASE__CHILD_UNSETTABLE); |
| createEReference(baseEClass, BASE__CHILDREN); |
| createEReference(baseEClass, BASE__CHILDREN_UNSETTABLE); |
| |
| test1EClass = createEClass(TEST1); |
| createEAttribute(test1EClass, TEST1__DERIVED); |
| |
| test2EClass = createEClass(TEST2); |
| createEAttribute(test2EClass, TEST2__DERIVED); |
| |
| test3EClass = createEClass(TEST3); |
| createEAttribute(test3EClass, TEST3__DERIVED); |
| |
| test4EClass = createEClass(TEST4); |
| createEAttribute(test4EClass, TEST4__DERIVED); |
| } |
| |
| /** |
| * <!-- 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); |
| |
| // Create type parameters |
| |
| // Set bounds for type parameters |
| |
| // Add supertypes to classes |
| test1EClass.getESuperTypes().add(getBase()); |
| test2EClass.getESuperTypes().add(getBase()); |
| test3EClass.getESuperTypes().add(getBase()); |
| test4EClass.getESuperTypes().add(getBase()); |
| |
| // Initialize classes and features; add operations and parameters |
| initEClass(baseEClass, Base.class, "Base", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ |
| initEAttribute(getBase_SingleAttribute(), ecorePackage.getEString(), "singleAttribute", null, 0, 1, Base.class, //$NON-NLS-1$ |
| !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); |
| initEAttribute(getBase_SingleAttributeUnsettable(), ecorePackage.getEString(), "singleAttributeUnsettable", //$NON-NLS-1$ |
| null, 0, 1, Base.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, |
| !IS_DERIVED, IS_ORDERED); |
| initEAttribute(getBase_MultiAttribute(), ecorePackage.getEString(), "multiAttribute", null, 0, -1, Base.class, //$NON-NLS-1$ |
| !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); |
| initEAttribute(getBase_MultiAttributeUnsettable(), ecorePackage.getEString(), "multiAttributeUnsettable", null, //$NON-NLS-1$ |
| 0, -1, Base.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, |
| !IS_DERIVED, IS_ORDERED); |
| initEReference(getBase_Child(), getBase(), null, "child", null, 0, 1, Base.class, !IS_TRANSIENT, //$NON-NLS-1$ |
| !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, |
| IS_ORDERED); |
| initEReference(getBase_ChildUnsettable(), getBase(), null, "childUnsettable", null, 0, 1, Base.class, //$NON-NLS-1$ |
| !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, IS_UNSETTABLE, IS_UNIQUE, |
| !IS_DERIVED, IS_ORDERED); |
| initEReference(getBase_Children(), getBase(), null, "children", null, 0, -1, Base.class, !IS_TRANSIENT, //$NON-NLS-1$ |
| !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, |
| IS_ORDERED); |
| initEReference(getBase_ChildrenUnsettable(), getBase(), null, "childrenUnsettable", null, 0, 1, Base.class, //$NON-NLS-1$ |
| !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, IS_UNSETTABLE, IS_UNIQUE, |
| !IS_DERIVED, IS_ORDERED); |
| |
| initEClass(test1EClass, Test1.class, "Test1", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ |
| initEAttribute(getTest1_Derived(), ecorePackage.getEString(), "derived", null, 0, 1, Test1.class, IS_TRANSIENT, //$NON-NLS-1$ |
| IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED); |
| |
| initEClass(test2EClass, Test2.class, "Test2", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ |
| initEAttribute(getTest2_Derived(), ecorePackage.getEString(), "derived", null, 0, 1, Test2.class, IS_TRANSIENT, //$NON-NLS-1$ |
| IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED); |
| |
| initEClass(test3EClass, Test3.class, "Test3", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ |
| initEAttribute(getTest3_Derived(), ecorePackage.getEString(), "derived", null, 0, 1, Test3.class, IS_TRANSIENT, //$NON-NLS-1$ |
| IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED); |
| |
| initEClass(test4EClass, Test4.class, "Test4", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ |
| initEAttribute(getTest4_Derived(), ecorePackage.getEString(), "derived", null, 0, 1, Test4.class, IS_TRANSIENT, //$NON-NLS-1$ |
| IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, IS_DERIVED, IS_ORDERED); |
| |
| // Create resource |
| createResource(eNS_URI); |
| } |
| |
| } // TestPackageImpl |