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