1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package EssentialOCL.impl; |
8 | |
9 | import EssentialOCL.EssentialOCLPackage; |
10 | import EssentialOCL.LetExp; |
11 | import EssentialOCL.OclExpression; |
12 | import EssentialOCL.Variable; |
13 | |
14 | import org.eclipse.emf.common.notify.Notification; |
15 | import org.eclipse.emf.common.notify.NotificationChain; |
16 | |
17 | import org.eclipse.emf.ecore.EClass; |
18 | import org.eclipse.emf.ecore.InternalEObject; |
19 | |
20 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
21 | |
22 | /** |
23 | * <!-- begin-user-doc --> |
24 | * An implementation of the model object '<em><b>Let Exp</b></em>'. |
25 | * <!-- end-user-doc --> |
26 | * <p> |
27 | * The following features are implemented: |
28 | * <ul> |
29 | * <li>{@link EssentialOCL.impl.LetExpImpl#getIn <em>In</em>}</li> |
30 | * <li>{@link EssentialOCL.impl.LetExpImpl#getVariable <em>Variable</em>}</li> |
31 | * </ul> |
32 | * </p> |
33 | * |
34 | * @generated |
35 | */ |
36 | public class LetExpImpl extends OclExpressionImpl implements LetExp { |
37 | /** |
38 | * The cached value of the '{@link #getIn() <em>In</em>}' containment reference. |
39 | * <!-- begin-user-doc --> |
40 | * <!-- end-user-doc --> |
41 | * @see #getIn() |
42 | * @generated |
43 | * @ordered |
44 | */ |
45 | protected OclExpression in; |
46 | |
47 | /** |
48 | * The cached value of the '{@link #getVariable() <em>Variable</em>}' containment reference. |
49 | * <!-- begin-user-doc --> |
50 | * <!-- end-user-doc --> |
51 | * @see #getVariable() |
52 | * @generated |
53 | * @ordered |
54 | */ |
55 | protected Variable variable; |
56 | |
57 | /** |
58 | * <!-- begin-user-doc --> |
59 | * <!-- end-user-doc --> |
60 | * @generated |
61 | */ |
62 | protected LetExpImpl() { |
63 | super(); |
64 | } |
65 | |
66 | /** |
67 | * <!-- begin-user-doc --> |
68 | * <!-- end-user-doc --> |
69 | * @generated |
70 | */ |
71 | @Override |
72 | protected EClass eStaticClass() { |
73 | return EssentialOCLPackage.Literals.LET_EXP; |
74 | } |
75 | |
76 | /** |
77 | * <!-- begin-user-doc --> |
78 | * <!-- end-user-doc --> |
79 | * @generated |
80 | */ |
81 | public OclExpression getIn() { |
82 | return in; |
83 | } |
84 | |
85 | /** |
86 | * <!-- begin-user-doc --> |
87 | * <!-- end-user-doc --> |
88 | * @generated |
89 | */ |
90 | public NotificationChain basicSetIn(OclExpression newIn, NotificationChain msgs) { |
91 | OclExpression oldIn = in; |
92 | in = newIn; |
93 | if (eNotificationRequired()) { |
94 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EssentialOCLPackage.LET_EXP__IN, oldIn, newIn); |
95 | if (msgs == null) msgs = notification; else msgs.add(notification); |
96 | } |
97 | return msgs; |
98 | } |
99 | |
100 | /** |
101 | * <!-- begin-user-doc --> |
102 | * <!-- end-user-doc --> |
103 | * @generated |
104 | */ |
105 | public void setIn(OclExpression newIn) { |
106 | if (newIn != in) { |
107 | NotificationChain msgs = null; |
108 | if (in != null) |
109 | msgs = ((InternalEObject)in).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EssentialOCLPackage.LET_EXP__IN, null, msgs); |
110 | if (newIn != null) |
111 | msgs = ((InternalEObject)newIn).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EssentialOCLPackage.LET_EXP__IN, null, msgs); |
112 | msgs = basicSetIn(newIn, msgs); |
113 | if (msgs != null) msgs.dispatch(); |
114 | } |
115 | else if (eNotificationRequired()) |
116 | eNotify(new ENotificationImpl(this, Notification.SET, EssentialOCLPackage.LET_EXP__IN, newIn, newIn)); |
117 | } |
118 | |
119 | /** |
120 | * <!-- begin-user-doc --> |
121 | * <!-- end-user-doc --> |
122 | * @generated |
123 | */ |
124 | public Variable getVariable() { |
125 | return variable; |
126 | } |
127 | |
128 | /** |
129 | * <!-- begin-user-doc --> |
130 | * <!-- end-user-doc --> |
131 | * @generated |
132 | */ |
133 | public NotificationChain basicSetVariable(Variable newVariable, NotificationChain msgs) { |
134 | Variable oldVariable = variable; |
135 | variable = newVariable; |
136 | if (eNotificationRequired()) { |
137 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EssentialOCLPackage.LET_EXP__VARIABLE, oldVariable, newVariable); |
138 | if (msgs == null) msgs = notification; else msgs.add(notification); |
139 | } |
140 | return msgs; |
141 | } |
142 | |
143 | /** |
144 | * <!-- begin-user-doc --> |
145 | * <!-- end-user-doc --> |
146 | * @generated |
147 | */ |
148 | public void setVariable(Variable newVariable) { |
149 | if (newVariable != variable) { |
150 | NotificationChain msgs = null; |
151 | if (variable != null) |
152 | msgs = ((InternalEObject)variable).eInverseRemove(this, EssentialOCLPackage.VARIABLE__LET_EXP, Variable.class, msgs); |
153 | if (newVariable != null) |
154 | msgs = ((InternalEObject)newVariable).eInverseAdd(this, EssentialOCLPackage.VARIABLE__LET_EXP, Variable.class, msgs); |
155 | msgs = basicSetVariable(newVariable, msgs); |
156 | if (msgs != null) msgs.dispatch(); |
157 | } |
158 | else if (eNotificationRequired()) |
159 | eNotify(new ENotificationImpl(this, Notification.SET, EssentialOCLPackage.LET_EXP__VARIABLE, newVariable, newVariable)); |
160 | } |
161 | |
162 | /** |
163 | * <!-- begin-user-doc --> |
164 | * <!-- end-user-doc --> |
165 | * @generated |
166 | */ |
167 | @Override |
168 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
169 | switch (featureID) { |
170 | case EssentialOCLPackage.LET_EXP__VARIABLE: |
171 | if (variable != null) |
172 | msgs = ((InternalEObject)variable).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EssentialOCLPackage.LET_EXP__VARIABLE, null, msgs); |
173 | return basicSetVariable((Variable)otherEnd, msgs); |
174 | } |
175 | return super.eInverseAdd(otherEnd, featureID, msgs); |
176 | } |
177 | |
178 | /** |
179 | * <!-- begin-user-doc --> |
180 | * <!-- end-user-doc --> |
181 | * @generated |
182 | */ |
183 | @Override |
184 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
185 | switch (featureID) { |
186 | case EssentialOCLPackage.LET_EXP__IN: |
187 | return basicSetIn(null, msgs); |
188 | case EssentialOCLPackage.LET_EXP__VARIABLE: |
189 | return basicSetVariable(null, msgs); |
190 | } |
191 | return super.eInverseRemove(otherEnd, featureID, msgs); |
192 | } |
193 | |
194 | /** |
195 | * <!-- begin-user-doc --> |
196 | * <!-- end-user-doc --> |
197 | * @generated |
198 | */ |
199 | @Override |
200 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
201 | switch (featureID) { |
202 | case EssentialOCLPackage.LET_EXP__IN: |
203 | return getIn(); |
204 | case EssentialOCLPackage.LET_EXP__VARIABLE: |
205 | return getVariable(); |
206 | } |
207 | return super.eGet(featureID, resolve, coreType); |
208 | } |
209 | |
210 | /** |
211 | * <!-- begin-user-doc --> |
212 | * <!-- end-user-doc --> |
213 | * @generated |
214 | */ |
215 | @Override |
216 | public void eSet(int featureID, Object newValue) { |
217 | switch (featureID) { |
218 | case EssentialOCLPackage.LET_EXP__IN: |
219 | setIn((OclExpression)newValue); |
220 | return; |
221 | case EssentialOCLPackage.LET_EXP__VARIABLE: |
222 | setVariable((Variable)newValue); |
223 | return; |
224 | } |
225 | super.eSet(featureID, newValue); |
226 | } |
227 | |
228 | /** |
229 | * <!-- begin-user-doc --> |
230 | * <!-- end-user-doc --> |
231 | * @generated |
232 | */ |
233 | @Override |
234 | public void eUnset(int featureID) { |
235 | switch (featureID) { |
236 | case EssentialOCLPackage.LET_EXP__IN: |
237 | setIn((OclExpression)null); |
238 | return; |
239 | case EssentialOCLPackage.LET_EXP__VARIABLE: |
240 | setVariable((Variable)null); |
241 | return; |
242 | } |
243 | super.eUnset(featureID); |
244 | } |
245 | |
246 | /** |
247 | * <!-- begin-user-doc --> |
248 | * <!-- end-user-doc --> |
249 | * @generated |
250 | */ |
251 | @Override |
252 | public boolean eIsSet(int featureID) { |
253 | switch (featureID) { |
254 | case EssentialOCLPackage.LET_EXP__IN: |
255 | return in != null; |
256 | case EssentialOCLPackage.LET_EXP__VARIABLE: |
257 | return variable != null; |
258 | } |
259 | return super.eIsSet(featureID); |
260 | } |
261 | |
262 | } //LetExpImpl |