| 1 | /** |
| 2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
| 3 | * |
| 4 | * $Id$ |
| 5 | */ |
| 6 | package de.uka.ipd.sdq.pcm.seff.impl; |
| 7 | |
| 8 | import java.util.Collection; |
| 9 | |
| 10 | import org.eclipse.emf.common.notify.Notification; |
| 11 | import org.eclipse.emf.common.notify.NotificationChain; |
| 12 | import org.eclipse.emf.common.util.EList; |
| 13 | import org.eclipse.emf.ecore.EClass; |
| 14 | import org.eclipse.emf.ecore.InternalEObject; |
| 15 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| 16 | import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList; |
| 17 | import org.eclipse.emf.ecore.util.InternalEList; |
| 18 | |
| 19 | import de.uka.ipd.sdq.pcm.parameter.ParameterPackage; |
| 20 | import de.uka.ipd.sdq.pcm.parameter.VariableUsage; |
| 21 | import de.uka.ipd.sdq.pcm.repository.EventType; |
| 22 | import de.uka.ipd.sdq.pcm.repository.SourceRole; |
| 23 | import de.uka.ipd.sdq.pcm.seff.CallAction; |
| 24 | import de.uka.ipd.sdq.pcm.seff.EmitEventAction; |
| 25 | import de.uka.ipd.sdq.pcm.seff.SeffPackage; |
| 26 | |
| 27 | /** |
| 28 | * <!-- begin-user-doc --> |
| 29 | * An implementation of the model object '<em><b>Emit Event Action</b></em>'. |
| 30 | * <!-- end-user-doc --> |
| 31 | * <p> |
| 32 | * The following features are implemented: |
| 33 | * <ul> |
| 34 | * <li>{@link de.uka.ipd.sdq.pcm.seff.impl.EmitEventActionImpl#getInputVariableUsages__CallAction <em>Input Variable Usages Call Action</em>}</li> |
| 35 | * <li>{@link de.uka.ipd.sdq.pcm.seff.impl.EmitEventActionImpl#getEventType__EmitEventAction <em>Event Type Emit Event Action</em>}</li> |
| 36 | * <li>{@link de.uka.ipd.sdq.pcm.seff.impl.EmitEventActionImpl#getSourceRole__EmitEventAction <em>Source Role Emit Event Action</em>}</li> |
| 37 | * </ul> |
| 38 | * </p> |
| 39 | * |
| 40 | * @generated |
| 41 | */ |
| 42 | public class EmitEventActionImpl extends AbstractActionImpl implements EmitEventAction { |
| 43 | /** |
| 44 | * <!-- begin-user-doc --> |
| 45 | * <!-- end-user-doc --> |
| 46 | * @generated |
| 47 | */ |
| 48 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
| 49 | |
| 50 | /** |
| 51 | * The cached value of the '{@link #getInputVariableUsages__CallAction() <em>Input Variable Usages Call Action</em>}' containment reference list. |
| 52 | * <!-- begin-user-doc --> |
| 53 | * <!-- end-user-doc --> |
| 54 | * @see #getInputVariableUsages__CallAction() |
| 55 | * @generated |
| 56 | * @ordered |
| 57 | */ |
| 58 | protected EList<VariableUsage> inputVariableUsages__CallAction; |
| 59 | |
| 60 | /** |
| 61 | * The cached value of the '{@link #getEventType__EmitEventAction() <em>Event Type Emit Event Action</em>}' reference. |
| 62 | * <!-- begin-user-doc --> |
| 63 | * <!-- end-user-doc --> |
| 64 | * @see #getEventType__EmitEventAction() |
| 65 | * @generated |
| 66 | * @ordered |
| 67 | */ |
| 68 | protected EventType eventType__EmitEventAction; |
| 69 | |
| 70 | /** |
| 71 | * The cached value of the '{@link #getSourceRole__EmitEventAction() <em>Source Role Emit Event Action</em>}' reference. |
| 72 | * <!-- begin-user-doc --> |
| 73 | * <!-- end-user-doc --> |
| 74 | * @see #getSourceRole__EmitEventAction() |
| 75 | * @generated |
| 76 | * @ordered |
| 77 | */ |
| 78 | protected SourceRole sourceRole__EmitEventAction; |
| 79 | |
| 80 | /** |
| 81 | * <!-- begin-user-doc --> |
| 82 | * <!-- end-user-doc --> |
| 83 | * @generated |
| 84 | */ |
| 85 | protected EmitEventActionImpl() { |
| 86 | super(); |
| 87 | } |
| 88 | |
| 89 | /** |
| 90 | * <!-- begin-user-doc --> |
| 91 | * <!-- end-user-doc --> |
| 92 | * @generated |
| 93 | */ |
| 94 | @Override |
| 95 | protected EClass eStaticClass() { |
| 96 | return SeffPackage.Literals.EMIT_EVENT_ACTION; |
| 97 | } |
| 98 | |
| 99 | /** |
| 100 | * <!-- begin-user-doc --> |
| 101 | * <!-- end-user-doc --> |
| 102 | * @generated |
| 103 | */ |
| 104 | public EList<VariableUsage> getInputVariableUsages__CallAction() { |
| 105 | if (inputVariableUsages__CallAction == null) { |
| 106 | inputVariableUsages__CallAction = new EObjectContainmentWithInverseEList<VariableUsage>(VariableUsage.class, this, SeffPackage.EMIT_EVENT_ACTION__INPUT_VARIABLE_USAGES_CALL_ACTION, ParameterPackage.VARIABLE_USAGE__CALL_ACTION_VARIABLE_USAGE); |
| 107 | } |
| 108 | return inputVariableUsages__CallAction; |
| 109 | } |
| 110 | |
| 111 | /** |
| 112 | * <!-- begin-user-doc --> |
| 113 | * <!-- end-user-doc --> |
| 114 | * @generated |
| 115 | */ |
| 116 | public EventType getEventType__EmitEventAction() { |
| 117 | if (eventType__EmitEventAction != null && eventType__EmitEventAction.eIsProxy()) { |
| 118 | InternalEObject oldEventType__EmitEventAction = (InternalEObject)eventType__EmitEventAction; |
| 119 | eventType__EmitEventAction = (EventType)eResolveProxy(oldEventType__EmitEventAction); |
| 120 | if (eventType__EmitEventAction != oldEventType__EmitEventAction) { |
| 121 | if (eNotificationRequired()) |
| 122 | eNotify(new ENotificationImpl(this, Notification.RESOLVE, SeffPackage.EMIT_EVENT_ACTION__EVENT_TYPE_EMIT_EVENT_ACTION, oldEventType__EmitEventAction, eventType__EmitEventAction)); |
| 123 | } |
| 124 | } |
| 125 | return eventType__EmitEventAction; |
| 126 | } |
| 127 | |
| 128 | /** |
| 129 | * <!-- begin-user-doc --> |
| 130 | * <!-- end-user-doc --> |
| 131 | * @generated |
| 132 | */ |
| 133 | public EventType basicGetEventType__EmitEventAction() { |
| 134 | return eventType__EmitEventAction; |
| 135 | } |
| 136 | |
| 137 | /** |
| 138 | * <!-- begin-user-doc --> |
| 139 | * <!-- end-user-doc --> |
| 140 | * @generated |
| 141 | */ |
| 142 | public void setEventType__EmitEventAction(EventType newEventType__EmitEventAction) { |
| 143 | EventType oldEventType__EmitEventAction = eventType__EmitEventAction; |
| 144 | eventType__EmitEventAction = newEventType__EmitEventAction; |
| 145 | if (eNotificationRequired()) |
| 146 | eNotify(new ENotificationImpl(this, Notification.SET, SeffPackage.EMIT_EVENT_ACTION__EVENT_TYPE_EMIT_EVENT_ACTION, oldEventType__EmitEventAction, eventType__EmitEventAction)); |
| 147 | } |
| 148 | |
| 149 | /** |
| 150 | * <!-- begin-user-doc --> |
| 151 | * <!-- end-user-doc --> |
| 152 | * @generated |
| 153 | */ |
| 154 | public SourceRole getSourceRole__EmitEventAction() { |
| 155 | if (sourceRole__EmitEventAction != null && sourceRole__EmitEventAction.eIsProxy()) { |
| 156 | InternalEObject oldSourceRole__EmitEventAction = (InternalEObject)sourceRole__EmitEventAction; |
| 157 | sourceRole__EmitEventAction = (SourceRole)eResolveProxy(oldSourceRole__EmitEventAction); |
| 158 | if (sourceRole__EmitEventAction != oldSourceRole__EmitEventAction) { |
| 159 | if (eNotificationRequired()) |
| 160 | eNotify(new ENotificationImpl(this, Notification.RESOLVE, SeffPackage.EMIT_EVENT_ACTION__SOURCE_ROLE_EMIT_EVENT_ACTION, oldSourceRole__EmitEventAction, sourceRole__EmitEventAction)); |
| 161 | } |
| 162 | } |
| 163 | return sourceRole__EmitEventAction; |
| 164 | } |
| 165 | |
| 166 | /** |
| 167 | * <!-- begin-user-doc --> |
| 168 | * <!-- end-user-doc --> |
| 169 | * @generated |
| 170 | */ |
| 171 | public SourceRole basicGetSourceRole__EmitEventAction() { |
| 172 | return sourceRole__EmitEventAction; |
| 173 | } |
| 174 | |
| 175 | /** |
| 176 | * <!-- begin-user-doc --> |
| 177 | * <!-- end-user-doc --> |
| 178 | * @generated |
| 179 | */ |
| 180 | public void setSourceRole__EmitEventAction(SourceRole newSourceRole__EmitEventAction) { |
| 181 | SourceRole oldSourceRole__EmitEventAction = sourceRole__EmitEventAction; |
| 182 | sourceRole__EmitEventAction = newSourceRole__EmitEventAction; |
| 183 | if (eNotificationRequired()) |
| 184 | eNotify(new ENotificationImpl(this, Notification.SET, SeffPackage.EMIT_EVENT_ACTION__SOURCE_ROLE_EMIT_EVENT_ACTION, oldSourceRole__EmitEventAction, sourceRole__EmitEventAction)); |
| 185 | } |
| 186 | |
| 187 | /** |
| 188 | * <!-- begin-user-doc --> |
| 189 | * <!-- end-user-doc --> |
| 190 | * @generated |
| 191 | */ |
| 192 | @SuppressWarnings("unchecked") |
| 193 | @Override |
| 194 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| 195 | switch (featureID) { |
| 196 | case SeffPackage.EMIT_EVENT_ACTION__INPUT_VARIABLE_USAGES_CALL_ACTION: |
| 197 | return ((InternalEList<InternalEObject>)(InternalEList<?>)getInputVariableUsages__CallAction()).basicAdd(otherEnd, msgs); |
| 198 | } |
| 199 | return super.eInverseAdd(otherEnd, featureID, msgs); |
| 200 | } |
| 201 | |
| 202 | /** |
| 203 | * <!-- begin-user-doc --> |
| 204 | * <!-- end-user-doc --> |
| 205 | * @generated |
| 206 | */ |
| 207 | @Override |
| 208 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| 209 | switch (featureID) { |
| 210 | case SeffPackage.EMIT_EVENT_ACTION__INPUT_VARIABLE_USAGES_CALL_ACTION: |
| 211 | return ((InternalEList<?>)getInputVariableUsages__CallAction()).basicRemove(otherEnd, msgs); |
| 212 | } |
| 213 | return super.eInverseRemove(otherEnd, featureID, msgs); |
| 214 | } |
| 215 | |
| 216 | /** |
| 217 | * <!-- begin-user-doc --> |
| 218 | * <!-- end-user-doc --> |
| 219 | * @generated |
| 220 | */ |
| 221 | @Override |
| 222 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| 223 | switch (featureID) { |
| 224 | case SeffPackage.EMIT_EVENT_ACTION__INPUT_VARIABLE_USAGES_CALL_ACTION: |
| 225 | return getInputVariableUsages__CallAction(); |
| 226 | case SeffPackage.EMIT_EVENT_ACTION__EVENT_TYPE_EMIT_EVENT_ACTION: |
| 227 | if (resolve) return getEventType__EmitEventAction(); |
| 228 | return basicGetEventType__EmitEventAction(); |
| 229 | case SeffPackage.EMIT_EVENT_ACTION__SOURCE_ROLE_EMIT_EVENT_ACTION: |
| 230 | if (resolve) return getSourceRole__EmitEventAction(); |
| 231 | return basicGetSourceRole__EmitEventAction(); |
| 232 | } |
| 233 | return super.eGet(featureID, resolve, coreType); |
| 234 | } |
| 235 | |
| 236 | /** |
| 237 | * <!-- begin-user-doc --> |
| 238 | * <!-- end-user-doc --> |
| 239 | * @generated |
| 240 | */ |
| 241 | @SuppressWarnings("unchecked") |
| 242 | @Override |
| 243 | public void eSet(int featureID, Object newValue) { |
| 244 | switch (featureID) { |
| 245 | case SeffPackage.EMIT_EVENT_ACTION__INPUT_VARIABLE_USAGES_CALL_ACTION: |
| 246 | getInputVariableUsages__CallAction().clear(); |
| 247 | getInputVariableUsages__CallAction().addAll((Collection<? extends VariableUsage>)newValue); |
| 248 | return; |
| 249 | case SeffPackage.EMIT_EVENT_ACTION__EVENT_TYPE_EMIT_EVENT_ACTION: |
| 250 | setEventType__EmitEventAction((EventType)newValue); |
| 251 | return; |
| 252 | case SeffPackage.EMIT_EVENT_ACTION__SOURCE_ROLE_EMIT_EVENT_ACTION: |
| 253 | setSourceRole__EmitEventAction((SourceRole)newValue); |
| 254 | return; |
| 255 | } |
| 256 | super.eSet(featureID, newValue); |
| 257 | } |
| 258 | |
| 259 | /** |
| 260 | * <!-- begin-user-doc --> |
| 261 | * <!-- end-user-doc --> |
| 262 | * @generated |
| 263 | */ |
| 264 | @Override |
| 265 | public void eUnset(int featureID) { |
| 266 | switch (featureID) { |
| 267 | case SeffPackage.EMIT_EVENT_ACTION__INPUT_VARIABLE_USAGES_CALL_ACTION: |
| 268 | getInputVariableUsages__CallAction().clear(); |
| 269 | return; |
| 270 | case SeffPackage.EMIT_EVENT_ACTION__EVENT_TYPE_EMIT_EVENT_ACTION: |
| 271 | setEventType__EmitEventAction((EventType)null); |
| 272 | return; |
| 273 | case SeffPackage.EMIT_EVENT_ACTION__SOURCE_ROLE_EMIT_EVENT_ACTION: |
| 274 | setSourceRole__EmitEventAction((SourceRole)null); |
| 275 | return; |
| 276 | } |
| 277 | super.eUnset(featureID); |
| 278 | } |
| 279 | |
| 280 | /** |
| 281 | * <!-- begin-user-doc --> |
| 282 | * <!-- end-user-doc --> |
| 283 | * @generated |
| 284 | */ |
| 285 | @Override |
| 286 | public boolean eIsSet(int featureID) { |
| 287 | switch (featureID) { |
| 288 | case SeffPackage.EMIT_EVENT_ACTION__INPUT_VARIABLE_USAGES_CALL_ACTION: |
| 289 | return inputVariableUsages__CallAction != null && !inputVariableUsages__CallAction.isEmpty(); |
| 290 | case SeffPackage.EMIT_EVENT_ACTION__EVENT_TYPE_EMIT_EVENT_ACTION: |
| 291 | return eventType__EmitEventAction != null; |
| 292 | case SeffPackage.EMIT_EVENT_ACTION__SOURCE_ROLE_EMIT_EVENT_ACTION: |
| 293 | return sourceRole__EmitEventAction != null; |
| 294 | } |
| 295 | return super.eIsSet(featureID); |
| 296 | } |
| 297 | |
| 298 | /** |
| 299 | * <!-- begin-user-doc --> |
| 300 | * <!-- end-user-doc --> |
| 301 | * @generated |
| 302 | */ |
| 303 | @Override |
| 304 | public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) { |
| 305 | if (baseClass == CallAction.class) { |
| 306 | switch (derivedFeatureID) { |
| 307 | case SeffPackage.EMIT_EVENT_ACTION__INPUT_VARIABLE_USAGES_CALL_ACTION: return SeffPackage.CALL_ACTION__INPUT_VARIABLE_USAGES_CALL_ACTION; |
| 308 | default: return -1; |
| 309 | } |
| 310 | } |
| 311 | return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass); |
| 312 | } |
| 313 | |
| 314 | /** |
| 315 | * <!-- begin-user-doc --> |
| 316 | * <!-- end-user-doc --> |
| 317 | * @generated |
| 318 | */ |
| 319 | @Override |
| 320 | public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) { |
| 321 | if (baseClass == CallAction.class) { |
| 322 | switch (baseFeatureID) { |
| 323 | case SeffPackage.CALL_ACTION__INPUT_VARIABLE_USAGES_CALL_ACTION: return SeffPackage.EMIT_EVENT_ACTION__INPUT_VARIABLE_USAGES_CALL_ACTION; |
| 324 | default: return -1; |
| 325 | } |
| 326 | } |
| 327 | return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass); |
| 328 | } |
| 329 | |
| 330 | } //EmitEventActionImpl |