| 1 | /** |
| 2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
| 3 | * |
| 4 | * $Id$ |
| 5 | */ |
| 6 | package de.uka.ipd.sdq.pcm.usagemodel.impl; |
| 7 | |
| 8 | import java.util.Map; |
| 9 | |
| 10 | import org.eclipse.emf.common.notify.Notification; |
| 11 | import org.eclipse.emf.common.notify.NotificationChain; |
| 12 | import org.eclipse.emf.common.util.BasicDiagnostic; |
| 13 | import org.eclipse.emf.common.util.Diagnostic; |
| 14 | import org.eclipse.emf.common.util.DiagnosticChain; |
| 15 | import org.eclipse.emf.ecore.EClass; |
| 16 | import org.eclipse.emf.ecore.InternalEObject; |
| 17 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| 18 | import org.eclipse.emf.ecore.plugin.EcorePlugin; |
| 19 | import org.eclipse.emf.ecore.util.EObjectValidator; |
| 20 | import org.eclipse.ocl.ParserException; |
| 21 | import org.eclipse.ocl.ecore.Constraint; |
| 22 | import org.eclipse.ocl.ecore.OCL; |
| 23 | |
| 24 | import de.uka.ipd.sdq.pcm.core.CorePackage; |
| 25 | import de.uka.ipd.sdq.pcm.core.PCMRandomVariable; |
| 26 | import de.uka.ipd.sdq.pcm.usagemodel.OpenWorkload; |
| 27 | import de.uka.ipd.sdq.pcm.usagemodel.UsagemodelPackage; |
| 28 | import de.uka.ipd.sdq.pcm.usagemodel.util.UsagemodelValidator; |
| 29 | |
| 30 | /** |
| 31 | * <!-- begin-user-doc --> |
| 32 | * An implementation of the model object '<em><b>Open Workload</b></em>'. |
| 33 | * <!-- end-user-doc --> |
| 34 | * <p> |
| 35 | * The following features are implemented: |
| 36 | * <ul> |
| 37 | * <li>{@link de.uka.ipd.sdq.pcm.usagemodel.impl.OpenWorkloadImpl#getInterArrivalTime_OpenWorkload <em>Inter Arrival Time Open Workload</em>}</li> |
| 38 | * </ul> |
| 39 | * </p> |
| 40 | * |
| 41 | * @generated |
| 42 | */ |
| 43 | public class OpenWorkloadImpl extends WorkloadImpl implements OpenWorkload { |
| 44 | /** |
| 45 | * <!-- begin-user-doc --> |
| 46 | * <!-- end-user-doc --> |
| 47 | * @generated |
| 48 | */ |
| 49 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
| 50 | |
| 51 | /** |
| 52 | * The cached value of the '{@link #getInterArrivalTime_OpenWorkload() <em>Inter Arrival Time Open Workload</em>}' containment reference. |
| 53 | * <!-- begin-user-doc --> |
| 54 | * <!-- end-user-doc --> |
| 55 | * @see #getInterArrivalTime_OpenWorkload() |
| 56 | * @generated |
| 57 | * @ordered |
| 58 | */ |
| 59 | protected PCMRandomVariable interArrivalTime_OpenWorkload; |
| 60 | |
| 61 | /** |
| 62 | * <!-- begin-user-doc --> |
| 63 | * <!-- end-user-doc --> |
| 64 | * @generated |
| 65 | */ |
| 66 | protected OpenWorkloadImpl() { |
| 67 | super(); |
| 68 | } |
| 69 | |
| 70 | /** |
| 71 | * <!-- begin-user-doc --> |
| 72 | * <!-- end-user-doc --> |
| 73 | * @generated |
| 74 | */ |
| 75 | @Override |
| 76 | protected EClass eStaticClass() { |
| 77 | return UsagemodelPackage.Literals.OPEN_WORKLOAD; |
| 78 | } |
| 79 | |
| 80 | /** |
| 81 | * <!-- begin-user-doc --> |
| 82 | * <!-- end-user-doc --> |
| 83 | * @generated |
| 84 | */ |
| 85 | public PCMRandomVariable getInterArrivalTime_OpenWorkload() { |
| 86 | return interArrivalTime_OpenWorkload; |
| 87 | } |
| 88 | |
| 89 | /** |
| 90 | * <!-- begin-user-doc --> |
| 91 | * <!-- end-user-doc --> |
| 92 | * @generated |
| 93 | */ |
| 94 | public NotificationChain basicSetInterArrivalTime_OpenWorkload(PCMRandomVariable newInterArrivalTime_OpenWorkload, NotificationChain msgs) { |
| 95 | PCMRandomVariable oldInterArrivalTime_OpenWorkload = interArrivalTime_OpenWorkload; |
| 96 | interArrivalTime_OpenWorkload = newInterArrivalTime_OpenWorkload; |
| 97 | if (eNotificationRequired()) { |
| 98 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, UsagemodelPackage.OPEN_WORKLOAD__INTER_ARRIVAL_TIME_OPEN_WORKLOAD, oldInterArrivalTime_OpenWorkload, newInterArrivalTime_OpenWorkload); |
| 99 | if (msgs == null) msgs = notification; else msgs.add(notification); |
| 100 | } |
| 101 | return msgs; |
| 102 | } |
| 103 | |
| 104 | /** |
| 105 | * <!-- begin-user-doc --> |
| 106 | * <!-- end-user-doc --> |
| 107 | * @generated |
| 108 | */ |
| 109 | public void setInterArrivalTime_OpenWorkload(PCMRandomVariable newInterArrivalTime_OpenWorkload) { |
| 110 | if (newInterArrivalTime_OpenWorkload != interArrivalTime_OpenWorkload) { |
| 111 | NotificationChain msgs = null; |
| 112 | if (interArrivalTime_OpenWorkload != null) |
| 113 | msgs = ((InternalEObject)interArrivalTime_OpenWorkload).eInverseRemove(this, CorePackage.PCM_RANDOM_VARIABLE__OPEN_WORKLOAD_PCM_RANDOM_VARIABLE, PCMRandomVariable.class, msgs); |
| 114 | if (newInterArrivalTime_OpenWorkload != null) |
| 115 | msgs = ((InternalEObject)newInterArrivalTime_OpenWorkload).eInverseAdd(this, CorePackage.PCM_RANDOM_VARIABLE__OPEN_WORKLOAD_PCM_RANDOM_VARIABLE, PCMRandomVariable.class, msgs); |
| 116 | msgs = basicSetInterArrivalTime_OpenWorkload(newInterArrivalTime_OpenWorkload, msgs); |
| 117 | if (msgs != null) msgs.dispatch(); |
| 118 | } |
| 119 | else if (eNotificationRequired()) |
| 120 | eNotify(new ENotificationImpl(this, Notification.SET, UsagemodelPackage.OPEN_WORKLOAD__INTER_ARRIVAL_TIME_OPEN_WORKLOAD, newInterArrivalTime_OpenWorkload, newInterArrivalTime_OpenWorkload)); |
| 121 | } |
| 122 | |
| 123 | /** |
| 124 | * The cached OCL expression body for the '{@link #InterArrivalTimeInOpenWorkloadNeedsToBeSpecified(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Inter Arrival Time In Open Workload Needs To Be Specified</em>}' operation. |
| 125 | * <!-- begin-user-doc --> |
| 126 | * <!-- end-user-doc --> |
| 127 | * @see #InterArrivalTimeInOpenWorkloadNeedsToBeSpecified(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) |
| 128 | * @generated |
| 129 | * @ordered |
| 130 | */ |
| 131 | protected static final String INTER_ARRIVAL_TIME_IN_OPEN_WORKLOAD_NEEDS_TO_BE_SPECIFIED__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP = "not self.interArrivalTime_OpenWorkload.oclIsUndefined() and self.interArrivalTime_OpenWorkload.specification <> ''"; |
| 132 | |
| 133 | /** |
| 134 | * The cached OCL invariant for the '{@link #InterArrivalTimeInOpenWorkloadNeedsToBeSpecified(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Inter Arrival Time In Open Workload Needs To Be Specified</em>}' invariant operation. |
| 135 | * <!-- begin-user-doc --> |
| 136 | * <!-- end-user-doc --> |
| 137 | * @see #InterArrivalTimeInOpenWorkloadNeedsToBeSpecified(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) |
| 138 | * @generated |
| 139 | * @ordered |
| 140 | */ |
| 141 | protected static Constraint INTER_ARRIVAL_TIME_IN_OPEN_WORKLOAD_NEEDS_TO_BE_SPECIFIED__DIAGNOSTIC_CHAIN_MAP__EOCL_INV; |
| 142 | |
| 143 | /** |
| 144 | * <!-- begin-user-doc --> |
| 145 | * <!-- end-user-doc --> |
| 146 | * @generated |
| 147 | */ |
| 148 | public boolean InterArrivalTimeInOpenWorkloadNeedsToBeSpecified(DiagnosticChain diagnostics, Map<Object, Object> context) { |
| 149 | if (INTER_ARRIVAL_TIME_IN_OPEN_WORKLOAD_NEEDS_TO_BE_SPECIFIED__DIAGNOSTIC_CHAIN_MAP__EOCL_INV == null) { |
| 150 | OCL.Helper helper = EOCL_ENV.createOCLHelper(); |
| 151 | helper.setContext(UsagemodelPackage.Literals.OPEN_WORKLOAD); |
| 152 | try { |
| 153 | INTER_ARRIVAL_TIME_IN_OPEN_WORKLOAD_NEEDS_TO_BE_SPECIFIED__DIAGNOSTIC_CHAIN_MAP__EOCL_INV = helper.createInvariant(INTER_ARRIVAL_TIME_IN_OPEN_WORKLOAD_NEEDS_TO_BE_SPECIFIED__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP); |
| 154 | } |
| 155 | catch (ParserException pe) { |
| 156 | throw new UnsupportedOperationException(pe.getLocalizedMessage()); |
| 157 | } |
| 158 | } |
| 159 | if (!EOCL_ENV.createQuery(INTER_ARRIVAL_TIME_IN_OPEN_WORKLOAD_NEEDS_TO_BE_SPECIFIED__DIAGNOSTIC_CHAIN_MAP__EOCL_INV).check(this)) { |
| 160 | if (diagnostics != null) { |
| 161 | diagnostics.add |
| 162 | (new BasicDiagnostic |
| 163 | (Diagnostic.ERROR, |
| 164 | UsagemodelValidator.DIAGNOSTIC_SOURCE, |
| 165 | UsagemodelValidator.OPEN_WORKLOAD__INTER_ARRIVAL_TIME_IN_OPEN_WORKLOAD_NEEDS_TO_BE_SPECIFIED, |
| 166 | EcorePlugin.INSTANCE.getString("_UI_GenericInvariant_diagnostic", new Object[] { "InterArrivalTimeInOpenWorkloadNeedsToBeSpecified", EObjectValidator.getObjectLabel(this, context) }), |
| 167 | new Object [] { this })); |
| 168 | } |
| 169 | return false; |
| 170 | } |
| 171 | return true; |
| 172 | } |
| 173 | |
| 174 | /** |
| 175 | * <!-- begin-user-doc --> |
| 176 | * <!-- end-user-doc --> |
| 177 | * @generated |
| 178 | */ |
| 179 | @Override |
| 180 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| 181 | switch (featureID) { |
| 182 | case UsagemodelPackage.OPEN_WORKLOAD__INTER_ARRIVAL_TIME_OPEN_WORKLOAD: |
| 183 | if (interArrivalTime_OpenWorkload != null) |
| 184 | msgs = ((InternalEObject)interArrivalTime_OpenWorkload).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - UsagemodelPackage.OPEN_WORKLOAD__INTER_ARRIVAL_TIME_OPEN_WORKLOAD, null, msgs); |
| 185 | return basicSetInterArrivalTime_OpenWorkload((PCMRandomVariable)otherEnd, msgs); |
| 186 | } |
| 187 | return super.eInverseAdd(otherEnd, featureID, msgs); |
| 188 | } |
| 189 | |
| 190 | /** |
| 191 | * <!-- begin-user-doc --> |
| 192 | * <!-- end-user-doc --> |
| 193 | * @generated |
| 194 | */ |
| 195 | @Override |
| 196 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| 197 | switch (featureID) { |
| 198 | case UsagemodelPackage.OPEN_WORKLOAD__INTER_ARRIVAL_TIME_OPEN_WORKLOAD: |
| 199 | return basicSetInterArrivalTime_OpenWorkload(null, msgs); |
| 200 | } |
| 201 | return super.eInverseRemove(otherEnd, featureID, msgs); |
| 202 | } |
| 203 | |
| 204 | /** |
| 205 | * <!-- begin-user-doc --> |
| 206 | * <!-- end-user-doc --> |
| 207 | * @generated |
| 208 | */ |
| 209 | @Override |
| 210 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| 211 | switch (featureID) { |
| 212 | case UsagemodelPackage.OPEN_WORKLOAD__INTER_ARRIVAL_TIME_OPEN_WORKLOAD: |
| 213 | return getInterArrivalTime_OpenWorkload(); |
| 214 | } |
| 215 | return super.eGet(featureID, resolve, coreType); |
| 216 | } |
| 217 | |
| 218 | /** |
| 219 | * <!-- begin-user-doc --> |
| 220 | * <!-- end-user-doc --> |
| 221 | * @generated |
| 222 | */ |
| 223 | @Override |
| 224 | public void eSet(int featureID, Object newValue) { |
| 225 | switch (featureID) { |
| 226 | case UsagemodelPackage.OPEN_WORKLOAD__INTER_ARRIVAL_TIME_OPEN_WORKLOAD: |
| 227 | setInterArrivalTime_OpenWorkload((PCMRandomVariable)newValue); |
| 228 | return; |
| 229 | } |
| 230 | super.eSet(featureID, newValue); |
| 231 | } |
| 232 | |
| 233 | /** |
| 234 | * <!-- begin-user-doc --> |
| 235 | * <!-- end-user-doc --> |
| 236 | * @generated |
| 237 | */ |
| 238 | @Override |
| 239 | public void eUnset(int featureID) { |
| 240 | switch (featureID) { |
| 241 | case UsagemodelPackage.OPEN_WORKLOAD__INTER_ARRIVAL_TIME_OPEN_WORKLOAD: |
| 242 | setInterArrivalTime_OpenWorkload((PCMRandomVariable)null); |
| 243 | return; |
| 244 | } |
| 245 | super.eUnset(featureID); |
| 246 | } |
| 247 | |
| 248 | /** |
| 249 | * <!-- begin-user-doc --> |
| 250 | * <!-- end-user-doc --> |
| 251 | * @generated |
| 252 | */ |
| 253 | @Override |
| 254 | public boolean eIsSet(int featureID) { |
| 255 | switch (featureID) { |
| 256 | case UsagemodelPackage.OPEN_WORKLOAD__INTER_ARRIVAL_TIME_OPEN_WORKLOAD: |
| 257 | return interArrivalTime_OpenWorkload != null; |
| 258 | } |
| 259 | return super.eIsSet(featureID); |
| 260 | } |
| 261 | |
| 262 | /** |
| 263 | * The cached environment for evaluating OCL expressions. |
| 264 | * <!-- begin-user-doc --> |
| 265 | * <!-- end-user-doc --> |
| 266 | * @generated |
| 267 | * @ordered |
| 268 | */ |
| 269 | protected static final OCL EOCL_ENV = OCL.newInstance(); |
| 270 | |
| 271 | } //OpenWorkloadImpl |