1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.fzi.se.quality.qualityannotation.impl; |
8 | |
9 | import de.fzi.se.quality.qualityannotation.CharacterisedPCMParameterPartition; |
10 | import de.fzi.se.quality.qualityannotation.PCMParameterPartition; |
11 | import de.fzi.se.quality.qualityannotation.QualityAnnotationPackage; |
12 | |
13 | import de.uka.ipd.sdq.identifier.impl.IdentifierImpl; |
14 | |
15 | import de.uka.ipd.sdq.pcm.parameter.VariableCharacterisationType; |
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 | import org.eclipse.emf.ecore.util.EcoreUtil; |
26 | |
27 | /** |
28 | * <!-- begin-user-doc --> |
29 | * An implementation of the model object '<em><b>Characterised PCM Parameter Partition</b></em>'. |
30 | * <!-- end-user-doc --> |
31 | * <p> |
32 | * The following features are implemented: |
33 | * <ul> |
34 | * <li>{@link de.fzi.se.quality.qualityannotation.impl.CharacterisedPCMParameterPartitionImpl#getForCharacterisation <em>For Characterisation</em>}</li> |
35 | * <li>{@link de.fzi.se.quality.qualityannotation.impl.CharacterisedPCMParameterPartitionImpl#getPcmParameterPartition <em>Pcm Parameter Partition</em>}</li> |
36 | * </ul> |
37 | * </p> |
38 | * |
39 | * @generated |
40 | */ |
41 | public abstract class CharacterisedPCMParameterPartitionImpl extends IdentifierImpl implements CharacterisedPCMParameterPartition { |
42 | /** |
43 | * The default value of the '{@link #getForCharacterisation() <em>For Characterisation</em>}' attribute. |
44 | * <!-- begin-user-doc --> |
45 | * <!-- end-user-doc --> |
46 | * @see #getForCharacterisation() |
47 | * @generated |
48 | * @ordered |
49 | */ |
50 | protected static final VariableCharacterisationType FOR_CHARACTERISATION_EDEFAULT = VariableCharacterisationType.STRUCTURE; |
51 | |
52 | /** |
53 | * The cached value of the '{@link #getForCharacterisation() <em>For Characterisation</em>}' attribute. |
54 | * <!-- begin-user-doc --> |
55 | * <!-- end-user-doc --> |
56 | * @see #getForCharacterisation() |
57 | * @generated |
58 | * @ordered |
59 | */ |
60 | protected VariableCharacterisationType forCharacterisation = FOR_CHARACTERISATION_EDEFAULT; |
61 | |
62 | /** |
63 | * <!-- begin-user-doc --> |
64 | * <!-- end-user-doc --> |
65 | * @generated |
66 | */ |
67 | protected CharacterisedPCMParameterPartitionImpl() { |
68 | super(); |
69 | } |
70 | |
71 | /** |
72 | * <!-- begin-user-doc --> |
73 | * <!-- end-user-doc --> |
74 | * @generated |
75 | */ |
76 | @Override |
77 | protected EClass eStaticClass() { |
78 | return QualityAnnotationPackage.Literals.CHARACTERISED_PCM_PARAMETER_PARTITION; |
79 | } |
80 | |
81 | /** |
82 | * <!-- begin-user-doc --> |
83 | * <!-- end-user-doc --> |
84 | * @generated |
85 | */ |
86 | public VariableCharacterisationType getForCharacterisation() { |
87 | return forCharacterisation; |
88 | } |
89 | |
90 | /** |
91 | * <!-- begin-user-doc --> |
92 | * <!-- end-user-doc --> |
93 | * @generated |
94 | */ |
95 | public void setForCharacterisation(VariableCharacterisationType newForCharacterisation) { |
96 | VariableCharacterisationType oldForCharacterisation = forCharacterisation; |
97 | forCharacterisation = newForCharacterisation == null ? FOR_CHARACTERISATION_EDEFAULT : newForCharacterisation; |
98 | if (eNotificationRequired()) |
99 | eNotify(new ENotificationImpl(this, Notification.SET, QualityAnnotationPackage.CHARACTERISED_PCM_PARAMETER_PARTITION__FOR_CHARACTERISATION, oldForCharacterisation, forCharacterisation)); |
100 | } |
101 | |
102 | /** |
103 | * <!-- begin-user-doc --> |
104 | * <!-- end-user-doc --> |
105 | * @generated |
106 | */ |
107 | public PCMParameterPartition getPcmParameterPartition() { |
108 | if (eContainerFeatureID() != QualityAnnotationPackage.CHARACTERISED_PCM_PARAMETER_PARTITION__PCM_PARAMETER_PARTITION) return null; |
109 | return (PCMParameterPartition)eContainer(); |
110 | } |
111 | |
112 | /** |
113 | * <!-- begin-user-doc --> |
114 | * <!-- end-user-doc --> |
115 | * @generated |
116 | */ |
117 | public NotificationChain basicSetPcmParameterPartition(PCMParameterPartition newPcmParameterPartition, NotificationChain msgs) { |
118 | msgs = eBasicSetContainer((InternalEObject)newPcmParameterPartition, QualityAnnotationPackage.CHARACTERISED_PCM_PARAMETER_PARTITION__PCM_PARAMETER_PARTITION, msgs); |
119 | return msgs; |
120 | } |
121 | |
122 | /** |
123 | * <!-- begin-user-doc --> |
124 | * <!-- end-user-doc --> |
125 | * @generated |
126 | */ |
127 | public void setPcmParameterPartition(PCMParameterPartition newPcmParameterPartition) { |
128 | if (newPcmParameterPartition != eInternalContainer() || (eContainerFeatureID() != QualityAnnotationPackage.CHARACTERISED_PCM_PARAMETER_PARTITION__PCM_PARAMETER_PARTITION && newPcmParameterPartition != null)) { |
129 | if (EcoreUtil.isAncestor(this, newPcmParameterPartition)) |
130 | throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); |
131 | NotificationChain msgs = null; |
132 | if (eInternalContainer() != null) |
133 | msgs = eBasicRemoveFromContainer(msgs); |
134 | if (newPcmParameterPartition != null) |
135 | msgs = ((InternalEObject)newPcmParameterPartition).eInverseAdd(this, QualityAnnotationPackage.PCM_PARAMETER_PARTITION__CHARACERISED_PARAMETER_PARTITIONS, PCMParameterPartition.class, msgs); |
136 | msgs = basicSetPcmParameterPartition(newPcmParameterPartition, msgs); |
137 | if (msgs != null) msgs.dispatch(); |
138 | } |
139 | else if (eNotificationRequired()) |
140 | eNotify(new ENotificationImpl(this, Notification.SET, QualityAnnotationPackage.CHARACTERISED_PCM_PARAMETER_PARTITION__PCM_PARAMETER_PARTITION, newPcmParameterPartition, newPcmParameterPartition)); |
141 | } |
142 | |
143 | /** |
144 | * <!-- begin-user-doc --> |
145 | * <!-- end-user-doc --> |
146 | * @generated |
147 | */ |
148 | @Override |
149 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
150 | switch (featureID) { |
151 | case QualityAnnotationPackage.CHARACTERISED_PCM_PARAMETER_PARTITION__PCM_PARAMETER_PARTITION: |
152 | if (eInternalContainer() != null) |
153 | msgs = eBasicRemoveFromContainer(msgs); |
154 | return basicSetPcmParameterPartition((PCMParameterPartition)otherEnd, msgs); |
155 | } |
156 | return super.eInverseAdd(otherEnd, featureID, msgs); |
157 | } |
158 | |
159 | /** |
160 | * <!-- begin-user-doc --> |
161 | * <!-- end-user-doc --> |
162 | * @generated |
163 | */ |
164 | @Override |
165 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
166 | switch (featureID) { |
167 | case QualityAnnotationPackage.CHARACTERISED_PCM_PARAMETER_PARTITION__PCM_PARAMETER_PARTITION: |
168 | return basicSetPcmParameterPartition(null, msgs); |
169 | } |
170 | return super.eInverseRemove(otherEnd, featureID, msgs); |
171 | } |
172 | |
173 | /** |
174 | * <!-- begin-user-doc --> |
175 | * <!-- end-user-doc --> |
176 | * @generated |
177 | */ |
178 | @Override |
179 | public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { |
180 | switch (eContainerFeatureID()) { |
181 | case QualityAnnotationPackage.CHARACTERISED_PCM_PARAMETER_PARTITION__PCM_PARAMETER_PARTITION: |
182 | return eInternalContainer().eInverseRemove(this, QualityAnnotationPackage.PCM_PARAMETER_PARTITION__CHARACERISED_PARAMETER_PARTITIONS, PCMParameterPartition.class, msgs); |
183 | } |
184 | return super.eBasicRemoveFromContainerFeature(msgs); |
185 | } |
186 | |
187 | /** |
188 | * <!-- begin-user-doc --> |
189 | * <!-- end-user-doc --> |
190 | * @generated |
191 | */ |
192 | @Override |
193 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
194 | switch (featureID) { |
195 | case QualityAnnotationPackage.CHARACTERISED_PCM_PARAMETER_PARTITION__FOR_CHARACTERISATION: |
196 | return getForCharacterisation(); |
197 | case QualityAnnotationPackage.CHARACTERISED_PCM_PARAMETER_PARTITION__PCM_PARAMETER_PARTITION: |
198 | return getPcmParameterPartition(); |
199 | } |
200 | return super.eGet(featureID, resolve, coreType); |
201 | } |
202 | |
203 | /** |
204 | * <!-- begin-user-doc --> |
205 | * <!-- end-user-doc --> |
206 | * @generated |
207 | */ |
208 | @Override |
209 | public void eSet(int featureID, Object newValue) { |
210 | switch (featureID) { |
211 | case QualityAnnotationPackage.CHARACTERISED_PCM_PARAMETER_PARTITION__FOR_CHARACTERISATION: |
212 | setForCharacterisation((VariableCharacterisationType)newValue); |
213 | return; |
214 | case QualityAnnotationPackage.CHARACTERISED_PCM_PARAMETER_PARTITION__PCM_PARAMETER_PARTITION: |
215 | setPcmParameterPartition((PCMParameterPartition)newValue); |
216 | return; |
217 | } |
218 | super.eSet(featureID, newValue); |
219 | } |
220 | |
221 | /** |
222 | * <!-- begin-user-doc --> |
223 | * <!-- end-user-doc --> |
224 | * @generated |
225 | */ |
226 | @Override |
227 | public void eUnset(int featureID) { |
228 | switch (featureID) { |
229 | case QualityAnnotationPackage.CHARACTERISED_PCM_PARAMETER_PARTITION__FOR_CHARACTERISATION: |
230 | setForCharacterisation(FOR_CHARACTERISATION_EDEFAULT); |
231 | return; |
232 | case QualityAnnotationPackage.CHARACTERISED_PCM_PARAMETER_PARTITION__PCM_PARAMETER_PARTITION: |
233 | setPcmParameterPartition((PCMParameterPartition)null); |
234 | return; |
235 | } |
236 | super.eUnset(featureID); |
237 | } |
238 | |
239 | /** |
240 | * <!-- begin-user-doc --> |
241 | * <!-- end-user-doc --> |
242 | * @generated |
243 | */ |
244 | @Override |
245 | public boolean eIsSet(int featureID) { |
246 | switch (featureID) { |
247 | case QualityAnnotationPackage.CHARACTERISED_PCM_PARAMETER_PARTITION__FOR_CHARACTERISATION: |
248 | return forCharacterisation != FOR_CHARACTERISATION_EDEFAULT; |
249 | case QualityAnnotationPackage.CHARACTERISED_PCM_PARAMETER_PARTITION__PCM_PARAMETER_PARTITION: |
250 | return getPcmParameterPartition() != null; |
251 | } |
252 | return super.eIsSet(featureID); |
253 | } |
254 | |
255 | /** |
256 | * <!-- begin-user-doc --> |
257 | * <!-- end-user-doc --> |
258 | * @generated |
259 | */ |
260 | @Override |
261 | public String toString() { |
262 | if (eIsProxy()) return super.toString(); |
263 | |
264 | StringBuffer result = new StringBuffer(super.toString()); |
265 | result.append(" (forCharacterisation: "); |
266 | result.append(forCharacterisation); |
267 | result.append(')'); |
268 | return result.toString(); |
269 | } |
270 | |
271 | } //CharacterisedPCMParameterPartitionImpl |