1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package QVTRelation.impl; |
8 | |
9 | import EMOF.impl.ElementImpl; |
10 | |
11 | import EssentialOCL.OclExpression; |
12 | import EssentialOCL.Variable; |
13 | |
14 | import QVTRelation.QVTRelationPackage; |
15 | import QVTRelation.RelationDomainAssignment; |
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>Relation Domain Assignment</b></em>'. |
28 | * <!-- end-user-doc --> |
29 | * <p> |
30 | * The following features are implemented: |
31 | * <ul> |
32 | * <li>{@link QVTRelation.impl.RelationDomainAssignmentImpl#getValueExp <em>Value Exp</em>}</li> |
33 | * <li>{@link QVTRelation.impl.RelationDomainAssignmentImpl#getVariable <em>Variable</em>}</li> |
34 | * </ul> |
35 | * </p> |
36 | * |
37 | * @generated |
38 | */ |
39 | public class RelationDomainAssignmentImpl extends ElementImpl implements RelationDomainAssignment { |
40 | /** |
41 | * The cached value of the '{@link #getValueExp() <em>Value Exp</em>}' containment reference. |
42 | * <!-- begin-user-doc --> |
43 | * <!-- end-user-doc --> |
44 | * @see #getValueExp() |
45 | * @generated |
46 | * @ordered |
47 | */ |
48 | protected OclExpression valueExp; |
49 | |
50 | /** |
51 | * The cached value of the '{@link #getVariable() <em>Variable</em>}' reference. |
52 | * <!-- begin-user-doc --> |
53 | * <!-- end-user-doc --> |
54 | * @see #getVariable() |
55 | * @generated |
56 | * @ordered |
57 | */ |
58 | protected Variable variable; |
59 | |
60 | /** |
61 | * <!-- begin-user-doc --> |
62 | * <!-- end-user-doc --> |
63 | * @generated |
64 | */ |
65 | protected RelationDomainAssignmentImpl() { |
66 | super(); |
67 | } |
68 | |
69 | /** |
70 | * <!-- begin-user-doc --> |
71 | * <!-- end-user-doc --> |
72 | * @generated |
73 | */ |
74 | @Override |
75 | protected EClass eStaticClass() { |
76 | return QVTRelationPackage.Literals.RELATION_DOMAIN_ASSIGNMENT; |
77 | } |
78 | |
79 | /** |
80 | * <!-- begin-user-doc --> |
81 | * <!-- end-user-doc --> |
82 | * @generated |
83 | */ |
84 | public OclExpression getValueExp() { |
85 | return valueExp; |
86 | } |
87 | |
88 | /** |
89 | * <!-- begin-user-doc --> |
90 | * <!-- end-user-doc --> |
91 | * @generated |
92 | */ |
93 | public NotificationChain basicSetValueExp(OclExpression newValueExp, NotificationChain msgs) { |
94 | OclExpression oldValueExp = valueExp; |
95 | valueExp = newValueExp; |
96 | if (eNotificationRequired()) { |
97 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, QVTRelationPackage.RELATION_DOMAIN_ASSIGNMENT__VALUE_EXP, oldValueExp, newValueExp); |
98 | if (msgs == null) msgs = notification; else msgs.add(notification); |
99 | } |
100 | return msgs; |
101 | } |
102 | |
103 | /** |
104 | * <!-- begin-user-doc --> |
105 | * <!-- end-user-doc --> |
106 | * @generated |
107 | */ |
108 | public void setValueExp(OclExpression newValueExp) { |
109 | if (newValueExp != valueExp) { |
110 | NotificationChain msgs = null; |
111 | if (valueExp != null) |
112 | msgs = ((InternalEObject)valueExp).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - QVTRelationPackage.RELATION_DOMAIN_ASSIGNMENT__VALUE_EXP, null, msgs); |
113 | if (newValueExp != null) |
114 | msgs = ((InternalEObject)newValueExp).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - QVTRelationPackage.RELATION_DOMAIN_ASSIGNMENT__VALUE_EXP, null, msgs); |
115 | msgs = basicSetValueExp(newValueExp, msgs); |
116 | if (msgs != null) msgs.dispatch(); |
117 | } |
118 | else if (eNotificationRequired()) |
119 | eNotify(new ENotificationImpl(this, Notification.SET, QVTRelationPackage.RELATION_DOMAIN_ASSIGNMENT__VALUE_EXP, newValueExp, newValueExp)); |
120 | } |
121 | |
122 | /** |
123 | * <!-- begin-user-doc --> |
124 | * <!-- end-user-doc --> |
125 | * @generated |
126 | */ |
127 | public Variable getVariable() { |
128 | if (variable != null && variable.eIsProxy()) { |
129 | InternalEObject oldVariable = (InternalEObject)variable; |
130 | variable = (Variable)eResolveProxy(oldVariable); |
131 | if (variable != oldVariable) { |
132 | if (eNotificationRequired()) |
133 | eNotify(new ENotificationImpl(this, Notification.RESOLVE, QVTRelationPackage.RELATION_DOMAIN_ASSIGNMENT__VARIABLE, oldVariable, variable)); |
134 | } |
135 | } |
136 | return variable; |
137 | } |
138 | |
139 | /** |
140 | * <!-- begin-user-doc --> |
141 | * <!-- end-user-doc --> |
142 | * @generated |
143 | */ |
144 | public Variable basicGetVariable() { |
145 | return variable; |
146 | } |
147 | |
148 | /** |
149 | * <!-- begin-user-doc --> |
150 | * <!-- end-user-doc --> |
151 | * @generated |
152 | */ |
153 | public void setVariable(Variable newVariable) { |
154 | Variable oldVariable = variable; |
155 | variable = newVariable; |
156 | if (eNotificationRequired()) |
157 | eNotify(new ENotificationImpl(this, Notification.SET, QVTRelationPackage.RELATION_DOMAIN_ASSIGNMENT__VARIABLE, oldVariable, variable)); |
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 QVTRelationPackage.RELATION_DOMAIN_ASSIGNMENT__VALUE_EXP: |
169 | return basicSetValueExp(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 QVTRelationPackage.RELATION_DOMAIN_ASSIGNMENT__VALUE_EXP: |
183 | return getValueExp(); |
184 | case QVTRelationPackage.RELATION_DOMAIN_ASSIGNMENT__VARIABLE: |
185 | if (resolve) return getVariable(); |
186 | return basicGetVariable(); |
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 QVTRelationPackage.RELATION_DOMAIN_ASSIGNMENT__VALUE_EXP: |
200 | setValueExp((OclExpression)newValue); |
201 | return; |
202 | case QVTRelationPackage.RELATION_DOMAIN_ASSIGNMENT__VARIABLE: |
203 | setVariable((Variable)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 QVTRelationPackage.RELATION_DOMAIN_ASSIGNMENT__VALUE_EXP: |
218 | setValueExp((OclExpression)null); |
219 | return; |
220 | case QVTRelationPackage.RELATION_DOMAIN_ASSIGNMENT__VARIABLE: |
221 | setVariable((Variable)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 QVTRelationPackage.RELATION_DOMAIN_ASSIGNMENT__VALUE_EXP: |
236 | return valueExp != null; |
237 | case QVTRelationPackage.RELATION_DOMAIN_ASSIGNMENT__VARIABLE: |
238 | return variable != null; |
239 | } |
240 | return super.eIsSet(featureID); |
241 | } |
242 | |
243 | } //RelationDomainAssignmentImpl |