Skip to content

Package: ModelPackageImpl

ModelPackageImpl

nameinstructionbranchcomplexitylinemethod
ModelPackageImpl()
M: 0 C: 14
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 5
100%
M: 0 C: 1
100%
createPackageContents()
M: 1 C: 17
94%
M: 1 C: 1
50%
M: 1 C: 1
50%
M: 1 C: 5
83%
M: 0 C: 1
100%
getFoo()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getFoo_Bar()
M: 0 C: 7
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getModelFactory()
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
init()
M: 9 C: 27
75%
M: 2 C: 2
50%
M: 2 C: 1
33%
M: 1 C: 10
91%
M: 0 C: 1
100%
initializePackageContents()
M: 1 C: 51
98%
M: 1 C: 1
50%
M: 1 C: 1
50%
M: 1 C: 10
91%
M: 0 C: 1
100%
static {...}
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%

Coverage

1: /**
2: * Copyright (c) 2011-2016 EclipseSource Muenchen GmbH and others.
3: *
4: * All rights reserved. This program and the accompanying materials
5: * are made available under the terms of the Eclipse Public License 2.0
6: * which accompanies this distribution, and is available at
7: * https://www.eclipse.org/legal/epl-2.0/
8: *
9: * SPDX-License-Identifier: EPL-2.0
10: *
11: * Contributors:
12: */
13: package org.eclipse.emf.ecp.view.edapt.test.model.impl;
14:
15: import org.eclipse.emf.ecore.EAttribute;
16: import org.eclipse.emf.ecore.EClass;
17: import org.eclipse.emf.ecore.EPackage;
18: import org.eclipse.emf.ecore.impl.EPackageImpl;
19: import org.eclipse.emf.ecp.view.edapt.test.model.Foo;
20: import org.eclipse.emf.ecp.view.edapt.test.model.ModelFactory;
21: import org.eclipse.emf.ecp.view.edapt.test.model.ModelPackage;
22:
23: /**
24: * <!-- begin-user-doc -->
25: * An implementation of the model <b>Package</b>.
26: * <!-- end-user-doc -->
27: *
28: * @generated
29: */
30: public class ModelPackageImpl extends EPackageImpl implements ModelPackage {
31:         /**
32:          * <!-- begin-user-doc -->
33:          * <!-- end-user-doc -->
34:          *
35:          * @generated
36:          */
37:         private EClass fooEClass = null;
38:
39:         /**
40:          * Creates an instance of the model <b>Package</b>, registered with
41:          * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
42:          * package URI value.
43:          * <p>
44:          * Note: the correct way to create the package is via the static
45:          * factory method {@link #init init()}, which also performs
46:          * initialization of the package, or returns the registered package,
47:          * if one already exists.
48:          * <!-- begin-user-doc -->
49:          * <!-- end-user-doc -->
50:          *
51:          * @see org.eclipse.emf.ecore.EPackage.Registry
52:          * @see org.eclipse.emf.ecp.view.edapt.test.model.ModelPackage#eNS_URI
53:          * @see #init()
54:          * @generated
55:          */
56:         private ModelPackageImpl() {
57:                 super(eNS_URI, ModelFactory.eINSTANCE);
58:         }
59:
60:         /**
61:          * <!-- begin-user-doc -->
62:          * <!-- end-user-doc -->
63:          *
64:          * @generated
65:          */
66:         private static boolean isInited = false;
67:
68:         /**
69:          * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
70:          *
71:          * <p>
72:          * This method is used to initialize {@link ModelPackage#eINSTANCE} when that field is accessed.
73:          * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
74:          * <!-- begin-user-doc -->
75:          * <!-- end-user-doc -->
76:          *
77:          * @see #eNS_URI
78:          * @see #createPackageContents()
79:          * @see #initializePackageContents()
80:          * @generated
81:          */
82:         public static ModelPackage init() {
83:•                if (isInited) {
84:                         return (ModelPackage) EPackage.Registry.INSTANCE.getEPackage(ModelPackage.eNS_URI);
85:                 }
86:
87:                 // Obtain or create and register package
88:                 final ModelPackageImpl theModelPackage = (ModelPackageImpl) (EPackage.Registry.INSTANCE
89:•                        .get(eNS_URI) instanceof ModelPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI)
90:                                 : new ModelPackageImpl());
91:
92:                 isInited = true;
93:
94:                 // Create package meta-data objects
95:                 theModelPackage.createPackageContents();
96:
97:                 // Initialize created meta-data
98:                 theModelPackage.initializePackageContents();
99:
100:                 // Mark meta-data to indicate it can't be changed
101:                 theModelPackage.freeze();
102:
103:                 // Update the registry and return the package
104:                 EPackage.Registry.INSTANCE.put(ModelPackage.eNS_URI, theModelPackage);
105:                 return theModelPackage;
106:         }
107:
108:         /**
109:          * <!-- begin-user-doc -->
110:          * <!-- end-user-doc -->
111:          *
112:          * @generated
113:          */
114:         @Override
115:         public EClass getFoo() {
116:                 return fooEClass;
117:         }
118:
119:         /**
120:          * <!-- begin-user-doc -->
121:          * <!-- end-user-doc -->
122:          *
123:          * @generated
124:          */
125:         @Override
126:         public EAttribute getFoo_Bar() {
127:                 return (EAttribute) fooEClass.getEStructuralFeatures().get(0);
128:         }
129:
130:         /**
131:          * <!-- begin-user-doc -->
132:          * <!-- end-user-doc -->
133:          *
134:          * @generated
135:          */
136:         @Override
137:         public ModelFactory getModelFactory() {
138:                 return (ModelFactory) getEFactoryInstance();
139:         }
140:
141:         /**
142:          * <!-- begin-user-doc -->
143:          * <!-- end-user-doc -->
144:          *
145:          * @generated
146:          */
147:         private boolean isCreated = false;
148:
149:         /**
150:          * Creates the meta-model objects for the package. This method is
151:          * guarded to have no affect on any invocation but its first.
152:          * <!-- begin-user-doc -->
153:          * <!-- end-user-doc -->
154:          *
155:          * @generated
156:          */
157:         public void createPackageContents() {
158:•                if (isCreated) {
159:                         return;
160:                 }
161:                 isCreated = true;
162:
163:                 // Create classes and their features
164:                 fooEClass = createEClass(FOO);
165:                 createEAttribute(fooEClass, FOO__BAR);
166:         }
167:
168:         /**
169:          * <!-- begin-user-doc -->
170:          * <!-- end-user-doc -->
171:          *
172:          * @generated
173:          */
174:         private boolean isInitialized = false;
175:
176:         /**
177:          * Complete the initialization of the package and its meta-model. This
178:          * method is guarded to have no affect on any invocation but its first.
179:          * <!-- begin-user-doc -->
180:          * <!-- end-user-doc -->
181:          *
182:          * @generated
183:          */
184:         public void initializePackageContents() {
185:•                if (isInitialized) {
186:                         return;
187:                 }
188:                 isInitialized = true;
189:
190:                 // Initialize package
191:                 setName(eNAME);
192:                 setNsPrefix(eNS_PREFIX);
193:                 setNsURI(eNS_URI);
194:
195:                 // Create type parameters
196:
197:                 // Set bounds for type parameters
198:
199:                 // Add supertypes to classes
200:
201:                 // Initialize classes, features, and operations; add parameters
202:                 initEClass(fooEClass, Foo.class, "Foo", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
203:                 initEAttribute(getFoo_Bar(), ecorePackage.getEString(), "bar", null, 0, 1, Foo.class, !IS_TRANSIENT, //$NON-NLS-1$
204:                         !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
205:
206:                 // Create resource
207:                 createResource(eNS_URI);
208:         }
209:
210: } // ModelPackageImpl