View Javadoc

1   /**
2    * <copyright>
3    * </copyright>
4    *
5    * $Id$
6    */
7   package BusinessDomainDsl.impl;
8   
9   import BusinessDomainDsl.AbstractBusinessRule;
10  import BusinessDomainDsl.BusinessClass;
11  import BusinessDomainDsl.BusinessDomainDslPackage;
12  
13  import org.eclipse.emf.common.notify.Notification;
14  import org.eclipse.emf.common.notify.NotificationChain;
15  
16  import org.eclipse.emf.ecore.EClass;
17  import org.eclipse.emf.ecore.InternalEObject;
18  
19  import org.eclipse.emf.ecore.impl.ENotificationImpl;
20  
21  import org.eclipse.emf.ecore.util.EcoreUtil;
22  
23  /**
24   * <!-- begin-user-doc -->
25   * An implementation of the model object '<em><b>Abstract Business Rule</b></em>'.
26   * <!-- end-user-doc -->
27   * <p>
28   * The following features are implemented:
29   * <ul>
30   *   <li>{@link BusinessDomainDsl.impl.AbstractBusinessRuleImpl#getBusinessClass <em>Business Class</em>}</li>
31   * </ul>
32   * </p>
33   *
34   * @generated
35   */
36  public class AbstractBusinessRuleImpl extends ModelElementImpl implements AbstractBusinessRule {
37  	/**
38       * <!-- begin-user-doc -->
39  	 * <!-- end-user-doc -->
40       * @generated
41       */
42  	protected AbstractBusinessRuleImpl() {
43          super();
44      }
45  
46  	/**
47       * <!-- begin-user-doc -->
48  	 * <!-- end-user-doc -->
49       * @generated
50       */
51  	@Override
52  	protected EClass eStaticClass() {
53          return BusinessDomainDslPackage.Literals.ABSTRACT_BUSINESS_RULE;
54      }
55  
56  	/**
57       * <!-- begin-user-doc -->
58  	 * <!-- end-user-doc -->
59       * @generated
60       */
61  	public BusinessClass getBusinessClass() {
62          if (eContainerFeatureID() != BusinessDomainDslPackage.ABSTRACT_BUSINESS_RULE__BUSINESS_CLASS) return null;
63          return (BusinessClass)eContainer();
64      }
65  
66  	/**
67       * <!-- begin-user-doc -->
68  	 * <!-- end-user-doc -->
69       * @generated
70       */
71  	public NotificationChain basicSetBusinessClass(BusinessClass newBusinessClass, NotificationChain msgs) {
72          msgs = eBasicSetContainer((InternalEObject)newBusinessClass, BusinessDomainDslPackage.ABSTRACT_BUSINESS_RULE__BUSINESS_CLASS, msgs);
73          return msgs;
74      }
75  
76  	/**
77       * <!-- begin-user-doc -->
78  	 * <!-- end-user-doc -->
79       * @generated
80       */
81  	public void setBusinessClass(BusinessClass newBusinessClass) {
82          if (newBusinessClass != eInternalContainer() || (eContainerFeatureID() != BusinessDomainDslPackage.ABSTRACT_BUSINESS_RULE__BUSINESS_CLASS && newBusinessClass != null)) {
83              if (EcoreUtil.isAncestor(this, newBusinessClass))
84                  throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
85              NotificationChain msgs = null;
86              if (eInternalContainer() != null)
87                  msgs = eBasicRemoveFromContainer(msgs);
88              if (newBusinessClass != null)
89                  msgs = ((InternalEObject)newBusinessClass).eInverseAdd(this, BusinessDomainDslPackage.BUSINESS_CLASS__BUSINESS_RULES, BusinessClass.class, msgs);
90              msgs = basicSetBusinessClass(newBusinessClass, msgs);
91              if (msgs != null) msgs.dispatch();
92          }
93          else if (eNotificationRequired())
94              eNotify(new ENotificationImpl(this, Notification.SET, BusinessDomainDslPackage.ABSTRACT_BUSINESS_RULE__BUSINESS_CLASS, newBusinessClass, newBusinessClass));
95      }
96  
97  	/**
98       * <!-- begin-user-doc -->
99  	 * <!-- end-user-doc -->
100      * @generated
101      */
102 	@Override
103 	public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
104         switch (featureID) {
105             case BusinessDomainDslPackage.ABSTRACT_BUSINESS_RULE__BUSINESS_CLASS:
106                 if (eInternalContainer() != null)
107                     msgs = eBasicRemoveFromContainer(msgs);
108                 return basicSetBusinessClass((BusinessClass)otherEnd, msgs);
109         }
110         return super.eInverseAdd(otherEnd, featureID, msgs);
111     }
112 
113 	/**
114      * <!-- begin-user-doc -->
115 	 * <!-- end-user-doc -->
116      * @generated
117      */
118 	@Override
119 	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
120         switch (featureID) {
121             case BusinessDomainDslPackage.ABSTRACT_BUSINESS_RULE__BUSINESS_CLASS:
122                 return basicSetBusinessClass(null, msgs);
123         }
124         return super.eInverseRemove(otherEnd, featureID, msgs);
125     }
126 
127 	/**
128      * <!-- begin-user-doc -->
129 	 * <!-- end-user-doc -->
130      * @generated
131      */
132 	@Override
133 	public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) {
134         switch (eContainerFeatureID()) {
135             case BusinessDomainDslPackage.ABSTRACT_BUSINESS_RULE__BUSINESS_CLASS:
136                 return eInternalContainer().eInverseRemove(this, BusinessDomainDslPackage.BUSINESS_CLASS__BUSINESS_RULES, BusinessClass.class, msgs);
137         }
138         return super.eBasicRemoveFromContainerFeature(msgs);
139     }
140 
141 	/**
142      * <!-- begin-user-doc -->
143 	 * <!-- end-user-doc -->
144      * @generated
145      */
146 	@Override
147 	public Object eGet(int featureID, boolean resolve, boolean coreType) {
148         switch (featureID) {
149             case BusinessDomainDslPackage.ABSTRACT_BUSINESS_RULE__BUSINESS_CLASS:
150                 return getBusinessClass();
151         }
152         return super.eGet(featureID, resolve, coreType);
153     }
154 
155 	/**
156      * <!-- begin-user-doc -->
157 	 * <!-- end-user-doc -->
158      * @generated
159      */
160 	@Override
161 	public void eSet(int featureID, Object newValue) {
162         switch (featureID) {
163             case BusinessDomainDslPackage.ABSTRACT_BUSINESS_RULE__BUSINESS_CLASS:
164                 setBusinessClass((BusinessClass)newValue);
165                 return;
166         }
167         super.eSet(featureID, newValue);
168     }
169 
170 	/**
171      * <!-- begin-user-doc -->
172 	 * <!-- end-user-doc -->
173      * @generated
174      */
175 	@Override
176 	public void eUnset(int featureID) {
177         switch (featureID) {
178             case BusinessDomainDslPackage.ABSTRACT_BUSINESS_RULE__BUSINESS_CLASS:
179                 setBusinessClass((BusinessClass)null);
180                 return;
181         }
182         super.eUnset(featureID);
183     }
184 
185 	/**
186      * <!-- begin-user-doc -->
187 	 * <!-- end-user-doc -->
188      * @generated
189      */
190 	@Override
191 	public boolean eIsSet(int featureID) {
192         switch (featureID) {
193             case BusinessDomainDslPackage.ABSTRACT_BUSINESS_RULE__BUSINESS_CLASS:
194                 return getBusinessClass() != null;
195         }
196         return super.eIsSet(featureID);
197     }
198 
199 } //AbstractBusinessRuleImpl