| 1 | /** |
| 2 | * <copyright> |
| 3 | * </copyright> |
| 4 | * |
| 5 | * $Id$ |
| 6 | */ |
| 7 | package de.fzi.se.quality.qualityannotation.impl; |
| 8 | |
| 9 | import de.fzi.se.quality.impl.QualityStatementImpl; |
| 10 | |
| 11 | import de.fzi.se.quality.parameters.ParameterPartition; |
| 12 | import de.fzi.se.quality.parameters.ParametersPackage; |
| 13 | |
| 14 | import de.fzi.se.quality.qualityannotation.InternalStateInfluenceAnalysisAggregation; |
| 15 | import de.fzi.se.quality.qualityannotation.QualityAnnotation; |
| 16 | import de.fzi.se.quality.qualityannotation.QualityAnnotationPackage; |
| 17 | import de.fzi.se.quality.qualityannotation.RequiredElement; |
| 18 | import de.fzi.se.quality.qualityannotation.ServiceSpecification; |
| 19 | |
| 20 | import java.util.Collection; |
| 21 | |
| 22 | import org.eclipse.emf.common.notify.Notification; |
| 23 | import org.eclipse.emf.common.notify.NotificationChain; |
| 24 | |
| 25 | import org.eclipse.emf.common.util.EList; |
| 26 | |
| 27 | import org.eclipse.emf.ecore.EClass; |
| 28 | import org.eclipse.emf.ecore.InternalEObject; |
| 29 | |
| 30 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| 31 | |
| 32 | import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList; |
| 33 | import org.eclipse.emf.ecore.util.InternalEList; |
| 34 | |
| 35 | /** |
| 36 | * <!-- begin-user-doc --> |
| 37 | * An implementation of the model object '<em><b>Quality Annotation</b></em>'. |
| 38 | * <!-- end-user-doc --> |
| 39 | * <p> |
| 40 | * The following features are implemented: |
| 41 | * <ul> |
| 42 | * <li>{@link de.fzi.se.quality.qualityannotation.impl.QualityAnnotationImpl#isValid <em>Is Valid</em>}</li> |
| 43 | * <li>{@link de.fzi.se.quality.qualityannotation.impl.QualityAnnotationImpl#getForServiceSpecification <em>For Service Specification</em>}</li> |
| 44 | * <li>{@link de.fzi.se.quality.qualityannotation.impl.QualityAnnotationImpl#getStipulatedREPrecisions <em>Stipulated RE Precisions</em>}</li> |
| 45 | * <li>{@link de.fzi.se.quality.qualityannotation.impl.QualityAnnotationImpl#getInternalStateInfluenceAnalysisResult <em>Internal State Influence Analysis Result</em>}</li> |
| 46 | * <li>{@link de.fzi.se.quality.qualityannotation.impl.QualityAnnotationImpl#getValidForParameterPartitions <em>Valid For Parameter Partitions</em>}</li> |
| 47 | * </ul> |
| 48 | * </p> |
| 49 | * |
| 50 | * @generated |
| 51 | */ |
| 52 | public class QualityAnnotationImpl extends QualityStatementImpl implements QualityAnnotation { |
| 53 | /** |
| 54 | * The default value of the '{@link #isValid() <em>Is Valid</em>}' attribute. |
| 55 | * <!-- begin-user-doc --> |
| 56 | * <!-- end-user-doc --> |
| 57 | * @see #isValid() |
| 58 | * @generated |
| 59 | * @ordered |
| 60 | */ |
| 61 | protected static final boolean IS_VALID_EDEFAULT = false; |
| 62 | |
| 63 | /** |
| 64 | * The cached value of the '{@link #isValid() <em>Is Valid</em>}' attribute. |
| 65 | * <!-- begin-user-doc --> |
| 66 | * <!-- end-user-doc --> |
| 67 | * @see #isValid() |
| 68 | * @generated |
| 69 | * @ordered |
| 70 | */ |
| 71 | protected boolean isValid = IS_VALID_EDEFAULT; |
| 72 | |
| 73 | /** |
| 74 | * The cached value of the '{@link #getForServiceSpecification() <em>For Service Specification</em>}' containment reference. |
| 75 | * <!-- begin-user-doc --> |
| 76 | * <!-- end-user-doc --> |
| 77 | * @see #getForServiceSpecification() |
| 78 | * @generated |
| 79 | * @ordered |
| 80 | */ |
| 81 | protected ServiceSpecification forServiceSpecification; |
| 82 | |
| 83 | /** |
| 84 | * The cached value of the '{@link #getStipulatedREPrecisions() <em>Stipulated RE Precisions</em>}' containment reference list. |
| 85 | * <!-- begin-user-doc --> |
| 86 | * <!-- end-user-doc --> |
| 87 | * @see #getStipulatedREPrecisions() |
| 88 | * @generated |
| 89 | * @ordered |
| 90 | */ |
| 91 | protected EList<RequiredElement> stipulatedREPrecisions; |
| 92 | |
| 93 | /** |
| 94 | * The cached value of the '{@link #getInternalStateInfluenceAnalysisResult() <em>Internal State Influence Analysis Result</em>}' containment reference list. |
| 95 | * <!-- begin-user-doc --> |
| 96 | * <!-- end-user-doc --> |
| 97 | * @see #getInternalStateInfluenceAnalysisResult() |
| 98 | * @generated |
| 99 | * @ordered |
| 100 | */ |
| 101 | protected EList<InternalStateInfluenceAnalysisAggregation> internalStateInfluenceAnalysisResult; |
| 102 | |
| 103 | /** |
| 104 | * The cached value of the '{@link #getValidForParameterPartitions() <em>Valid For Parameter Partitions</em>}' containment reference list. |
| 105 | * <!-- begin-user-doc --> |
| 106 | * <!-- end-user-doc --> |
| 107 | * @see #getValidForParameterPartitions() |
| 108 | * @generated |
| 109 | * @ordered |
| 110 | */ |
| 111 | protected EList<ParameterPartition> validForParameterPartitions; |
| 112 | |
| 113 | /** |
| 114 | * <!-- begin-user-doc --> |
| 115 | * <!-- end-user-doc --> |
| 116 | * @generated |
| 117 | */ |
| 118 | protected QualityAnnotationImpl() { |
| 119 | super(); |
| 120 | } |
| 121 | |
| 122 | /** |
| 123 | * <!-- begin-user-doc --> |
| 124 | * <!-- end-user-doc --> |
| 125 | * @generated |
| 126 | */ |
| 127 | @Override |
| 128 | protected EClass eStaticClass() { |
| 129 | return QualityAnnotationPackage.Literals.QUALITY_ANNOTATION; |
| 130 | } |
| 131 | |
| 132 | /** |
| 133 | * <!-- begin-user-doc --> |
| 134 | * <!-- end-user-doc --> |
| 135 | * @generated |
| 136 | */ |
| 137 | public boolean isValid() { |
| 138 | return isValid; |
| 139 | } |
| 140 | |
| 141 | /** |
| 142 | * <!-- begin-user-doc --> |
| 143 | * <!-- end-user-doc --> |
| 144 | * @generated |
| 145 | */ |
| 146 | public void setIsValid(boolean newIsValid) { |
| 147 | boolean oldIsValid = isValid; |
| 148 | isValid = newIsValid; |
| 149 | if (eNotificationRequired()) |
| 150 | eNotify(new ENotificationImpl(this, Notification.SET, QualityAnnotationPackage.QUALITY_ANNOTATION__IS_VALID, oldIsValid, isValid)); |
| 151 | } |
| 152 | |
| 153 | /** |
| 154 | * <!-- begin-user-doc --> |
| 155 | * <!-- end-user-doc --> |
| 156 | * @generated |
| 157 | */ |
| 158 | public ServiceSpecification getForServiceSpecification() { |
| 159 | return forServiceSpecification; |
| 160 | } |
| 161 | |
| 162 | /** |
| 163 | * <!-- begin-user-doc --> |
| 164 | * <!-- end-user-doc --> |
| 165 | * @generated |
| 166 | */ |
| 167 | public NotificationChain basicSetForServiceSpecification(ServiceSpecification newForServiceSpecification, NotificationChain msgs) { |
| 168 | ServiceSpecification oldForServiceSpecification = forServiceSpecification; |
| 169 | forServiceSpecification = newForServiceSpecification; |
| 170 | if (eNotificationRequired()) { |
| 171 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, QualityAnnotationPackage.QUALITY_ANNOTATION__FOR_SERVICE_SPECIFICATION, oldForServiceSpecification, newForServiceSpecification); |
| 172 | if (msgs == null) msgs = notification; else msgs.add(notification); |
| 173 | } |
| 174 | return msgs; |
| 175 | } |
| 176 | |
| 177 | /** |
| 178 | * <!-- begin-user-doc --> |
| 179 | * <!-- end-user-doc --> |
| 180 | * @generated |
| 181 | */ |
| 182 | public void setForServiceSpecification(ServiceSpecification newForServiceSpecification) { |
| 183 | if (newForServiceSpecification != forServiceSpecification) { |
| 184 | NotificationChain msgs = null; |
| 185 | if (forServiceSpecification != null) |
| 186 | msgs = ((InternalEObject)forServiceSpecification).eInverseRemove(this, QualityAnnotationPackage.SERVICE_SPECIFICATION__QUALITY_ANNOTATION, ServiceSpecification.class, msgs); |
| 187 | if (newForServiceSpecification != null) |
| 188 | msgs = ((InternalEObject)newForServiceSpecification).eInverseAdd(this, QualityAnnotationPackage.SERVICE_SPECIFICATION__QUALITY_ANNOTATION, ServiceSpecification.class, msgs); |
| 189 | msgs = basicSetForServiceSpecification(newForServiceSpecification, msgs); |
| 190 | if (msgs != null) msgs.dispatch(); |
| 191 | } |
| 192 | else if (eNotificationRequired()) |
| 193 | eNotify(new ENotificationImpl(this, Notification.SET, QualityAnnotationPackage.QUALITY_ANNOTATION__FOR_SERVICE_SPECIFICATION, newForServiceSpecification, newForServiceSpecification)); |
| 194 | } |
| 195 | |
| 196 | /** |
| 197 | * <!-- begin-user-doc --> |
| 198 | * <!-- end-user-doc --> |
| 199 | * @generated |
| 200 | */ |
| 201 | public EList<RequiredElement> getStipulatedREPrecisions() { |
| 202 | if (stipulatedREPrecisions == null) { |
| 203 | stipulatedREPrecisions = new EObjectContainmentWithInverseEList<RequiredElement>(RequiredElement.class, this, QualityAnnotationPackage.QUALITY_ANNOTATION__STIPULATED_RE_PRECISIONS, QualityAnnotationPackage.REQUIRED_ELEMENT__QUALITY_ANNOTATION); |
| 204 | } |
| 205 | return stipulatedREPrecisions; |
| 206 | } |
| 207 | |
| 208 | /** |
| 209 | * <!-- begin-user-doc --> |
| 210 | * <!-- end-user-doc --> |
| 211 | * @generated |
| 212 | */ |
| 213 | public EList<InternalStateInfluenceAnalysisAggregation> getInternalStateInfluenceAnalysisResult() { |
| 214 | if (internalStateInfluenceAnalysisResult == null) { |
| 215 | internalStateInfluenceAnalysisResult = new EObjectContainmentWithInverseEList<InternalStateInfluenceAnalysisAggregation>(InternalStateInfluenceAnalysisAggregation.class, this, QualityAnnotationPackage.QUALITY_ANNOTATION__INTERNAL_STATE_INFLUENCE_ANALYSIS_RESULT, QualityAnnotationPackage.INTERNAL_STATE_INFLUENCE_ANALYSIS_AGGREGATION__QUALITY_ANNOTATION); |
| 216 | } |
| 217 | return internalStateInfluenceAnalysisResult; |
| 218 | } |
| 219 | |
| 220 | /** |
| 221 | * <!-- begin-user-doc --> |
| 222 | * <!-- end-user-doc --> |
| 223 | * @generated |
| 224 | */ |
| 225 | public EList<ParameterPartition> getValidForParameterPartitions() { |
| 226 | if (validForParameterPartitions == null) { |
| 227 | validForParameterPartitions = new EObjectContainmentWithInverseEList<ParameterPartition>(ParameterPartition.class, this, QualityAnnotationPackage.QUALITY_ANNOTATION__VALID_FOR_PARAMETER_PARTITIONS, ParametersPackage.PARAMETER_PARTITION__VALIDATED_SETTING); |
| 228 | } |
| 229 | return validForParameterPartitions; |
| 230 | } |
| 231 | |
| 232 | /** |
| 233 | * <!-- begin-user-doc --> |
| 234 | * <!-- end-user-doc --> |
| 235 | * @generated |
| 236 | */ |
| 237 | @SuppressWarnings("unchecked") |
| 238 | @Override |
| 239 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| 240 | switch (featureID) { |
| 241 | case QualityAnnotationPackage.QUALITY_ANNOTATION__FOR_SERVICE_SPECIFICATION: |
| 242 | if (forServiceSpecification != null) |
| 243 | msgs = ((InternalEObject)forServiceSpecification).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - QualityAnnotationPackage.QUALITY_ANNOTATION__FOR_SERVICE_SPECIFICATION, null, msgs); |
| 244 | return basicSetForServiceSpecification((ServiceSpecification)otherEnd, msgs); |
| 245 | case QualityAnnotationPackage.QUALITY_ANNOTATION__STIPULATED_RE_PRECISIONS: |
| 246 | return ((InternalEList<InternalEObject>)(InternalEList<?>)getStipulatedREPrecisions()).basicAdd(otherEnd, msgs); |
| 247 | case QualityAnnotationPackage.QUALITY_ANNOTATION__INTERNAL_STATE_INFLUENCE_ANALYSIS_RESULT: |
| 248 | return ((InternalEList<InternalEObject>)(InternalEList<?>)getInternalStateInfluenceAnalysisResult()).basicAdd(otherEnd, msgs); |
| 249 | case QualityAnnotationPackage.QUALITY_ANNOTATION__VALID_FOR_PARAMETER_PARTITIONS: |
| 250 | return ((InternalEList<InternalEObject>)(InternalEList<?>)getValidForParameterPartitions()).basicAdd(otherEnd, msgs); |
| 251 | } |
| 252 | return super.eInverseAdd(otherEnd, featureID, msgs); |
| 253 | } |
| 254 | |
| 255 | /** |
| 256 | * <!-- begin-user-doc --> |
| 257 | * <!-- end-user-doc --> |
| 258 | * @generated |
| 259 | */ |
| 260 | @Override |
| 261 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| 262 | switch (featureID) { |
| 263 | case QualityAnnotationPackage.QUALITY_ANNOTATION__FOR_SERVICE_SPECIFICATION: |
| 264 | return basicSetForServiceSpecification(null, msgs); |
| 265 | case QualityAnnotationPackage.QUALITY_ANNOTATION__STIPULATED_RE_PRECISIONS: |
| 266 | return ((InternalEList<?>)getStipulatedREPrecisions()).basicRemove(otherEnd, msgs); |
| 267 | case QualityAnnotationPackage.QUALITY_ANNOTATION__INTERNAL_STATE_INFLUENCE_ANALYSIS_RESULT: |
| 268 | return ((InternalEList<?>)getInternalStateInfluenceAnalysisResult()).basicRemove(otherEnd, msgs); |
| 269 | case QualityAnnotationPackage.QUALITY_ANNOTATION__VALID_FOR_PARAMETER_PARTITIONS: |
| 270 | return ((InternalEList<?>)getValidForParameterPartitions()).basicRemove(otherEnd, msgs); |
| 271 | } |
| 272 | return super.eInverseRemove(otherEnd, featureID, msgs); |
| 273 | } |
| 274 | |
| 275 | /** |
| 276 | * <!-- begin-user-doc --> |
| 277 | * <!-- end-user-doc --> |
| 278 | * @generated |
| 279 | */ |
| 280 | @Override |
| 281 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| 282 | switch (featureID) { |
| 283 | case QualityAnnotationPackage.QUALITY_ANNOTATION__IS_VALID: |
| 284 | return isValid(); |
| 285 | case QualityAnnotationPackage.QUALITY_ANNOTATION__FOR_SERVICE_SPECIFICATION: |
| 286 | return getForServiceSpecification(); |
| 287 | case QualityAnnotationPackage.QUALITY_ANNOTATION__STIPULATED_RE_PRECISIONS: |
| 288 | return getStipulatedREPrecisions(); |
| 289 | case QualityAnnotationPackage.QUALITY_ANNOTATION__INTERNAL_STATE_INFLUENCE_ANALYSIS_RESULT: |
| 290 | return getInternalStateInfluenceAnalysisResult(); |
| 291 | case QualityAnnotationPackage.QUALITY_ANNOTATION__VALID_FOR_PARAMETER_PARTITIONS: |
| 292 | return getValidForParameterPartitions(); |
| 293 | } |
| 294 | return super.eGet(featureID, resolve, coreType); |
| 295 | } |
| 296 | |
| 297 | /** |
| 298 | * <!-- begin-user-doc --> |
| 299 | * <!-- end-user-doc --> |
| 300 | * @generated |
| 301 | */ |
| 302 | @SuppressWarnings("unchecked") |
| 303 | @Override |
| 304 | public void eSet(int featureID, Object newValue) { |
| 305 | switch (featureID) { |
| 306 | case QualityAnnotationPackage.QUALITY_ANNOTATION__IS_VALID: |
| 307 | setIsValid((Boolean)newValue); |
| 308 | return; |
| 309 | case QualityAnnotationPackage.QUALITY_ANNOTATION__FOR_SERVICE_SPECIFICATION: |
| 310 | setForServiceSpecification((ServiceSpecification)newValue); |
| 311 | return; |
| 312 | case QualityAnnotationPackage.QUALITY_ANNOTATION__STIPULATED_RE_PRECISIONS: |
| 313 | getStipulatedREPrecisions().clear(); |
| 314 | getStipulatedREPrecisions().addAll((Collection<? extends RequiredElement>)newValue); |
| 315 | return; |
| 316 | case QualityAnnotationPackage.QUALITY_ANNOTATION__INTERNAL_STATE_INFLUENCE_ANALYSIS_RESULT: |
| 317 | getInternalStateInfluenceAnalysisResult().clear(); |
| 318 | getInternalStateInfluenceAnalysisResult().addAll((Collection<? extends InternalStateInfluenceAnalysisAggregation>)newValue); |
| 319 | return; |
| 320 | case QualityAnnotationPackage.QUALITY_ANNOTATION__VALID_FOR_PARAMETER_PARTITIONS: |
| 321 | getValidForParameterPartitions().clear(); |
| 322 | getValidForParameterPartitions().addAll((Collection<? extends ParameterPartition>)newValue); |
| 323 | return; |
| 324 | } |
| 325 | super.eSet(featureID, newValue); |
| 326 | } |
| 327 | |
| 328 | /** |
| 329 | * <!-- begin-user-doc --> |
| 330 | * <!-- end-user-doc --> |
| 331 | * @generated |
| 332 | */ |
| 333 | @Override |
| 334 | public void eUnset(int featureID) { |
| 335 | switch (featureID) { |
| 336 | case QualityAnnotationPackage.QUALITY_ANNOTATION__IS_VALID: |
| 337 | setIsValid(IS_VALID_EDEFAULT); |
| 338 | return; |
| 339 | case QualityAnnotationPackage.QUALITY_ANNOTATION__FOR_SERVICE_SPECIFICATION: |
| 340 | setForServiceSpecification((ServiceSpecification)null); |
| 341 | return; |
| 342 | case QualityAnnotationPackage.QUALITY_ANNOTATION__STIPULATED_RE_PRECISIONS: |
| 343 | getStipulatedREPrecisions().clear(); |
| 344 | return; |
| 345 | case QualityAnnotationPackage.QUALITY_ANNOTATION__INTERNAL_STATE_INFLUENCE_ANALYSIS_RESULT: |
| 346 | getInternalStateInfluenceAnalysisResult().clear(); |
| 347 | return; |
| 348 | case QualityAnnotationPackage.QUALITY_ANNOTATION__VALID_FOR_PARAMETER_PARTITIONS: |
| 349 | getValidForParameterPartitions().clear(); |
| 350 | return; |
| 351 | } |
| 352 | super.eUnset(featureID); |
| 353 | } |
| 354 | |
| 355 | /** |
| 356 | * <!-- begin-user-doc --> |
| 357 | * <!-- end-user-doc --> |
| 358 | * @generated |
| 359 | */ |
| 360 | @Override |
| 361 | public boolean eIsSet(int featureID) { |
| 362 | switch (featureID) { |
| 363 | case QualityAnnotationPackage.QUALITY_ANNOTATION__IS_VALID: |
| 364 | return isValid != IS_VALID_EDEFAULT; |
| 365 | case QualityAnnotationPackage.QUALITY_ANNOTATION__FOR_SERVICE_SPECIFICATION: |
| 366 | return forServiceSpecification != null; |
| 367 | case QualityAnnotationPackage.QUALITY_ANNOTATION__STIPULATED_RE_PRECISIONS: |
| 368 | return stipulatedREPrecisions != null && !stipulatedREPrecisions.isEmpty(); |
| 369 | case QualityAnnotationPackage.QUALITY_ANNOTATION__INTERNAL_STATE_INFLUENCE_ANALYSIS_RESULT: |
| 370 | return internalStateInfluenceAnalysisResult != null && !internalStateInfluenceAnalysisResult.isEmpty(); |
| 371 | case QualityAnnotationPackage.QUALITY_ANNOTATION__VALID_FOR_PARAMETER_PARTITIONS: |
| 372 | return validForParameterPartitions != null && !validForParameterPartitions.isEmpty(); |
| 373 | } |
| 374 | return super.eIsSet(featureID); |
| 375 | } |
| 376 | |
| 377 | /** |
| 378 | * <!-- begin-user-doc --> |
| 379 | * <!-- end-user-doc --> |
| 380 | * @generated |
| 381 | */ |
| 382 | @Override |
| 383 | public String toString() { |
| 384 | if (eIsProxy()) return super.toString(); |
| 385 | |
| 386 | StringBuffer result = new StringBuffer(super.toString()); |
| 387 | result.append(" (isValid: "); |
| 388 | result.append(isValid); |
| 389 | result.append(')'); |
| 390 | return result.toString(); |
| 391 | } |
| 392 | |
| 393 | } //QualityAnnotationImpl |