| 1 | /** |
| 2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
| 3 | * |
| 4 | * $Id$ |
| 5 | */ |
| 6 | package de.uka.ipd.sdq.pcm.reliability.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.reliability.NetworkInducedFailureType; |
| 25 | import de.uka.ipd.sdq.pcm.reliability.ReliabilityPackage; |
| 26 | import de.uka.ipd.sdq.pcm.reliability.util.ReliabilityValidator; |
| 27 | import de.uka.ipd.sdq.pcm.resourcetype.CommunicationLinkResourceType; |
| 28 | import de.uka.ipd.sdq.pcm.resourcetype.ResourcetypePackage; |
| 29 | |
| 30 | /** |
| 31 | * <!-- begin-user-doc --> |
| 32 | * An implementation of the model object '<em><b>Network Induced Failure Type</b></em>'. |
| 33 | * <!-- end-user-doc --> |
| 34 | * <p> |
| 35 | * The following features are implemented: |
| 36 | * <ul> |
| 37 | * <li>{@link de.uka.ipd.sdq.pcm.reliability.impl.NetworkInducedFailureTypeImpl#getCommunicationLinkResourceType__NetworkInducedFailureType <em>Communication Link Resource Type Network Induced Failure Type</em>}</li> |
| 38 | * </ul> |
| 39 | * </p> |
| 40 | * |
| 41 | * @generated |
| 42 | */ |
| 43 | public class NetworkInducedFailureTypeImpl extends FailureTypeImpl implements NetworkInducedFailureType { |
| 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 #getCommunicationLinkResourceType__NetworkInducedFailureType() <em>Communication Link Resource Type Network Induced Failure Type</em>}' reference. |
| 53 | * <!-- begin-user-doc --> |
| 54 | * <!-- end-user-doc --> |
| 55 | * @see #getCommunicationLinkResourceType__NetworkInducedFailureType() |
| 56 | * @generated |
| 57 | * @ordered |
| 58 | */ |
| 59 | protected CommunicationLinkResourceType communicationLinkResourceType__NetworkInducedFailureType; |
| 60 | |
| 61 | /** |
| 62 | * <!-- begin-user-doc --> |
| 63 | * <!-- end-user-doc --> |
| 64 | * @generated |
| 65 | */ |
| 66 | protected NetworkInducedFailureTypeImpl() { |
| 67 | super(); |
| 68 | } |
| 69 | |
| 70 | /** |
| 71 | * <!-- begin-user-doc --> |
| 72 | * <!-- end-user-doc --> |
| 73 | * @generated |
| 74 | */ |
| 75 | @Override |
| 76 | protected EClass eStaticClass() { |
| 77 | return ReliabilityPackage.Literals.NETWORK_INDUCED_FAILURE_TYPE; |
| 78 | } |
| 79 | |
| 80 | /** |
| 81 | * <!-- begin-user-doc --> |
| 82 | * <!-- end-user-doc --> |
| 83 | * @generated |
| 84 | */ |
| 85 | public CommunicationLinkResourceType getCommunicationLinkResourceType__NetworkInducedFailureType() { |
| 86 | if (communicationLinkResourceType__NetworkInducedFailureType != null && communicationLinkResourceType__NetworkInducedFailureType.eIsProxy()) { |
| 87 | InternalEObject oldCommunicationLinkResourceType__NetworkInducedFailureType = (InternalEObject)communicationLinkResourceType__NetworkInducedFailureType; |
| 88 | communicationLinkResourceType__NetworkInducedFailureType = (CommunicationLinkResourceType)eResolveProxy(oldCommunicationLinkResourceType__NetworkInducedFailureType); |
| 89 | if (communicationLinkResourceType__NetworkInducedFailureType != oldCommunicationLinkResourceType__NetworkInducedFailureType) { |
| 90 | if (eNotificationRequired()) |
| 91 | eNotify(new ENotificationImpl(this, Notification.RESOLVE, ReliabilityPackage.NETWORK_INDUCED_FAILURE_TYPE__COMMUNICATION_LINK_RESOURCE_TYPE_NETWORK_INDUCED_FAILURE_TYPE, oldCommunicationLinkResourceType__NetworkInducedFailureType, communicationLinkResourceType__NetworkInducedFailureType)); |
| 92 | } |
| 93 | } |
| 94 | return communicationLinkResourceType__NetworkInducedFailureType; |
| 95 | } |
| 96 | |
| 97 | /** |
| 98 | * <!-- begin-user-doc --> |
| 99 | * <!-- end-user-doc --> |
| 100 | * @generated |
| 101 | */ |
| 102 | public CommunicationLinkResourceType basicGetCommunicationLinkResourceType__NetworkInducedFailureType() { |
| 103 | return communicationLinkResourceType__NetworkInducedFailureType; |
| 104 | } |
| 105 | |
| 106 | /** |
| 107 | * <!-- begin-user-doc --> |
| 108 | * <!-- end-user-doc --> |
| 109 | * @generated |
| 110 | */ |
| 111 | public NotificationChain basicSetCommunicationLinkResourceType__NetworkInducedFailureType(CommunicationLinkResourceType newCommunicationLinkResourceType__NetworkInducedFailureType, NotificationChain msgs) { |
| 112 | CommunicationLinkResourceType oldCommunicationLinkResourceType__NetworkInducedFailureType = communicationLinkResourceType__NetworkInducedFailureType; |
| 113 | communicationLinkResourceType__NetworkInducedFailureType = newCommunicationLinkResourceType__NetworkInducedFailureType; |
| 114 | if (eNotificationRequired()) { |
| 115 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ReliabilityPackage.NETWORK_INDUCED_FAILURE_TYPE__COMMUNICATION_LINK_RESOURCE_TYPE_NETWORK_INDUCED_FAILURE_TYPE, oldCommunicationLinkResourceType__NetworkInducedFailureType, newCommunicationLinkResourceType__NetworkInducedFailureType); |
| 116 | if (msgs == null) msgs = notification; else msgs.add(notification); |
| 117 | } |
| 118 | return msgs; |
| 119 | } |
| 120 | |
| 121 | /** |
| 122 | * <!-- begin-user-doc --> |
| 123 | * <!-- end-user-doc --> |
| 124 | * @generated |
| 125 | */ |
| 126 | public void setCommunicationLinkResourceType__NetworkInducedFailureType(CommunicationLinkResourceType newCommunicationLinkResourceType__NetworkInducedFailureType) { |
| 127 | if (newCommunicationLinkResourceType__NetworkInducedFailureType != communicationLinkResourceType__NetworkInducedFailureType) { |
| 128 | NotificationChain msgs = null; |
| 129 | if (communicationLinkResourceType__NetworkInducedFailureType != null) |
| 130 | msgs = ((InternalEObject)communicationLinkResourceType__NetworkInducedFailureType).eInverseRemove(this, ResourcetypePackage.COMMUNICATION_LINK_RESOURCE_TYPE__NETWORK_INDUCED_FAILURE_TYPE_COMMUNICATION_LINK_RESOURCE_TYPE, CommunicationLinkResourceType.class, msgs); |
| 131 | if (newCommunicationLinkResourceType__NetworkInducedFailureType != null) |
| 132 | msgs = ((InternalEObject)newCommunicationLinkResourceType__NetworkInducedFailureType).eInverseAdd(this, ResourcetypePackage.COMMUNICATION_LINK_RESOURCE_TYPE__NETWORK_INDUCED_FAILURE_TYPE_COMMUNICATION_LINK_RESOURCE_TYPE, CommunicationLinkResourceType.class, msgs); |
| 133 | msgs = basicSetCommunicationLinkResourceType__NetworkInducedFailureType(newCommunicationLinkResourceType__NetworkInducedFailureType, msgs); |
| 134 | if (msgs != null) msgs.dispatch(); |
| 135 | } |
| 136 | else if (eNotificationRequired()) |
| 137 | eNotify(new ENotificationImpl(this, Notification.SET, ReliabilityPackage.NETWORK_INDUCED_FAILURE_TYPE__COMMUNICATION_LINK_RESOURCE_TYPE_NETWORK_INDUCED_FAILURE_TYPE, newCommunicationLinkResourceType__NetworkInducedFailureType, newCommunicationLinkResourceType__NetworkInducedFailureType)); |
| 138 | } |
| 139 | |
| 140 | /** |
| 141 | * The cached OCL expression body for the '{@link #NetworkInducedFailureTypeHasCommunicationLinkResourceType(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Network Induced Failure Type Has Communication Link Resource Type</em>}' operation. |
| 142 | * <!-- begin-user-doc --> |
| 143 | * <!-- end-user-doc --> |
| 144 | * @see #NetworkInducedFailureTypeHasCommunicationLinkResourceType(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) |
| 145 | * @generated |
| 146 | * @ordered |
| 147 | */ |
| 148 | protected static final String NETWORK_INDUCED_FAILURE_TYPE_HAS_COMMUNICATION_LINK_RESOURCE_TYPE__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP = "self.communicationLinkResourceType__NetworkInducedFailureType <> null"; |
| 149 | |
| 150 | /** |
| 151 | * The cached OCL invariant for the '{@link #NetworkInducedFailureTypeHasCommunicationLinkResourceType(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Network Induced Failure Type Has Communication Link Resource Type</em>}' invariant operation. |
| 152 | * <!-- begin-user-doc --> |
| 153 | * <!-- end-user-doc --> |
| 154 | * @see #NetworkInducedFailureTypeHasCommunicationLinkResourceType(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) |
| 155 | * @generated |
| 156 | * @ordered |
| 157 | */ |
| 158 | protected static Constraint NETWORK_INDUCED_FAILURE_TYPE_HAS_COMMUNICATION_LINK_RESOURCE_TYPE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV; |
| 159 | |
| 160 | /** |
| 161 | * <!-- begin-user-doc --> |
| 162 | * <!-- end-user-doc --> |
| 163 | * @generated |
| 164 | */ |
| 165 | public boolean NetworkInducedFailureTypeHasCommunicationLinkResourceType(DiagnosticChain diagnostics, Map<Object, Object> context) { |
| 166 | if (NETWORK_INDUCED_FAILURE_TYPE_HAS_COMMUNICATION_LINK_RESOURCE_TYPE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV == null) { |
| 167 | OCL.Helper helper = EOCL_ENV.createOCLHelper(); |
| 168 | helper.setContext(ReliabilityPackage.Literals.NETWORK_INDUCED_FAILURE_TYPE); |
| 169 | try { |
| 170 | NETWORK_INDUCED_FAILURE_TYPE_HAS_COMMUNICATION_LINK_RESOURCE_TYPE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV = helper.createInvariant(NETWORK_INDUCED_FAILURE_TYPE_HAS_COMMUNICATION_LINK_RESOURCE_TYPE__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP); |
| 171 | } |
| 172 | catch (ParserException pe) { |
| 173 | throw new UnsupportedOperationException(pe.getLocalizedMessage()); |
| 174 | } |
| 175 | } |
| 176 | if (!EOCL_ENV.createQuery(NETWORK_INDUCED_FAILURE_TYPE_HAS_COMMUNICATION_LINK_RESOURCE_TYPE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV).check(this)) { |
| 177 | if (diagnostics != null) { |
| 178 | diagnostics.add |
| 179 | (new BasicDiagnostic |
| 180 | (Diagnostic.ERROR, |
| 181 | ReliabilityValidator.DIAGNOSTIC_SOURCE, |
| 182 | ReliabilityValidator.NETWORK_INDUCED_FAILURE_TYPE__NETWORK_INDUCED_FAILURE_TYPE_HAS_COMMUNICATION_LINK_RESOURCE_TYPE, |
| 183 | EcorePlugin.INSTANCE.getString("_UI_GenericInvariant_diagnostic", new Object[] { "NetworkInducedFailureTypeHasCommunicationLinkResourceType", EObjectValidator.getObjectLabel(this, context) }), |
| 184 | new Object [] { this })); |
| 185 | } |
| 186 | return false; |
| 187 | } |
| 188 | return true; |
| 189 | } |
| 190 | |
| 191 | /** |
| 192 | * <!-- begin-user-doc --> |
| 193 | * <!-- end-user-doc --> |
| 194 | * @generated |
| 195 | */ |
| 196 | @Override |
| 197 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| 198 | switch (featureID) { |
| 199 | case ReliabilityPackage.NETWORK_INDUCED_FAILURE_TYPE__COMMUNICATION_LINK_RESOURCE_TYPE_NETWORK_INDUCED_FAILURE_TYPE: |
| 200 | if (communicationLinkResourceType__NetworkInducedFailureType != null) |
| 201 | msgs = ((InternalEObject)communicationLinkResourceType__NetworkInducedFailureType).eInverseRemove(this, ResourcetypePackage.COMMUNICATION_LINK_RESOURCE_TYPE__NETWORK_INDUCED_FAILURE_TYPE_COMMUNICATION_LINK_RESOURCE_TYPE, CommunicationLinkResourceType.class, msgs); |
| 202 | return basicSetCommunicationLinkResourceType__NetworkInducedFailureType((CommunicationLinkResourceType)otherEnd, msgs); |
| 203 | } |
| 204 | return super.eInverseAdd(otherEnd, featureID, msgs); |
| 205 | } |
| 206 | |
| 207 | /** |
| 208 | * <!-- begin-user-doc --> |
| 209 | * <!-- end-user-doc --> |
| 210 | * @generated |
| 211 | */ |
| 212 | @Override |
| 213 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| 214 | switch (featureID) { |
| 215 | case ReliabilityPackage.NETWORK_INDUCED_FAILURE_TYPE__COMMUNICATION_LINK_RESOURCE_TYPE_NETWORK_INDUCED_FAILURE_TYPE: |
| 216 | return basicSetCommunicationLinkResourceType__NetworkInducedFailureType(null, msgs); |
| 217 | } |
| 218 | return super.eInverseRemove(otherEnd, featureID, msgs); |
| 219 | } |
| 220 | |
| 221 | /** |
| 222 | * <!-- begin-user-doc --> |
| 223 | * <!-- end-user-doc --> |
| 224 | * @generated |
| 225 | */ |
| 226 | @Override |
| 227 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| 228 | switch (featureID) { |
| 229 | case ReliabilityPackage.NETWORK_INDUCED_FAILURE_TYPE__COMMUNICATION_LINK_RESOURCE_TYPE_NETWORK_INDUCED_FAILURE_TYPE: |
| 230 | if (resolve) return getCommunicationLinkResourceType__NetworkInducedFailureType(); |
| 231 | return basicGetCommunicationLinkResourceType__NetworkInducedFailureType(); |
| 232 | } |
| 233 | return super.eGet(featureID, resolve, coreType); |
| 234 | } |
| 235 | |
| 236 | /** |
| 237 | * <!-- begin-user-doc --> |
| 238 | * <!-- end-user-doc --> |
| 239 | * @generated |
| 240 | */ |
| 241 | @Override |
| 242 | public void eSet(int featureID, Object newValue) { |
| 243 | switch (featureID) { |
| 244 | case ReliabilityPackage.NETWORK_INDUCED_FAILURE_TYPE__COMMUNICATION_LINK_RESOURCE_TYPE_NETWORK_INDUCED_FAILURE_TYPE: |
| 245 | setCommunicationLinkResourceType__NetworkInducedFailureType((CommunicationLinkResourceType)newValue); |
| 246 | return; |
| 247 | } |
| 248 | super.eSet(featureID, newValue); |
| 249 | } |
| 250 | |
| 251 | /** |
| 252 | * <!-- begin-user-doc --> |
| 253 | * <!-- end-user-doc --> |
| 254 | * @generated |
| 255 | */ |
| 256 | @Override |
| 257 | public void eUnset(int featureID) { |
| 258 | switch (featureID) { |
| 259 | case ReliabilityPackage.NETWORK_INDUCED_FAILURE_TYPE__COMMUNICATION_LINK_RESOURCE_TYPE_NETWORK_INDUCED_FAILURE_TYPE: |
| 260 | setCommunicationLinkResourceType__NetworkInducedFailureType((CommunicationLinkResourceType)null); |
| 261 | return; |
| 262 | } |
| 263 | super.eUnset(featureID); |
| 264 | } |
| 265 | |
| 266 | /** |
| 267 | * <!-- begin-user-doc --> |
| 268 | * <!-- end-user-doc --> |
| 269 | * @generated |
| 270 | */ |
| 271 | @Override |
| 272 | public boolean eIsSet(int featureID) { |
| 273 | switch (featureID) { |
| 274 | case ReliabilityPackage.NETWORK_INDUCED_FAILURE_TYPE__COMMUNICATION_LINK_RESOURCE_TYPE_NETWORK_INDUCED_FAILURE_TYPE: |
| 275 | return communicationLinkResourceType__NetworkInducedFailureType != null; |
| 276 | } |
| 277 | return super.eIsSet(featureID); |
| 278 | } |
| 279 | |
| 280 | /** |
| 281 | * The cached environment for evaluating OCL expressions. |
| 282 | * <!-- begin-user-doc --> |
| 283 | * <!-- end-user-doc --> |
| 284 | * @generated |
| 285 | * @ordered |
| 286 | */ |
| 287 | protected static final OCL EOCL_ENV = OCL.newInstance(); |
| 288 | |
| 289 | } //NetworkInducedFailureTypeImpl |