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