1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package QVTRelation.impl; |
8 | |
9 | import EssentialOCL.OclExpression; |
10 | |
11 | import EssentialOCL.impl.OclExpressionImpl; |
12 | |
13 | import QVTRelation.QVTRelationPackage; |
14 | import QVTRelation.Relation; |
15 | import QVTRelation.RelationCallExp; |
16 | |
17 | import java.util.Collection; |
18 | |
19 | import org.eclipse.emf.common.notify.Notification; |
20 | import org.eclipse.emf.common.notify.NotificationChain; |
21 | |
22 | import org.eclipse.emf.common.util.EList; |
23 | |
24 | import org.eclipse.emf.ecore.EClass; |
25 | import org.eclipse.emf.ecore.InternalEObject; |
26 | |
27 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
28 | |
29 | import org.eclipse.emf.ecore.util.EObjectContainmentEList; |
30 | import org.eclipse.emf.ecore.util.InternalEList; |
31 | |
32 | /** |
33 | * <!-- begin-user-doc --> |
34 | * An implementation of the model object '<em><b>Relation Call Exp</b></em>'. |
35 | * <!-- end-user-doc --> |
36 | * <p> |
37 | * The following features are implemented: |
38 | * <ul> |
39 | * <li>{@link QVTRelation.impl.RelationCallExpImpl#getArgument <em>Argument</em>}</li> |
40 | * <li>{@link QVTRelation.impl.RelationCallExpImpl#getReferredRelation <em>Referred Relation</em>}</li> |
41 | * </ul> |
42 | * </p> |
43 | * |
44 | * @generated |
45 | */ |
46 | public class RelationCallExpImpl extends OclExpressionImpl implements RelationCallExp { |
47 | /** |
48 | * The cached value of the '{@link #getArgument() <em>Argument</em>}' containment reference list. |
49 | * <!-- begin-user-doc --> |
50 | * <!-- end-user-doc --> |
51 | * @see #getArgument() |
52 | * @generated |
53 | * @ordered |
54 | */ |
55 | protected EList<OclExpression> argument; |
56 | |
57 | /** |
58 | * The cached value of the '{@link #getReferredRelation() <em>Referred Relation</em>}' reference. |
59 | * <!-- begin-user-doc --> |
60 | * <!-- end-user-doc --> |
61 | * @see #getReferredRelation() |
62 | * @generated |
63 | * @ordered |
64 | */ |
65 | protected Relation referredRelation; |
66 | |
67 | /** |
68 | * <!-- begin-user-doc --> |
69 | * <!-- end-user-doc --> |
70 | * @generated |
71 | */ |
72 | protected RelationCallExpImpl() { |
73 | super(); |
74 | } |
75 | |
76 | /** |
77 | * <!-- begin-user-doc --> |
78 | * <!-- end-user-doc --> |
79 | * @generated |
80 | */ |
81 | @Override |
82 | protected EClass eStaticClass() { |
83 | return QVTRelationPackage.Literals.RELATION_CALL_EXP; |
84 | } |
85 | |
86 | /** |
87 | * <!-- begin-user-doc --> |
88 | * <!-- end-user-doc --> |
89 | * @generated |
90 | */ |
91 | public EList<OclExpression> getArgument() { |
92 | if (argument == null) { |
93 | argument = new EObjectContainmentEList<OclExpression>(OclExpression.class, this, QVTRelationPackage.RELATION_CALL_EXP__ARGUMENT); |
94 | } |
95 | return argument; |
96 | } |
97 | |
98 | /** |
99 | * <!-- begin-user-doc --> |
100 | * <!-- end-user-doc --> |
101 | * @generated |
102 | */ |
103 | public Relation getReferredRelation() { |
104 | if (referredRelation != null && referredRelation.eIsProxy()) { |
105 | InternalEObject oldReferredRelation = (InternalEObject)referredRelation; |
106 | referredRelation = (Relation)eResolveProxy(oldReferredRelation); |
107 | if (referredRelation != oldReferredRelation) { |
108 | if (eNotificationRequired()) |
109 | eNotify(new ENotificationImpl(this, Notification.RESOLVE, QVTRelationPackage.RELATION_CALL_EXP__REFERRED_RELATION, oldReferredRelation, referredRelation)); |
110 | } |
111 | } |
112 | return referredRelation; |
113 | } |
114 | |
115 | /** |
116 | * <!-- begin-user-doc --> |
117 | * <!-- end-user-doc --> |
118 | * @generated |
119 | */ |
120 | public Relation basicGetReferredRelation() { |
121 | return referredRelation; |
122 | } |
123 | |
124 | /** |
125 | * <!-- begin-user-doc --> |
126 | * <!-- end-user-doc --> |
127 | * @generated |
128 | */ |
129 | public void setReferredRelation(Relation newReferredRelation) { |
130 | Relation oldReferredRelation = referredRelation; |
131 | referredRelation = newReferredRelation; |
132 | if (eNotificationRequired()) |
133 | eNotify(new ENotificationImpl(this, Notification.SET, QVTRelationPackage.RELATION_CALL_EXP__REFERRED_RELATION, oldReferredRelation, referredRelation)); |
134 | } |
135 | |
136 | /** |
137 | * <!-- begin-user-doc --> |
138 | * <!-- end-user-doc --> |
139 | * @generated |
140 | */ |
141 | @Override |
142 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
143 | switch (featureID) { |
144 | case QVTRelationPackage.RELATION_CALL_EXP__ARGUMENT: |
145 | return ((InternalEList<?>)getArgument()).basicRemove(otherEnd, msgs); |
146 | } |
147 | return super.eInverseRemove(otherEnd, featureID, msgs); |
148 | } |
149 | |
150 | /** |
151 | * <!-- begin-user-doc --> |
152 | * <!-- end-user-doc --> |
153 | * @generated |
154 | */ |
155 | @Override |
156 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
157 | switch (featureID) { |
158 | case QVTRelationPackage.RELATION_CALL_EXP__ARGUMENT: |
159 | return getArgument(); |
160 | case QVTRelationPackage.RELATION_CALL_EXP__REFERRED_RELATION: |
161 | if (resolve) return getReferredRelation(); |
162 | return basicGetReferredRelation(); |
163 | } |
164 | return super.eGet(featureID, resolve, coreType); |
165 | } |
166 | |
167 | /** |
168 | * <!-- begin-user-doc --> |
169 | * <!-- end-user-doc --> |
170 | * @generated |
171 | */ |
172 | @SuppressWarnings("unchecked") |
173 | @Override |
174 | public void eSet(int featureID, Object newValue) { |
175 | switch (featureID) { |
176 | case QVTRelationPackage.RELATION_CALL_EXP__ARGUMENT: |
177 | getArgument().clear(); |
178 | getArgument().addAll((Collection<? extends OclExpression>)newValue); |
179 | return; |
180 | case QVTRelationPackage.RELATION_CALL_EXP__REFERRED_RELATION: |
181 | setReferredRelation((Relation)newValue); |
182 | return; |
183 | } |
184 | super.eSet(featureID, newValue); |
185 | } |
186 | |
187 | /** |
188 | * <!-- begin-user-doc --> |
189 | * <!-- end-user-doc --> |
190 | * @generated |
191 | */ |
192 | @Override |
193 | public void eUnset(int featureID) { |
194 | switch (featureID) { |
195 | case QVTRelationPackage.RELATION_CALL_EXP__ARGUMENT: |
196 | getArgument().clear(); |
197 | return; |
198 | case QVTRelationPackage.RELATION_CALL_EXP__REFERRED_RELATION: |
199 | setReferredRelation((Relation)null); |
200 | return; |
201 | } |
202 | super.eUnset(featureID); |
203 | } |
204 | |
205 | /** |
206 | * <!-- begin-user-doc --> |
207 | * <!-- end-user-doc --> |
208 | * @generated |
209 | */ |
210 | @Override |
211 | public boolean eIsSet(int featureID) { |
212 | switch (featureID) { |
213 | case QVTRelationPackage.RELATION_CALL_EXP__ARGUMENT: |
214 | return argument != null && !argument.isEmpty(); |
215 | case QVTRelationPackage.RELATION_CALL_EXP__REFERRED_RELATION: |
216 | return referredRelation != null; |
217 | } |
218 | return super.eIsSet(featureID); |
219 | } |
220 | |
221 | } //RelationCallExpImpl |