View Javadoc

1   /**
2    * <copyright>
3    * </copyright>
4    *
5    * $Id$
6    */
7   package BusinessDomainDsl.impl;
8   
9   import BusinessDomainDsl.AbstractBusinessRule;
10  import BusinessDomainDsl.Association;
11  import BusinessDomainDsl.BusinessClass;
12  import BusinessDomainDsl.BusinessDomainDslPackage;
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.EObjectWithInverseResolvingEList;
28  import org.eclipse.emf.ecore.util.InternalEList;
29  
30  /**
31   * <!-- begin-user-doc -->
32   * An implementation of the model object '<em><b>Business Class</b></em>'.
33   * <!-- end-user-doc -->
34   * <p>
35   * The following features are implemented:
36   * <ul>
37   *   <li>{@link BusinessDomainDsl.impl.BusinessClassImpl#getBusinessRules <em>Business Rules</em>}</li>
38   *   <li>{@link BusinessDomainDsl.impl.BusinessClassImpl#getSuperclass <em>Superclass</em>}</li>
39   *   <li>{@link BusinessDomainDsl.impl.BusinessClassImpl#getAssociationsTo <em>Associations To</em>}</li>
40   * </ul>
41   * </p>
42   *
43   * @generated
44   */
45  public class BusinessClassImpl extends AbstractBusinessClassImpl implements BusinessClass {
46  	/**
47       * The cached value of the '{@link #getBusinessRules() <em>Business Rules</em>}' containment reference list.
48       * <!-- begin-user-doc -->
49  	 * <!-- end-user-doc -->
50       * @see #getBusinessRules()
51       * @generated
52       * @ordered
53       */
54  	protected EList<AbstractBusinessRule> businessRules;
55  
56  	/**
57       * The cached value of the '{@link #getSuperclass() <em>Superclass</em>}' reference.
58       * <!-- begin-user-doc -->
59  	 * <!-- end-user-doc -->
60       * @see #getSuperclass()
61       * @generated
62       * @ordered
63       */
64  	protected BusinessClass superclass;
65  
66  	/**
67       * The cached value of the '{@link #getAssociationsTo() <em>Associations To</em>}' reference list.
68       * <!-- begin-user-doc -->
69  	 * <!-- end-user-doc -->
70       * @see #getAssociationsTo()
71       * @generated
72       * @ordered
73       */
74  	protected EList<Association> associationsTo;
75  
76  	/**
77       * <!-- begin-user-doc -->
78  	 * <!-- end-user-doc -->
79       * @generated
80       */
81  	protected BusinessClassImpl() {
82          super();
83      }
84  
85  	/**
86       * <!-- begin-user-doc -->
87  	 * <!-- end-user-doc -->
88       * @generated
89       */
90  	@Override
91  	protected EClass eStaticClass() {
92          return BusinessDomainDslPackage.Literals.BUSINESS_CLASS;
93      }
94  
95  	/**
96       * <!-- begin-user-doc -->
97  	 * <!-- end-user-doc -->
98       * @generated
99       */
100 	public EList<AbstractBusinessRule> getBusinessRules() {
101         if (businessRules == null) {
102             businessRules = new EObjectContainmentWithInverseEList<AbstractBusinessRule>(AbstractBusinessRule.class, this, BusinessDomainDslPackage.BUSINESS_CLASS__BUSINESS_RULES, BusinessDomainDslPackage.ABSTRACT_BUSINESS_RULE__BUSINESS_CLASS);
103         }
104         return businessRules;
105     }
106 
107 	/**
108      * <!-- begin-user-doc -->
109 	 * <!-- end-user-doc -->
110      * @generated
111      */
112 	public BusinessClass getSuperclass() {
113         if (superclass != null && superclass.eIsProxy()) {
114             InternalEObject oldSuperclass = (InternalEObject)superclass;
115             superclass = (BusinessClass)eResolveProxy(oldSuperclass);
116             if (superclass != oldSuperclass) {
117                 if (eNotificationRequired())
118                     eNotify(new ENotificationImpl(this, Notification.RESOLVE, BusinessDomainDslPackage.BUSINESS_CLASS__SUPERCLASS, oldSuperclass, superclass));
119             }
120         }
121         return superclass;
122     }
123 
124 	/**
125      * <!-- begin-user-doc -->
126 	 * <!-- end-user-doc -->
127      * @generated
128      */
129 	public BusinessClass basicGetSuperclass() {
130         return superclass;
131     }
132 
133 	/**
134      * <!-- begin-user-doc -->
135 	 * <!-- end-user-doc -->
136      * @generated
137      */
138 	public void setSuperclass(BusinessClass newSuperclass) {
139         BusinessClass oldSuperclass = superclass;
140         superclass = newSuperclass;
141         if (eNotificationRequired())
142             eNotify(new ENotificationImpl(this, Notification.SET, BusinessDomainDslPackage.BUSINESS_CLASS__SUPERCLASS, oldSuperclass, superclass));
143     }
144 
145 	/**
146      * <!-- begin-user-doc -->
147 	 * <!-- end-user-doc -->
148      * @generated
149      */
150 	public EList<Association> getAssociationsTo() {
151         if (associationsTo == null) {
152             associationsTo = new EObjectWithInverseResolvingEList<Association>(Association.class, this, BusinessDomainDslPackage.BUSINESS_CLASS__ASSOCIATIONS_TO, BusinessDomainDslPackage.ASSOCIATION__SOURCE);
153         }
154         return associationsTo;
155     }
156 
157 	/**
158      * <!-- begin-user-doc -->
159 	 * <!-- end-user-doc -->
160      * @generated
161      */
162 	@SuppressWarnings("unchecked")
163 	@Override
164 	public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
165         switch (featureID) {
166             case BusinessDomainDslPackage.BUSINESS_CLASS__BUSINESS_RULES:
167                 return ((InternalEList<InternalEObject>)(InternalEList<?>)getBusinessRules()).basicAdd(otherEnd, msgs);
168             case BusinessDomainDslPackage.BUSINESS_CLASS__ASSOCIATIONS_TO:
169                 return ((InternalEList<InternalEObject>)(InternalEList<?>)getAssociationsTo()).basicAdd(otherEnd, msgs);
170         }
171         return super.eInverseAdd(otherEnd, featureID, msgs);
172     }
173 
174 	/**
175      * <!-- begin-user-doc -->
176 	 * <!-- end-user-doc -->
177      * @generated
178      */
179 	@Override
180 	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
181         switch (featureID) {
182             case BusinessDomainDslPackage.BUSINESS_CLASS__BUSINESS_RULES:
183                 return ((InternalEList<?>)getBusinessRules()).basicRemove(otherEnd, msgs);
184             case BusinessDomainDslPackage.BUSINESS_CLASS__ASSOCIATIONS_TO:
185                 return ((InternalEList<?>)getAssociationsTo()).basicRemove(otherEnd, msgs);
186         }
187         return super.eInverseRemove(otherEnd, featureID, msgs);
188     }
189 
190 	/**
191      * <!-- begin-user-doc -->
192 	 * <!-- end-user-doc -->
193      * @generated
194      */
195 	@Override
196 	public Object eGet(int featureID, boolean resolve, boolean coreType) {
197         switch (featureID) {
198             case BusinessDomainDslPackage.BUSINESS_CLASS__BUSINESS_RULES:
199                 return getBusinessRules();
200             case BusinessDomainDslPackage.BUSINESS_CLASS__SUPERCLASS:
201                 if (resolve) return getSuperclass();
202                 return basicGetSuperclass();
203             case BusinessDomainDslPackage.BUSINESS_CLASS__ASSOCIATIONS_TO:
204                 return getAssociationsTo();
205         }
206         return super.eGet(featureID, resolve, coreType);
207     }
208 
209 	/**
210      * <!-- begin-user-doc -->
211 	 * <!-- end-user-doc -->
212      * @generated
213      */
214 	@SuppressWarnings("unchecked")
215 	@Override
216 	public void eSet(int featureID, Object newValue) {
217         switch (featureID) {
218             case BusinessDomainDslPackage.BUSINESS_CLASS__BUSINESS_RULES:
219                 getBusinessRules().clear();
220                 getBusinessRules().addAll((Collection<? extends AbstractBusinessRule>)newValue);
221                 return;
222             case BusinessDomainDslPackage.BUSINESS_CLASS__SUPERCLASS:
223                 setSuperclass((BusinessClass)newValue);
224                 return;
225             case BusinessDomainDslPackage.BUSINESS_CLASS__ASSOCIATIONS_TO:
226                 getAssociationsTo().clear();
227                 getAssociationsTo().addAll((Collection<? extends Association>)newValue);
228                 return;
229         }
230         super.eSet(featureID, newValue);
231     }
232 
233 	/**
234      * <!-- begin-user-doc -->
235 	 * <!-- end-user-doc -->
236      * @generated
237      */
238 	@Override
239 	public void eUnset(int featureID) {
240         switch (featureID) {
241             case BusinessDomainDslPackage.BUSINESS_CLASS__BUSINESS_RULES:
242                 getBusinessRules().clear();
243                 return;
244             case BusinessDomainDslPackage.BUSINESS_CLASS__SUPERCLASS:
245                 setSuperclass((BusinessClass)null);
246                 return;
247             case BusinessDomainDslPackage.BUSINESS_CLASS__ASSOCIATIONS_TO:
248                 getAssociationsTo().clear();
249                 return;
250         }
251         super.eUnset(featureID);
252     }
253 
254 	/**
255      * <!-- begin-user-doc -->
256 	 * <!-- end-user-doc -->
257      * @generated
258      */
259 	@Override
260 	public boolean eIsSet(int featureID) {
261         switch (featureID) {
262             case BusinessDomainDslPackage.BUSINESS_CLASS__BUSINESS_RULES:
263                 return businessRules != null && !businessRules.isEmpty();
264             case BusinessDomainDslPackage.BUSINESS_CLASS__SUPERCLASS:
265                 return superclass != null;
266             case BusinessDomainDslPackage.BUSINESS_CLASS__ASSOCIATIONS_TO:
267                 return associationsTo != null && !associationsTo.isEmpty();
268         }
269         return super.eIsSet(featureID);
270     }
271 
272 } //BusinessClassImpl