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