1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.fzi.se.quality.qualityannotation.impl; |
8 | |
9 | import de.fzi.se.quality.parameters.impl.ParameterPartitionImpl; |
10 | |
11 | import de.fzi.se.quality.parameters.pcm.PCMPackage; |
12 | import de.fzi.se.quality.parameters.pcm.PCMParameterReference; |
13 | |
14 | import de.fzi.se.quality.qualityannotation.CharacterisedPCMParameterPartition; |
15 | import de.fzi.se.quality.qualityannotation.PCMParameterPartition; |
16 | import de.fzi.se.quality.qualityannotation.QualityAnnotationPackage; |
17 | |
18 | import java.util.Collection; |
19 | |
20 | import org.eclipse.emf.common.notify.Notification; |
21 | import org.eclipse.emf.common.notify.NotificationChain; |
22 | |
23 | import org.eclipse.emf.common.util.EList; |
24 | |
25 | import org.eclipse.emf.ecore.EClass; |
26 | import org.eclipse.emf.ecore.InternalEObject; |
27 | |
28 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
29 | |
30 | import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList; |
31 | import org.eclipse.emf.ecore.util.InternalEList; |
32 | |
33 | /** |
34 | * <!-- begin-user-doc --> |
35 | * An implementation of the model object '<em><b>PCM Parameter Partition</b></em>'. |
36 | * <!-- end-user-doc --> |
37 | * <p> |
38 | * The following features are implemented: |
39 | * <ul> |
40 | * <li>{@link de.fzi.se.quality.qualityannotation.impl.PCMParameterPartitionImpl#getCharacerisedParameterPartitions <em>Characerised Parameter Partitions</em>}</li> |
41 | * <li>{@link de.fzi.se.quality.qualityannotation.impl.PCMParameterPartitionImpl#getParameterReference <em>Parameter Reference</em>}</li> |
42 | * </ul> |
43 | * </p> |
44 | * |
45 | * @generated |
46 | */ |
47 | public class PCMParameterPartitionImpl extends ParameterPartitionImpl implements PCMParameterPartition { |
48 | /** |
49 | * The cached value of the '{@link #getCharacerisedParameterPartitions() <em>Characerised Parameter Partitions</em>}' containment reference list. |
50 | * <!-- begin-user-doc --> |
51 | * <!-- end-user-doc --> |
52 | * @see #getCharacerisedParameterPartitions() |
53 | * @generated |
54 | * @ordered |
55 | */ |
56 | protected EList<CharacterisedPCMParameterPartition> characerisedParameterPartitions; |
57 | |
58 | /** |
59 | * The cached value of the '{@link #getParameterReference() <em>Parameter Reference</em>}' containment reference. |
60 | * <!-- begin-user-doc --> |
61 | * <!-- end-user-doc --> |
62 | * @see #getParameterReference() |
63 | * @generated |
64 | * @ordered |
65 | */ |
66 | protected PCMParameterReference parameterReference; |
67 | |
68 | /** |
69 | * <!-- begin-user-doc --> |
70 | * <!-- end-user-doc --> |
71 | * @generated |
72 | */ |
73 | protected PCMParameterPartitionImpl() { |
74 | super(); |
75 | } |
76 | |
77 | /** |
78 | * <!-- begin-user-doc --> |
79 | * <!-- end-user-doc --> |
80 | * @generated |
81 | */ |
82 | @Override |
83 | protected EClass eStaticClass() { |
84 | return QualityAnnotationPackage.Literals.PCM_PARAMETER_PARTITION; |
85 | } |
86 | |
87 | /** |
88 | * <!-- begin-user-doc --> |
89 | * <!-- end-user-doc --> |
90 | * @generated |
91 | */ |
92 | public EList<CharacterisedPCMParameterPartition> getCharacerisedParameterPartitions() { |
93 | if (characerisedParameterPartitions == null) { |
94 | characerisedParameterPartitions = new EObjectContainmentWithInverseEList<CharacterisedPCMParameterPartition>(CharacterisedPCMParameterPartition.class, this, QualityAnnotationPackage.PCM_PARAMETER_PARTITION__CHARACERISED_PARAMETER_PARTITIONS, QualityAnnotationPackage.CHARACTERISED_PCM_PARAMETER_PARTITION__PCM_PARAMETER_PARTITION); |
95 | } |
96 | return characerisedParameterPartitions; |
97 | } |
98 | |
99 | /** |
100 | * <!-- begin-user-doc --> |
101 | * <!-- end-user-doc --> |
102 | * @generated |
103 | */ |
104 | public PCMParameterReference getParameterReference() { |
105 | return parameterReference; |
106 | } |
107 | |
108 | /** |
109 | * <!-- begin-user-doc --> |
110 | * <!-- end-user-doc --> |
111 | * @generated |
112 | */ |
113 | public NotificationChain basicSetParameterReference(PCMParameterReference newParameterReference, NotificationChain msgs) { |
114 | PCMParameterReference oldParameterReference = parameterReference; |
115 | parameterReference = newParameterReference; |
116 | if (eNotificationRequired()) { |
117 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, QualityAnnotationPackage.PCM_PARAMETER_PARTITION__PARAMETER_REFERENCE, oldParameterReference, newParameterReference); |
118 | if (msgs == null) msgs = notification; else msgs.add(notification); |
119 | } |
120 | return msgs; |
121 | } |
122 | |
123 | /** |
124 | * <!-- begin-user-doc --> |
125 | * <!-- end-user-doc --> |
126 | * @generated |
127 | */ |
128 | public void setParameterReference(PCMParameterReference newParameterReference) { |
129 | if (newParameterReference != parameterReference) { |
130 | NotificationChain msgs = null; |
131 | if (parameterReference != null) |
132 | msgs = ((InternalEObject)parameterReference).eInverseRemove(this, PCMPackage.PCM_PARAMETER_REFERENCE__PARAMETER_PARTITION, PCMParameterReference.class, msgs); |
133 | if (newParameterReference != null) |
134 | msgs = ((InternalEObject)newParameterReference).eInverseAdd(this, PCMPackage.PCM_PARAMETER_REFERENCE__PARAMETER_PARTITION, PCMParameterReference.class, msgs); |
135 | msgs = basicSetParameterReference(newParameterReference, msgs); |
136 | if (msgs != null) msgs.dispatch(); |
137 | } |
138 | else if (eNotificationRequired()) |
139 | eNotify(new ENotificationImpl(this, Notification.SET, QualityAnnotationPackage.PCM_PARAMETER_PARTITION__PARAMETER_REFERENCE, newParameterReference, newParameterReference)); |
140 | } |
141 | |
142 | /** |
143 | * <!-- begin-user-doc --> |
144 | * <!-- end-user-doc --> |
145 | * @generated |
146 | */ |
147 | @SuppressWarnings("unchecked") |
148 | @Override |
149 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
150 | switch (featureID) { |
151 | case QualityAnnotationPackage.PCM_PARAMETER_PARTITION__CHARACERISED_PARAMETER_PARTITIONS: |
152 | return ((InternalEList<InternalEObject>)(InternalEList<?>)getCharacerisedParameterPartitions()).basicAdd(otherEnd, msgs); |
153 | case QualityAnnotationPackage.PCM_PARAMETER_PARTITION__PARAMETER_REFERENCE: |
154 | if (parameterReference != null) |
155 | msgs = ((InternalEObject)parameterReference).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - QualityAnnotationPackage.PCM_PARAMETER_PARTITION__PARAMETER_REFERENCE, null, msgs); |
156 | return basicSetParameterReference((PCMParameterReference)otherEnd, msgs); |
157 | } |
158 | return super.eInverseAdd(otherEnd, featureID, msgs); |
159 | } |
160 | |
161 | /** |
162 | * <!-- begin-user-doc --> |
163 | * <!-- end-user-doc --> |
164 | * @generated |
165 | */ |
166 | @Override |
167 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
168 | switch (featureID) { |
169 | case QualityAnnotationPackage.PCM_PARAMETER_PARTITION__CHARACERISED_PARAMETER_PARTITIONS: |
170 | return ((InternalEList<?>)getCharacerisedParameterPartitions()).basicRemove(otherEnd, msgs); |
171 | case QualityAnnotationPackage.PCM_PARAMETER_PARTITION__PARAMETER_REFERENCE: |
172 | return basicSetParameterReference(null, msgs); |
173 | } |
174 | return super.eInverseRemove(otherEnd, featureID, msgs); |
175 | } |
176 | |
177 | /** |
178 | * <!-- begin-user-doc --> |
179 | * <!-- end-user-doc --> |
180 | * @generated |
181 | */ |
182 | @Override |
183 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
184 | switch (featureID) { |
185 | case QualityAnnotationPackage.PCM_PARAMETER_PARTITION__CHARACERISED_PARAMETER_PARTITIONS: |
186 | return getCharacerisedParameterPartitions(); |
187 | case QualityAnnotationPackage.PCM_PARAMETER_PARTITION__PARAMETER_REFERENCE: |
188 | return getParameterReference(); |
189 | } |
190 | return super.eGet(featureID, resolve, coreType); |
191 | } |
192 | |
193 | /** |
194 | * <!-- begin-user-doc --> |
195 | * <!-- end-user-doc --> |
196 | * @generated |
197 | */ |
198 | @SuppressWarnings("unchecked") |
199 | @Override |
200 | public void eSet(int featureID, Object newValue) { |
201 | switch (featureID) { |
202 | case QualityAnnotationPackage.PCM_PARAMETER_PARTITION__CHARACERISED_PARAMETER_PARTITIONS: |
203 | getCharacerisedParameterPartitions().clear(); |
204 | getCharacerisedParameterPartitions().addAll((Collection<? extends CharacterisedPCMParameterPartition>)newValue); |
205 | return; |
206 | case QualityAnnotationPackage.PCM_PARAMETER_PARTITION__PARAMETER_REFERENCE: |
207 | setParameterReference((PCMParameterReference)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 QualityAnnotationPackage.PCM_PARAMETER_PARTITION__CHARACERISED_PARAMETER_PARTITIONS: |
222 | getCharacerisedParameterPartitions().clear(); |
223 | return; |
224 | case QualityAnnotationPackage.PCM_PARAMETER_PARTITION__PARAMETER_REFERENCE: |
225 | setParameterReference((PCMParameterReference)null); |
226 | return; |
227 | } |
228 | super.eUnset(featureID); |
229 | } |
230 | |
231 | /** |
232 | * <!-- begin-user-doc --> |
233 | * <!-- end-user-doc --> |
234 | * @generated |
235 | */ |
236 | @Override |
237 | public boolean eIsSet(int featureID) { |
238 | switch (featureID) { |
239 | case QualityAnnotationPackage.PCM_PARAMETER_PARTITION__CHARACERISED_PARAMETER_PARTITIONS: |
240 | return characerisedParameterPartitions != null && !characerisedParameterPartitions.isEmpty(); |
241 | case QualityAnnotationPackage.PCM_PARAMETER_PARTITION__PARAMETER_REFERENCE: |
242 | return parameterReference != null; |
243 | } |
244 | return super.eIsSet(featureID); |
245 | } |
246 | |
247 | } //PCMParameterPartitionImpl |