View Javadoc

1   /**
2    * <copyright>
3    * </copyright>
4    *
5    * $Id$
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   * <!-- begin-user-doc -->
29   * An implementation of the model object '<em><b>Data Contract Model</b></em>'.
30   * <!-- end-user-doc -->
31   * <p>
32   * The following features are implemented:
33   * <ul>
34   *   <li>{@link org.mod4j.dsl.datacontract.mm.DataContractDsl.impl.DataContractModelImpl#getDtos <em>Dtos</em>}</li>
35   *   <li>{@link org.mod4j.dsl.datacontract.mm.DataContractDsl.impl.DataContractModelImpl#getEnumerations <em>Enumerations</em>}</li>
36   *   <li>{@link org.mod4j.dsl.datacontract.mm.DataContractDsl.impl.DataContractModelImpl#getExternalReferences <em>External References</em>}</li>
37   * </ul>
38   * </p>
39   *
40   * @generated
41   */
42  public class DataContractModelImpl extends ModelElementImpl implements DataContractModel {
43  	/**
44       * The cached value of the '{@link #getDtos() <em>Dtos</em>}' containment reference list.
45       * <!-- begin-user-doc -->
46  	 * <!-- end-user-doc -->
47       * @see #getDtos()
48       * @generated
49       * @ordered
50       */
51  	protected EList<Dto> dtos;
52  
53  	/**
54       * The cached value of the '{@link #getEnumerations() <em>Enumerations</em>}' containment reference list.
55       * <!-- begin-user-doc -->
56  	 * <!-- end-user-doc -->
57       * @see #getEnumerations()
58       * @generated
59       * @ordered
60       */
61  	protected EList<EnumerationDto> enumerations;
62  
63  	/**
64       * The cached value of the '{@link #getExternalReferences() <em>External References</em>}' containment reference list.
65       * <!-- begin-user-doc -->
66  	 * <!-- end-user-doc -->
67       * @see #getExternalReferences()
68       * @generated
69       * @ordered
70       */
71  	protected EList<ExternalReference> externalReferences;
72  
73  	/**
74       * <!-- begin-user-doc -->
75  	 * <!-- end-user-doc -->
76       * @generated
77       */
78  	protected DataContractModelImpl() {
79          super();
80      }
81  
82  	/**
83       * <!-- begin-user-doc -->
84  	 * <!-- end-user-doc -->
85       * @generated
86       */
87  	@Override
88  	protected EClass eStaticClass() {
89          return DataContractDslPackage.Literals.DATA_CONTRACT_MODEL;
90      }
91  
92  	/**
93       * <!-- begin-user-doc -->
94  	 * <!-- end-user-doc -->
95       * @generated
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      * <!-- begin-user-doc -->
106 	 * <!-- end-user-doc -->
107      * @generated
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      * <!-- begin-user-doc -->
118 	 * <!-- end-user-doc -->
119      * @generated
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      * <!-- begin-user-doc -->
130 	 * <!-- end-user-doc -->
131      * @generated
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      * <!-- begin-user-doc -->
149 	 * <!-- end-user-doc -->
150      * @generated
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      * <!-- begin-user-doc -->
167 	 * <!-- end-user-doc -->
168      * @generated
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      * <!-- begin-user-doc -->
185 	 * <!-- end-user-doc -->
186      * @generated
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      * <!-- begin-user-doc -->
210 	 * <!-- end-user-doc -->
211      * @generated
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      * <!-- begin-user-doc -->
231 	 * <!-- end-user-doc -->
232      * @generated
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 } //DataContractModelImpl