| 1 | /** |
| 2 | * <copyright> |
| 3 | * </copyright> |
| 4 | * |
| 5 | * $Id$ |
| 6 | */ |
| 7 | package de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.impl; |
| 8 | |
| 9 | import de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.AspectRequirement; |
| 10 | import de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.EvaluationAspect; |
| 11 | import de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.QMLContractPackage; |
| 12 | |
| 13 | import de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.util.QMLContractValidator; |
| 14 | |
| 15 | import de.uka.ipd.sdq.identifier.impl.IdentifierImpl; |
| 16 | |
| 17 | import java.util.Map; |
| 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.BasicDiagnostic; |
| 23 | import org.eclipse.emf.common.util.Diagnostic; |
| 24 | import org.eclipse.emf.common.util.DiagnosticChain; |
| 25 | |
| 26 | import org.eclipse.emf.ecore.EClass; |
| 27 | import org.eclipse.emf.ecore.InternalEObject; |
| 28 | |
| 29 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| 30 | |
| 31 | import org.eclipse.emf.ecore.plugin.EcorePlugin; |
| 32 | |
| 33 | import org.eclipse.emf.ecore.util.EObjectValidator; |
| 34 | |
| 35 | import org.eclipse.ocl.ParserException; |
| 36 | |
| 37 | import org.eclipse.ocl.ecore.Constraint; |
| 38 | import org.eclipse.ocl.ecore.OCL; |
| 39 | |
| 40 | /** |
| 41 | * <!-- begin-user-doc --> |
| 42 | * An implementation of the model object '<em><b>Evaluation Aspect</b></em>'. |
| 43 | * <!-- end-user-doc --> |
| 44 | * <p> |
| 45 | * The following features are implemented: |
| 46 | * <ul> |
| 47 | * <li>{@link de.uka.ipd.sdq.dsexplore.qml.contract.QMLContract.impl.EvaluationAspectImpl#getAspectRequirement <em>Aspect Requirement</em>}</li> |
| 48 | * </ul> |
| 49 | * </p> |
| 50 | * |
| 51 | * @generated |
| 52 | */ |
| 53 | public abstract class EvaluationAspectImpl extends IdentifierImpl implements EvaluationAspect { |
| 54 | /** |
| 55 | * The cached value of the '{@link #getAspectRequirement() <em>Aspect Requirement</em>}' containment reference. |
| 56 | * <!-- begin-user-doc --> |
| 57 | * <!-- end-user-doc --> |
| 58 | * @see #getAspectRequirement() |
| 59 | * @generated |
| 60 | * @ordered |
| 61 | */ |
| 62 | protected AspectRequirement aspectRequirement; |
| 63 | |
| 64 | /** |
| 65 | * <!-- begin-user-doc --> |
| 66 | * <!-- end-user-doc --> |
| 67 | * @generated |
| 68 | */ |
| 69 | protected EvaluationAspectImpl() { |
| 70 | super(); |
| 71 | } |
| 72 | |
| 73 | /** |
| 74 | * <!-- begin-user-doc --> |
| 75 | * <!-- end-user-doc --> |
| 76 | * @generated |
| 77 | */ |
| 78 | @Override |
| 79 | protected EClass eStaticClass() { |
| 80 | return QMLContractPackage.Literals.EVALUATION_ASPECT; |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * <!-- begin-user-doc --> |
| 85 | * <!-- end-user-doc --> |
| 86 | * @generated |
| 87 | */ |
| 88 | public AspectRequirement getAspectRequirement() { |
| 89 | return aspectRequirement; |
| 90 | } |
| 91 | |
| 92 | /** |
| 93 | * <!-- begin-user-doc --> |
| 94 | * <!-- end-user-doc --> |
| 95 | * @generated |
| 96 | */ |
| 97 | public NotificationChain basicSetAspectRequirement(AspectRequirement newAspectRequirement, NotificationChain msgs) { |
| 98 | AspectRequirement oldAspectRequirement = aspectRequirement; |
| 99 | aspectRequirement = newAspectRequirement; |
| 100 | if (eNotificationRequired()) { |
| 101 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, QMLContractPackage.EVALUATION_ASPECT__ASPECT_REQUIREMENT, oldAspectRequirement, newAspectRequirement); |
| 102 | if (msgs == null) msgs = notification; else msgs.add(notification); |
| 103 | } |
| 104 | return msgs; |
| 105 | } |
| 106 | |
| 107 | /** |
| 108 | * <!-- begin-user-doc --> |
| 109 | * <!-- end-user-doc --> |
| 110 | * @generated |
| 111 | */ |
| 112 | public void setAspectRequirement(AspectRequirement newAspectRequirement) { |
| 113 | if (newAspectRequirement != aspectRequirement) { |
| 114 | NotificationChain msgs = null; |
| 115 | if (aspectRequirement != null) |
| 116 | msgs = ((InternalEObject)aspectRequirement).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - QMLContractPackage.EVALUATION_ASPECT__ASPECT_REQUIREMENT, null, msgs); |
| 117 | if (newAspectRequirement != null) |
| 118 | msgs = ((InternalEObject)newAspectRequirement).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - QMLContractPackage.EVALUATION_ASPECT__ASPECT_REQUIREMENT, null, msgs); |
| 119 | msgs = basicSetAspectRequirement(newAspectRequirement, msgs); |
| 120 | if (msgs != null) msgs.dispatch(); |
| 121 | } |
| 122 | else if (eNotificationRequired()) |
| 123 | eNotify(new ENotificationImpl(this, Notification.SET, QMLContractPackage.EVALUATION_ASPECT__ASPECT_REQUIREMENT, newAspectRequirement, newAspectRequirement)); |
| 124 | } |
| 125 | |
| 126 | /** |
| 127 | * The cached OCL expression body for the '{@link #FREQUENCY_LIMIT_must_be_NUMERIC(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>FREQUENCY LIMIT must be NUMERIC</em>}' operation. |
| 128 | * <!-- begin-user-doc --> |
| 129 | * <!-- end-user-doc --> |
| 130 | * @see #FREQUENCY_LIMIT_must_be_NUMERIC(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) |
| 131 | * @generated |
| 132 | * @ordered |
| 133 | */ |
| 134 | protected static final String FREQUENCY_LIMIT_MUST_BE_NUMERIC__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP = "self.oclIsTypeOf(QMLContract::Frequency) implies ("+ |
| 135 | " self.aspectRequirement <> null implies ("+ |
| 136 | " self.aspectRequirement.aspectRequirementLiteral.oclIsTypeOf(QMLContract::NumericLiteral)"+ |
| 137 | " )"+ |
| 138 | ")"; |
| 139 | |
| 140 | /** |
| 141 | * The cached OCL invariant for the '{@link #FREQUENCY_LIMIT_must_be_NUMERIC(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>FREQUENCY LIMIT must be NUMERIC</em>}' invariant operation. |
| 142 | * <!-- begin-user-doc --> |
| 143 | * <!-- end-user-doc --> |
| 144 | * @see #FREQUENCY_LIMIT_must_be_NUMERIC(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) |
| 145 | * @generated |
| 146 | * @ordered |
| 147 | */ |
| 148 | protected static Constraint FREQUENCY_LIMIT_MUST_BE_NUMERIC__DIAGNOSTIC_CHAIN_MAP__EOCL_INV; |
| 149 | |
| 150 | /** |
| 151 | * <!-- begin-user-doc --> |
| 152 | * <!-- end-user-doc --> |
| 153 | * @generated |
| 154 | */ |
| 155 | public boolean FREQUENCY_LIMIT_must_be_NUMERIC(DiagnosticChain diagnostics, Map<Object, Object> context) { |
| 156 | if (FREQUENCY_LIMIT_MUST_BE_NUMERIC__DIAGNOSTIC_CHAIN_MAP__EOCL_INV == null) { |
| 157 | OCL.Helper helper = EOCL_ENV.createOCLHelper(); |
| 158 | helper.setContext(QMLContractPackage.Literals.EVALUATION_ASPECT); |
| 159 | try { |
| 160 | FREQUENCY_LIMIT_MUST_BE_NUMERIC__DIAGNOSTIC_CHAIN_MAP__EOCL_INV = helper.createInvariant(FREQUENCY_LIMIT_MUST_BE_NUMERIC__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP); |
| 161 | } |
| 162 | catch (ParserException pe) { |
| 163 | throw new UnsupportedOperationException(pe.getLocalizedMessage()); |
| 164 | } |
| 165 | } |
| 166 | if (!EOCL_ENV.createQuery(FREQUENCY_LIMIT_MUST_BE_NUMERIC__DIAGNOSTIC_CHAIN_MAP__EOCL_INV).check(this)) { |
| 167 | if (diagnostics != null) { |
| 168 | diagnostics.add |
| 169 | (new BasicDiagnostic |
| 170 | (Diagnostic.ERROR, |
| 171 | QMLContractValidator.DIAGNOSTIC_SOURCE, |
| 172 | QMLContractValidator.EVALUATION_ASPECT__FREQUENCY_LIMIT_MUST_BE_NUMERIC, |
| 173 | EcorePlugin.INSTANCE.getString("_UI_GenericInvariant_diagnostic", new Object[] { "FREQUENCY_LIMIT_must_be_NUMERIC", EObjectValidator.getObjectLabel(this, context) }), |
| 174 | new Object [] { this })); |
| 175 | } |
| 176 | return false; |
| 177 | } |
| 178 | return true; |
| 179 | } |
| 180 | |
| 181 | /** |
| 182 | * The cached OCL expression body for the '{@link #FREQUENCY_LIMIT_must_be_between_0_and_100(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>FREQUENCY LIMIT must be between 0and 100</em>}' operation. |
| 183 | * <!-- begin-user-doc --> |
| 184 | * <!-- end-user-doc --> |
| 185 | * @see #FREQUENCY_LIMIT_must_be_between_0_and_100(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) |
| 186 | * @generated |
| 187 | * @ordered |
| 188 | */ |
| 189 | protected static final String FREQUENCY_LIMIT_MUST_BE_BETWEEN_0AND_100__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP = "self.oclIsTypeOf(QMLContract::Frequency) implies ("+ |
| 190 | " self.aspectRequirement <> null implies ("+ |
| 191 | " self.aspectRequirement.aspectRequirementLiteral.oclIsTypeOf(QMLContract::NumericLiteral) implies ("+ |
| 192 | " self.aspectRequirement.aspectRequirementLiteral.oclAsType(QMLContract::NumericLiteral).value.oclAsType(Real) > 0 and"+ |
| 193 | " self.aspectRequirement.aspectRequirementLiteral.oclAsType(QMLContract::NumericLiteral).value.oclAsType(Real) < 100"+ |
| 194 | " )"+ |
| 195 | " )"+ |
| 196 | ")"; |
| 197 | |
| 198 | /** |
| 199 | * The cached OCL invariant for the '{@link #FREQUENCY_LIMIT_must_be_between_0_and_100(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>FREQUENCY LIMIT must be between 0and 100</em>}' invariant operation. |
| 200 | * <!-- begin-user-doc --> |
| 201 | * <!-- end-user-doc --> |
| 202 | * @see #FREQUENCY_LIMIT_must_be_between_0_and_100(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) |
| 203 | * @generated |
| 204 | * @ordered |
| 205 | */ |
| 206 | protected static Constraint FREQUENCY_LIMIT_MUST_BE_BETWEEN_0AND_100__DIAGNOSTIC_CHAIN_MAP__EOCL_INV; |
| 207 | |
| 208 | /** |
| 209 | * <!-- begin-user-doc --> |
| 210 | * <!-- end-user-doc --> |
| 211 | * @generated |
| 212 | */ |
| 213 | public boolean FREQUENCY_LIMIT_must_be_between_0_and_100(DiagnosticChain diagnostics, Map<Object, Object> context) { |
| 214 | if (FREQUENCY_LIMIT_MUST_BE_BETWEEN_0AND_100__DIAGNOSTIC_CHAIN_MAP__EOCL_INV == null) { |
| 215 | OCL.Helper helper = EOCL_ENV.createOCLHelper(); |
| 216 | helper.setContext(QMLContractPackage.Literals.EVALUATION_ASPECT); |
| 217 | try { |
| 218 | FREQUENCY_LIMIT_MUST_BE_BETWEEN_0AND_100__DIAGNOSTIC_CHAIN_MAP__EOCL_INV = helper.createInvariant(FREQUENCY_LIMIT_MUST_BE_BETWEEN_0AND_100__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP); |
| 219 | } |
| 220 | catch (ParserException pe) { |
| 221 | throw new UnsupportedOperationException(pe.getLocalizedMessage()); |
| 222 | } |
| 223 | } |
| 224 | if (!EOCL_ENV.createQuery(FREQUENCY_LIMIT_MUST_BE_BETWEEN_0AND_100__DIAGNOSTIC_CHAIN_MAP__EOCL_INV).check(this)) { |
| 225 | if (diagnostics != null) { |
| 226 | diagnostics.add |
| 227 | (new BasicDiagnostic |
| 228 | (Diagnostic.ERROR, |
| 229 | QMLContractValidator.DIAGNOSTIC_SOURCE, |
| 230 | QMLContractValidator.EVALUATION_ASPECT__FREQUENCY_LIMIT_MUST_BE_BETWEEN_0AND_100, |
| 231 | EcorePlugin.INSTANCE.getString("_UI_GenericInvariant_diagnostic", new Object[] { "FREQUENCY_LIMIT_must_be_between_0_and_100", EObjectValidator.getObjectLabel(this, context) }), |
| 232 | new Object [] { this })); |
| 233 | } |
| 234 | return false; |
| 235 | } |
| 236 | return true; |
| 237 | } |
| 238 | |
| 239 | /** |
| 240 | * <!-- begin-user-doc --> |
| 241 | * <!-- end-user-doc --> |
| 242 | * @generated |
| 243 | */ |
| 244 | @Override |
| 245 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| 246 | switch (featureID) { |
| 247 | case QMLContractPackage.EVALUATION_ASPECT__ASPECT_REQUIREMENT: |
| 248 | return basicSetAspectRequirement(null, msgs); |
| 249 | } |
| 250 | return super.eInverseRemove(otherEnd, featureID, msgs); |
| 251 | } |
| 252 | |
| 253 | /** |
| 254 | * <!-- begin-user-doc --> |
| 255 | * <!-- end-user-doc --> |
| 256 | * @generated |
| 257 | */ |
| 258 | @Override |
| 259 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| 260 | switch (featureID) { |
| 261 | case QMLContractPackage.EVALUATION_ASPECT__ASPECT_REQUIREMENT: |
| 262 | return getAspectRequirement(); |
| 263 | } |
| 264 | return super.eGet(featureID, resolve, coreType); |
| 265 | } |
| 266 | |
| 267 | /** |
| 268 | * <!-- begin-user-doc --> |
| 269 | * <!-- end-user-doc --> |
| 270 | * @generated |
| 271 | */ |
| 272 | @Override |
| 273 | public void eSet(int featureID, Object newValue) { |
| 274 | switch (featureID) { |
| 275 | case QMLContractPackage.EVALUATION_ASPECT__ASPECT_REQUIREMENT: |
| 276 | setAspectRequirement((AspectRequirement)newValue); |
| 277 | return; |
| 278 | } |
| 279 | super.eSet(featureID, newValue); |
| 280 | } |
| 281 | |
| 282 | /** |
| 283 | * <!-- begin-user-doc --> |
| 284 | * <!-- end-user-doc --> |
| 285 | * @generated |
| 286 | */ |
| 287 | @Override |
| 288 | public void eUnset(int featureID) { |
| 289 | switch (featureID) { |
| 290 | case QMLContractPackage.EVALUATION_ASPECT__ASPECT_REQUIREMENT: |
| 291 | setAspectRequirement((AspectRequirement)null); |
| 292 | return; |
| 293 | } |
| 294 | super.eUnset(featureID); |
| 295 | } |
| 296 | |
| 297 | /** |
| 298 | * <!-- begin-user-doc --> |
| 299 | * <!-- end-user-doc --> |
| 300 | * @generated |
| 301 | */ |
| 302 | @Override |
| 303 | public boolean eIsSet(int featureID) { |
| 304 | switch (featureID) { |
| 305 | case QMLContractPackage.EVALUATION_ASPECT__ASPECT_REQUIREMENT: |
| 306 | return aspectRequirement != null; |
| 307 | } |
| 308 | return super.eIsSet(featureID); |
| 309 | } |
| 310 | |
| 311 | /** |
| 312 | * The cached environment for evaluating OCL expressions. |
| 313 | * <!-- begin-user-doc --> |
| 314 | * <!-- end-user-doc --> |
| 315 | * @generated |
| 316 | * @ordered |
| 317 | */ |
| 318 | protected static final OCL EOCL_ENV = OCL.newInstance(); |
| 319 | |
| 320 | } //EvaluationAspectImpl |