1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.stoex.impl; |
8 | |
9 | import org.eclipse.emf.common.notify.Notification; |
10 | import org.eclipse.emf.common.notify.NotificationChain; |
11 | import org.eclipse.emf.ecore.EClass; |
12 | import org.eclipse.emf.ecore.InternalEObject; |
13 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
14 | |
15 | import de.uka.ipd.sdq.stoex.Product; |
16 | import de.uka.ipd.sdq.stoex.StoexPackage; |
17 | import de.uka.ipd.sdq.stoex.Term; |
18 | import de.uka.ipd.sdq.stoex.TermExpression; |
19 | import de.uka.ipd.sdq.stoex.TermOperations; |
20 | |
21 | /** |
22 | * <!-- begin-user-doc --> |
23 | * An implementation of the model object '<em><b>Term Expression</b></em>'. |
24 | * <!-- end-user-doc --> |
25 | * <p> |
26 | * The following features are implemented: |
27 | * <ul> |
28 | * <li>{@link de.uka.ipd.sdq.stoex.impl.TermExpressionImpl#getLeft <em>Left</em>}</li> |
29 | * <li>{@link de.uka.ipd.sdq.stoex.impl.TermExpressionImpl#getRight <em>Right</em>}</li> |
30 | * <li>{@link de.uka.ipd.sdq.stoex.impl.TermExpressionImpl#getOperation <em>Operation</em>}</li> |
31 | * </ul> |
32 | * </p> |
33 | * |
34 | * @generated |
35 | */ |
36 | public class TermExpressionImpl extends TermImpl implements TermExpression { |
37 | /** |
38 | * <!-- begin-user-doc --> |
39 | * <!-- end-user-doc --> |
40 | * @generated |
41 | */ |
42 | public static final String copyright = "Copyright 2007-2009, SDQ, IPD, U Karlsruhe"; |
43 | |
44 | /** |
45 | * The cached value of the '{@link #getLeft() <em>Left</em>}' containment reference. |
46 | * <!-- begin-user-doc --> |
47 | * <!-- end-user-doc --> |
48 | * @see #getLeft() |
49 | * @generated |
50 | * @ordered |
51 | */ |
52 | protected Term left; |
53 | |
54 | /** |
55 | * The cached value of the '{@link #getRight() <em>Right</em>}' containment reference. |
56 | * <!-- begin-user-doc --> |
57 | * <!-- end-user-doc --> |
58 | * @see #getRight() |
59 | * @generated |
60 | * @ordered |
61 | */ |
62 | protected Product right; |
63 | |
64 | /** |
65 | * The default value of the '{@link #getOperation() <em>Operation</em>}' attribute. |
66 | * <!-- begin-user-doc --> |
67 | * <!-- end-user-doc --> |
68 | * @see #getOperation() |
69 | * @generated |
70 | * @ordered |
71 | */ |
72 | protected static final TermOperations OPERATION_EDEFAULT = TermOperations.ADD; |
73 | |
74 | /** |
75 | * The cached value of the '{@link #getOperation() <em>Operation</em>}' attribute. |
76 | * <!-- begin-user-doc --> |
77 | * <!-- end-user-doc --> |
78 | * @see #getOperation() |
79 | * @generated |
80 | * @ordered |
81 | */ |
82 | protected TermOperations operation = OPERATION_EDEFAULT; |
83 | |
84 | /** |
85 | * <!-- begin-user-doc --> |
86 | * <!-- end-user-doc --> |
87 | * @generated |
88 | */ |
89 | protected TermExpressionImpl() { |
90 | super(); |
91 | } |
92 | |
93 | /** |
94 | * <!-- begin-user-doc --> |
95 | * <!-- end-user-doc --> |
96 | * @generated |
97 | */ |
98 | @Override |
99 | protected EClass eStaticClass() { |
100 | return StoexPackage.Literals.TERM_EXPRESSION; |
101 | } |
102 | |
103 | /** |
104 | * <!-- begin-user-doc --> |
105 | * <!-- end-user-doc --> |
106 | * @generated |
107 | */ |
108 | public Term getLeft() { |
109 | return left; |
110 | } |
111 | |
112 | /** |
113 | * <!-- begin-user-doc --> |
114 | * <!-- end-user-doc --> |
115 | * @generated |
116 | */ |
117 | public NotificationChain basicSetLeft(Term newLeft, NotificationChain msgs) { |
118 | Term oldLeft = left; |
119 | left = newLeft; |
120 | if (eNotificationRequired()) { |
121 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, StoexPackage.TERM_EXPRESSION__LEFT, oldLeft, newLeft); |
122 | if (msgs == null) msgs = notification; else msgs.add(notification); |
123 | } |
124 | return msgs; |
125 | } |
126 | |
127 | /** |
128 | * <!-- begin-user-doc --> |
129 | * <!-- end-user-doc --> |
130 | * @generated |
131 | */ |
132 | public void setLeft(Term newLeft) { |
133 | if (newLeft != left) { |
134 | NotificationChain msgs = null; |
135 | if (left != null) |
136 | msgs = ((InternalEObject)left).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - StoexPackage.TERM_EXPRESSION__LEFT, null, msgs); |
137 | if (newLeft != null) |
138 | msgs = ((InternalEObject)newLeft).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - StoexPackage.TERM_EXPRESSION__LEFT, null, msgs); |
139 | msgs = basicSetLeft(newLeft, msgs); |
140 | if (msgs != null) msgs.dispatch(); |
141 | } |
142 | else if (eNotificationRequired()) |
143 | eNotify(new ENotificationImpl(this, Notification.SET, StoexPackage.TERM_EXPRESSION__LEFT, newLeft, newLeft)); |
144 | } |
145 | |
146 | /** |
147 | * <!-- begin-user-doc --> |
148 | * <!-- end-user-doc --> |
149 | * @generated |
150 | */ |
151 | public Product getRight() { |
152 | return right; |
153 | } |
154 | |
155 | /** |
156 | * <!-- begin-user-doc --> |
157 | * <!-- end-user-doc --> |
158 | * @generated |
159 | */ |
160 | public NotificationChain basicSetRight(Product newRight, NotificationChain msgs) { |
161 | Product oldRight = right; |
162 | right = newRight; |
163 | if (eNotificationRequired()) { |
164 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, StoexPackage.TERM_EXPRESSION__RIGHT, oldRight, newRight); |
165 | if (msgs == null) msgs = notification; else msgs.add(notification); |
166 | } |
167 | return msgs; |
168 | } |
169 | |
170 | /** |
171 | * <!-- begin-user-doc --> |
172 | * <!-- end-user-doc --> |
173 | * @generated |
174 | */ |
175 | public void setRight(Product newRight) { |
176 | if (newRight != right) { |
177 | NotificationChain msgs = null; |
178 | if (right != null) |
179 | msgs = ((InternalEObject)right).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - StoexPackage.TERM_EXPRESSION__RIGHT, null, msgs); |
180 | if (newRight != null) |
181 | msgs = ((InternalEObject)newRight).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - StoexPackage.TERM_EXPRESSION__RIGHT, null, msgs); |
182 | msgs = basicSetRight(newRight, msgs); |
183 | if (msgs != null) msgs.dispatch(); |
184 | } |
185 | else if (eNotificationRequired()) |
186 | eNotify(new ENotificationImpl(this, Notification.SET, StoexPackage.TERM_EXPRESSION__RIGHT, newRight, newRight)); |
187 | } |
188 | |
189 | /** |
190 | * <!-- begin-user-doc --> |
191 | * <!-- end-user-doc --> |
192 | * @generated |
193 | */ |
194 | public TermOperations getOperation() { |
195 | return operation; |
196 | } |
197 | |
198 | /** |
199 | * <!-- begin-user-doc --> |
200 | * <!-- end-user-doc --> |
201 | * @generated |
202 | */ |
203 | public void setOperation(TermOperations newOperation) { |
204 | TermOperations oldOperation = operation; |
205 | operation = newOperation == null ? OPERATION_EDEFAULT : newOperation; |
206 | if (eNotificationRequired()) |
207 | eNotify(new ENotificationImpl(this, Notification.SET, StoexPackage.TERM_EXPRESSION__OPERATION, oldOperation, operation)); |
208 | } |
209 | |
210 | /** |
211 | * <!-- begin-user-doc --> |
212 | * <!-- end-user-doc --> |
213 | * @generated |
214 | */ |
215 | @Override |
216 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
217 | switch (featureID) { |
218 | case StoexPackage.TERM_EXPRESSION__LEFT: |
219 | return basicSetLeft(null, msgs); |
220 | case StoexPackage.TERM_EXPRESSION__RIGHT: |
221 | return basicSetRight(null, msgs); |
222 | } |
223 | return super.eInverseRemove(otherEnd, featureID, msgs); |
224 | } |
225 | |
226 | /** |
227 | * <!-- begin-user-doc --> |
228 | * <!-- end-user-doc --> |
229 | * @generated |
230 | */ |
231 | @Override |
232 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
233 | switch (featureID) { |
234 | case StoexPackage.TERM_EXPRESSION__LEFT: |
235 | return getLeft(); |
236 | case StoexPackage.TERM_EXPRESSION__RIGHT: |
237 | return getRight(); |
238 | case StoexPackage.TERM_EXPRESSION__OPERATION: |
239 | return getOperation(); |
240 | } |
241 | return super.eGet(featureID, resolve, coreType); |
242 | } |
243 | |
244 | /** |
245 | * <!-- begin-user-doc --> |
246 | * <!-- end-user-doc --> |
247 | * @generated |
248 | */ |
249 | @Override |
250 | public void eSet(int featureID, Object newValue) { |
251 | switch (featureID) { |
252 | case StoexPackage.TERM_EXPRESSION__LEFT: |
253 | setLeft((Term)newValue); |
254 | return; |
255 | case StoexPackage.TERM_EXPRESSION__RIGHT: |
256 | setRight((Product)newValue); |
257 | return; |
258 | case StoexPackage.TERM_EXPRESSION__OPERATION: |
259 | setOperation((TermOperations)newValue); |
260 | return; |
261 | } |
262 | super.eSet(featureID, newValue); |
263 | } |
264 | |
265 | /** |
266 | * <!-- begin-user-doc --> |
267 | * <!-- end-user-doc --> |
268 | * @generated |
269 | */ |
270 | @Override |
271 | public void eUnset(int featureID) { |
272 | switch (featureID) { |
273 | case StoexPackage.TERM_EXPRESSION__LEFT: |
274 | setLeft((Term)null); |
275 | return; |
276 | case StoexPackage.TERM_EXPRESSION__RIGHT: |
277 | setRight((Product)null); |
278 | return; |
279 | case StoexPackage.TERM_EXPRESSION__OPERATION: |
280 | setOperation(OPERATION_EDEFAULT); |
281 | return; |
282 | } |
283 | super.eUnset(featureID); |
284 | } |
285 | |
286 | /** |
287 | * <!-- begin-user-doc --> |
288 | * <!-- end-user-doc --> |
289 | * @generated |
290 | */ |
291 | @Override |
292 | public boolean eIsSet(int featureID) { |
293 | switch (featureID) { |
294 | case StoexPackage.TERM_EXPRESSION__LEFT: |
295 | return left != null; |
296 | case StoexPackage.TERM_EXPRESSION__RIGHT: |
297 | return right != null; |
298 | case StoexPackage.TERM_EXPRESSION__OPERATION: |
299 | return operation != OPERATION_EDEFAULT; |
300 | } |
301 | return super.eIsSet(featureID); |
302 | } |
303 | |
304 | /** |
305 | * <!-- begin-user-doc --> |
306 | * <!-- end-user-doc --> |
307 | * @generated |
308 | */ |
309 | @Override |
310 | public String toString() { |
311 | if (eIsProxy()) return super.toString(); |
312 | |
313 | StringBuffer result = new StringBuffer(super.toString()); |
314 | result.append(" (operation: "); |
315 | result.append(operation); |
316 | result.append(')'); |
317 | return result.toString(); |
318 | } |
319 | |
320 | } //TermExpressionImpl |