1
2
3
4
5
6
7 package BusinessDomainDsl.impl;
8
9 import BusinessDomainDsl.AbstractType;
10 import BusinessDomainDsl.BusinessDomainDslPackage;
11 import BusinessDomainDsl.BusinessDomainModel;
12 import BusinessDomainDsl.Property;
13
14 import java.util.Collection;
15
16 import org.eclipse.emf.common.notify.Notification;
17 import org.eclipse.emf.common.notify.NotificationChain;
18
19 import org.eclipse.emf.common.util.EList;
20
21 import org.eclipse.emf.ecore.EClass;
22 import org.eclipse.emf.ecore.InternalEObject;
23
24 import org.eclipse.emf.ecore.impl.ENotificationImpl;
25
26 import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList;
27 import org.eclipse.emf.ecore.util.EcoreUtil;
28 import org.eclipse.emf.ecore.util.InternalEList;
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44 public abstract class AbstractTypeImpl extends ModelElementImpl implements AbstractType {
45
46
47
48
49
50
51
52
53 protected EList<Property> properties;
54
55
56
57
58
59
60 protected AbstractTypeImpl() {
61 super();
62 }
63
64
65
66
67
68
69 @Override
70 protected EClass eStaticClass() {
71 return BusinessDomainDslPackage.Literals.ABSTRACT_TYPE;
72 }
73
74
75
76
77
78
79 public EList<Property> getProperties() {
80 if (properties == null) {
81 properties = new EObjectContainmentWithInverseEList<Property>(Property.class, this, BusinessDomainDslPackage.ABSTRACT_TYPE__PROPERTIES, BusinessDomainDslPackage.PROPERTY__OWNING_TYPE);
82 }
83 return properties;
84 }
85
86
87
88
89
90
91 public BusinessDomainModel getModel() {
92 if (eContainerFeatureID() != BusinessDomainDslPackage.ABSTRACT_TYPE__MODEL) return null;
93 return (BusinessDomainModel)eContainer();
94 }
95
96
97
98
99
100
101 public NotificationChain basicSetModel(BusinessDomainModel newModel, NotificationChain msgs) {
102 msgs = eBasicSetContainer((InternalEObject)newModel, BusinessDomainDslPackage.ABSTRACT_TYPE__MODEL, msgs);
103 return msgs;
104 }
105
106
107
108
109
110
111 public void setModel(BusinessDomainModel newModel) {
112 if (newModel != eInternalContainer() || (eContainerFeatureID() != BusinessDomainDslPackage.ABSTRACT_TYPE__MODEL && newModel != null)) {
113 if (EcoreUtil.isAncestor(this, newModel))
114 throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
115 NotificationChain msgs = null;
116 if (eInternalContainer() != null)
117 msgs = eBasicRemoveFromContainer(msgs);
118 if (newModel != null)
119 msgs = ((InternalEObject)newModel).eInverseAdd(this, BusinessDomainDslPackage.BUSINESS_DOMAIN_MODEL__TYPES, BusinessDomainModel.class, msgs);
120 msgs = basicSetModel(newModel, msgs);
121 if (msgs != null) msgs.dispatch();
122 }
123 else if (eNotificationRequired())
124 eNotify(new ENotificationImpl(this, Notification.SET, BusinessDomainDslPackage.ABSTRACT_TYPE__MODEL, newModel, newModel));
125 }
126
127
128
129
130
131
132 @SuppressWarnings("unchecked")
133 @Override
134 public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
135 switch (featureID) {
136 case BusinessDomainDslPackage.ABSTRACT_TYPE__PROPERTIES:
137 return ((InternalEList<InternalEObject>)(InternalEList<?>)getProperties()).basicAdd(otherEnd, msgs);
138 case BusinessDomainDslPackage.ABSTRACT_TYPE__MODEL:
139 if (eInternalContainer() != null)
140 msgs = eBasicRemoveFromContainer(msgs);
141 return basicSetModel((BusinessDomainModel)otherEnd, msgs);
142 }
143 return super.eInverseAdd(otherEnd, featureID, msgs);
144 }
145
146
147
148
149
150
151 @Override
152 public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
153 switch (featureID) {
154 case BusinessDomainDslPackage.ABSTRACT_TYPE__PROPERTIES:
155 return ((InternalEList<?>)getProperties()).basicRemove(otherEnd, msgs);
156 case BusinessDomainDslPackage.ABSTRACT_TYPE__MODEL:
157 return basicSetModel(null, msgs);
158 }
159 return super.eInverseRemove(otherEnd, featureID, msgs);
160 }
161
162
163
164
165
166
167 @Override
168 public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) {
169 switch (eContainerFeatureID()) {
170 case BusinessDomainDslPackage.ABSTRACT_TYPE__MODEL:
171 return eInternalContainer().eInverseRemove(this, BusinessDomainDslPackage.BUSINESS_DOMAIN_MODEL__TYPES, BusinessDomainModel.class, msgs);
172 }
173 return super.eBasicRemoveFromContainerFeature(msgs);
174 }
175
176
177
178
179
180
181 @Override
182 public Object eGet(int featureID, boolean resolve, boolean coreType) {
183 switch (featureID) {
184 case BusinessDomainDslPackage.ABSTRACT_TYPE__PROPERTIES:
185 return getProperties();
186 case BusinessDomainDslPackage.ABSTRACT_TYPE__MODEL:
187 return getModel();
188 }
189 return super.eGet(featureID, resolve, coreType);
190 }
191
192
193
194
195
196
197 @SuppressWarnings("unchecked")
198 @Override
199 public void eSet(int featureID, Object newValue) {
200 switch (featureID) {
201 case BusinessDomainDslPackage.ABSTRACT_TYPE__PROPERTIES:
202 getProperties().clear();
203 getProperties().addAll((Collection<? extends Property>)newValue);
204 return;
205 case BusinessDomainDslPackage.ABSTRACT_TYPE__MODEL:
206 setModel((BusinessDomainModel)newValue);
207 return;
208 }
209 super.eSet(featureID, newValue);
210 }
211
212
213
214
215
216
217 @Override
218 public void eUnset(int featureID) {
219 switch (featureID) {
220 case BusinessDomainDslPackage.ABSTRACT_TYPE__PROPERTIES:
221 getProperties().clear();
222 return;
223 case BusinessDomainDslPackage.ABSTRACT_TYPE__MODEL:
224 setModel((BusinessDomainModel)null);
225 return;
226 }
227 super.eUnset(featureID);
228 }
229
230
231
232
233
234
235 @Override
236 public boolean eIsSet(int featureID) {
237 switch (featureID) {
238 case BusinessDomainDslPackage.ABSTRACT_TYPE__PROPERTIES:
239 return properties != null && !properties.isEmpty();
240 case BusinessDomainDslPackage.ABSTRACT_TYPE__MODEL:
241 return getModel() != null;
242 }
243 return super.eIsSet(featureID);
244 }
245
246 }