| 1 | /** |
| 2 | * Copyright 2006, SDQ Group, University Karlsruhe (TH) |
| 3 | * |
| 4 | * $Id$ |
| 5 | */ |
| 6 | package de.uka.ipd.sdq.context.computed_usage.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.impl.EObjectImpl; |
| 17 | import org.eclipse.emf.ecore.util.EObjectContainmentEList; |
| 18 | import org.eclipse.emf.ecore.util.EcoreUtil; |
| 19 | import org.eclipse.emf.ecore.util.InternalEList; |
| 20 | |
| 21 | import de.uka.ipd.sdq.context.computed_usage.ComputedUsageContext; |
| 22 | import de.uka.ipd.sdq.context.computed_usage.ComputedUsagePackage; |
| 23 | import de.uka.ipd.sdq.context.computed_usage.ExternalCallInput; |
| 24 | import de.uka.ipd.sdq.pcm.parameter.VariableUsage; |
| 25 | import de.uka.ipd.sdq.pcm.seff.ExternalCallAction; |
| 26 | |
| 27 | /** |
| 28 | * <!-- begin-user-doc --> |
| 29 | * An implementation of the model object '<em><b>External Call Input</b></em>'. |
| 30 | * <!-- end-user-doc --> |
| 31 | * <p> |
| 32 | * The following features are implemented: |
| 33 | * <ul> |
| 34 | * <li>{@link de.uka.ipd.sdq.context.computed_usage.impl.ExternalCallInputImpl#getParameterCharacterisations_ExternalCallInput <em>Parameter Characterisations External Call Input</em>}</li> |
| 35 | * <li>{@link de.uka.ipd.sdq.context.computed_usage.impl.ExternalCallInputImpl#getExternalCallAction_ExternalCallInput <em>External Call Action External Call Input</em>}</li> |
| 36 | * <li>{@link de.uka.ipd.sdq.context.computed_usage.impl.ExternalCallInputImpl#getComputedUsageContext_ExternalCallInput <em>Computed Usage Context External Call Input</em>}</li> |
| 37 | * </ul> |
| 38 | * </p> |
| 39 | * |
| 40 | * @generated |
| 41 | */ |
| 42 | public class ExternalCallInputImpl extends EObjectImpl implements ExternalCallInput { |
| 43 | /** |
| 44 | * <!-- begin-user-doc --> |
| 45 | * <!-- end-user-doc --> |
| 46 | * @generated |
| 47 | */ |
| 48 | public static final String copyright = "Copyright 2006, SDQ Group, University Karlsruhe (TH)"; |
| 49 | |
| 50 | /** |
| 51 | * The cached value of the '{@link #getParameterCharacterisations_ExternalCallInput() <em>Parameter Characterisations External Call Input</em>}' containment reference list. |
| 52 | * <!-- begin-user-doc --> |
| 53 | * <!-- end-user-doc --> |
| 54 | * @see #getParameterCharacterisations_ExternalCallInput() |
| 55 | * @generated |
| 56 | * @ordered |
| 57 | */ |
| 58 | protected EList<VariableUsage> parameterCharacterisations_ExternalCallInput; |
| 59 | |
| 60 | /** |
| 61 | * The cached value of the '{@link #getExternalCallAction_ExternalCallInput() <em>External Call Action External Call Input</em>}' reference. |
| 62 | * <!-- begin-user-doc --> |
| 63 | * <!-- end-user-doc --> |
| 64 | * @see #getExternalCallAction_ExternalCallInput() |
| 65 | * @generated |
| 66 | * @ordered |
| 67 | */ |
| 68 | protected ExternalCallAction externalCallAction_ExternalCallInput; |
| 69 | |
| 70 | /** |
| 71 | * <!-- begin-user-doc --> |
| 72 | * <!-- end-user-doc --> |
| 73 | * @generated |
| 74 | */ |
| 75 | protected ExternalCallInputImpl() { |
| 76 | super(); |
| 77 | } |
| 78 | |
| 79 | /** |
| 80 | * <!-- begin-user-doc --> |
| 81 | * <!-- end-user-doc --> |
| 82 | * @generated |
| 83 | */ |
| 84 | @Override |
| 85 | protected EClass eStaticClass() { |
| 86 | return ComputedUsagePackage.Literals.EXTERNAL_CALL_INPUT; |
| 87 | } |
| 88 | |
| 89 | /** |
| 90 | * <!-- begin-user-doc --> |
| 91 | * <!-- end-user-doc --> |
| 92 | * @generated |
| 93 | */ |
| 94 | public EList<VariableUsage> getParameterCharacterisations_ExternalCallInput() { |
| 95 | if (parameterCharacterisations_ExternalCallInput == null) { |
| 96 | parameterCharacterisations_ExternalCallInput = new EObjectContainmentEList<VariableUsage>(VariableUsage.class, this, ComputedUsagePackage.EXTERNAL_CALL_INPUT__PARAMETER_CHARACTERISATIONS_EXTERNAL_CALL_INPUT); |
| 97 | } |
| 98 | return parameterCharacterisations_ExternalCallInput; |
| 99 | } |
| 100 | |
| 101 | /** |
| 102 | * <!-- begin-user-doc --> |
| 103 | * <!-- end-user-doc --> |
| 104 | * @generated |
| 105 | */ |
| 106 | public ExternalCallAction getExternalCallAction_ExternalCallInput() { |
| 107 | if (externalCallAction_ExternalCallInput != null && externalCallAction_ExternalCallInput.eIsProxy()) { |
| 108 | InternalEObject oldExternalCallAction_ExternalCallInput = (InternalEObject)externalCallAction_ExternalCallInput; |
| 109 | externalCallAction_ExternalCallInput = (ExternalCallAction)eResolveProxy(oldExternalCallAction_ExternalCallInput); |
| 110 | if (externalCallAction_ExternalCallInput != oldExternalCallAction_ExternalCallInput) { |
| 111 | if (eNotificationRequired()) |
| 112 | eNotify(new ENotificationImpl(this, Notification.RESOLVE, ComputedUsagePackage.EXTERNAL_CALL_INPUT__EXTERNAL_CALL_ACTION_EXTERNAL_CALL_INPUT, oldExternalCallAction_ExternalCallInput, externalCallAction_ExternalCallInput)); |
| 113 | } |
| 114 | } |
| 115 | return externalCallAction_ExternalCallInput; |
| 116 | } |
| 117 | |
| 118 | /** |
| 119 | * <!-- begin-user-doc --> |
| 120 | * <!-- end-user-doc --> |
| 121 | * @generated |
| 122 | */ |
| 123 | public ExternalCallAction basicGetExternalCallAction_ExternalCallInput() { |
| 124 | return externalCallAction_ExternalCallInput; |
| 125 | } |
| 126 | |
| 127 | /** |
| 128 | * <!-- begin-user-doc --> |
| 129 | * <!-- end-user-doc --> |
| 130 | * @generated |
| 131 | */ |
| 132 | public void setExternalCallAction_ExternalCallInput(ExternalCallAction newExternalCallAction_ExternalCallInput) { |
| 133 | ExternalCallAction oldExternalCallAction_ExternalCallInput = externalCallAction_ExternalCallInput; |
| 134 | externalCallAction_ExternalCallInput = newExternalCallAction_ExternalCallInput; |
| 135 | if (eNotificationRequired()) |
| 136 | eNotify(new ENotificationImpl(this, Notification.SET, ComputedUsagePackage.EXTERNAL_CALL_INPUT__EXTERNAL_CALL_ACTION_EXTERNAL_CALL_INPUT, oldExternalCallAction_ExternalCallInput, externalCallAction_ExternalCallInput)); |
| 137 | } |
| 138 | |
| 139 | /** |
| 140 | * <!-- begin-user-doc --> |
| 141 | * <!-- end-user-doc --> |
| 142 | * @generated |
| 143 | */ |
| 144 | public ComputedUsageContext getComputedUsageContext_ExternalCallInput() { |
| 145 | if (eContainerFeatureID() != ComputedUsagePackage.EXTERNAL_CALL_INPUT__COMPUTED_USAGE_CONTEXT_EXTERNAL_CALL_INPUT) return null; |
| 146 | return (ComputedUsageContext)eContainer(); |
| 147 | } |
| 148 | |
| 149 | /** |
| 150 | * <!-- begin-user-doc --> |
| 151 | * <!-- end-user-doc --> |
| 152 | * @generated |
| 153 | */ |
| 154 | public NotificationChain basicSetComputedUsageContext_ExternalCallInput(ComputedUsageContext newComputedUsageContext_ExternalCallInput, NotificationChain msgs) { |
| 155 | msgs = eBasicSetContainer((InternalEObject)newComputedUsageContext_ExternalCallInput, ComputedUsagePackage.EXTERNAL_CALL_INPUT__COMPUTED_USAGE_CONTEXT_EXTERNAL_CALL_INPUT, msgs); |
| 156 | return msgs; |
| 157 | } |
| 158 | |
| 159 | /** |
| 160 | * <!-- begin-user-doc --> |
| 161 | * <!-- end-user-doc --> |
| 162 | * @generated |
| 163 | */ |
| 164 | public void setComputedUsageContext_ExternalCallInput(ComputedUsageContext newComputedUsageContext_ExternalCallInput) { |
| 165 | if (newComputedUsageContext_ExternalCallInput != eInternalContainer() || (eContainerFeatureID() != ComputedUsagePackage.EXTERNAL_CALL_INPUT__COMPUTED_USAGE_CONTEXT_EXTERNAL_CALL_INPUT && newComputedUsageContext_ExternalCallInput != null)) { |
| 166 | if (EcoreUtil.isAncestor(this, newComputedUsageContext_ExternalCallInput)) |
| 167 | throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); |
| 168 | NotificationChain msgs = null; |
| 169 | if (eInternalContainer() != null) |
| 170 | msgs = eBasicRemoveFromContainer(msgs); |
| 171 | if (newComputedUsageContext_ExternalCallInput != null) |
| 172 | msgs = ((InternalEObject)newComputedUsageContext_ExternalCallInput).eInverseAdd(this, ComputedUsagePackage.COMPUTED_USAGE_CONTEXT__EXTERNAL_CALL_INPUT_COMPUTED_USAGE_CONTEXT, ComputedUsageContext.class, msgs); |
| 173 | msgs = basicSetComputedUsageContext_ExternalCallInput(newComputedUsageContext_ExternalCallInput, msgs); |
| 174 | if (msgs != null) msgs.dispatch(); |
| 175 | } |
| 176 | else if (eNotificationRequired()) |
| 177 | eNotify(new ENotificationImpl(this, Notification.SET, ComputedUsagePackage.EXTERNAL_CALL_INPUT__COMPUTED_USAGE_CONTEXT_EXTERNAL_CALL_INPUT, newComputedUsageContext_ExternalCallInput, newComputedUsageContext_ExternalCallInput)); |
| 178 | } |
| 179 | |
| 180 | /** |
| 181 | * <!-- begin-user-doc --> |
| 182 | * <!-- end-user-doc --> |
| 183 | * @generated |
| 184 | */ |
| 185 | @Override |
| 186 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| 187 | switch (featureID) { |
| 188 | case ComputedUsagePackage.EXTERNAL_CALL_INPUT__COMPUTED_USAGE_CONTEXT_EXTERNAL_CALL_INPUT: |
| 189 | if (eInternalContainer() != null) |
| 190 | msgs = eBasicRemoveFromContainer(msgs); |
| 191 | return basicSetComputedUsageContext_ExternalCallInput((ComputedUsageContext)otherEnd, msgs); |
| 192 | } |
| 193 | return super.eInverseAdd(otherEnd, featureID, msgs); |
| 194 | } |
| 195 | |
| 196 | /** |
| 197 | * <!-- begin-user-doc --> |
| 198 | * <!-- end-user-doc --> |
| 199 | * @generated |
| 200 | */ |
| 201 | @Override |
| 202 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| 203 | switch (featureID) { |
| 204 | case ComputedUsagePackage.EXTERNAL_CALL_INPUT__PARAMETER_CHARACTERISATIONS_EXTERNAL_CALL_INPUT: |
| 205 | return ((InternalEList<?>)getParameterCharacterisations_ExternalCallInput()).basicRemove(otherEnd, msgs); |
| 206 | case ComputedUsagePackage.EXTERNAL_CALL_INPUT__COMPUTED_USAGE_CONTEXT_EXTERNAL_CALL_INPUT: |
| 207 | return basicSetComputedUsageContext_ExternalCallInput(null, msgs); |
| 208 | } |
| 209 | return super.eInverseRemove(otherEnd, featureID, msgs); |
| 210 | } |
| 211 | |
| 212 | /** |
| 213 | * <!-- begin-user-doc --> |
| 214 | * <!-- end-user-doc --> |
| 215 | * @generated |
| 216 | */ |
| 217 | @Override |
| 218 | public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { |
| 219 | switch (eContainerFeatureID()) { |
| 220 | case ComputedUsagePackage.EXTERNAL_CALL_INPUT__COMPUTED_USAGE_CONTEXT_EXTERNAL_CALL_INPUT: |
| 221 | return eInternalContainer().eInverseRemove(this, ComputedUsagePackage.COMPUTED_USAGE_CONTEXT__EXTERNAL_CALL_INPUT_COMPUTED_USAGE_CONTEXT, ComputedUsageContext.class, msgs); |
| 222 | } |
| 223 | return super.eBasicRemoveFromContainerFeature(msgs); |
| 224 | } |
| 225 | |
| 226 | /** |
| 227 | * <!-- begin-user-doc --> |
| 228 | * <!-- end-user-doc --> |
| 229 | * @generated |
| 230 | */ |
| 231 | @Override |
| 232 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| 233 | switch (featureID) { |
| 234 | case ComputedUsagePackage.EXTERNAL_CALL_INPUT__PARAMETER_CHARACTERISATIONS_EXTERNAL_CALL_INPUT: |
| 235 | return getParameterCharacterisations_ExternalCallInput(); |
| 236 | case ComputedUsagePackage.EXTERNAL_CALL_INPUT__EXTERNAL_CALL_ACTION_EXTERNAL_CALL_INPUT: |
| 237 | if (resolve) return getExternalCallAction_ExternalCallInput(); |
| 238 | return basicGetExternalCallAction_ExternalCallInput(); |
| 239 | case ComputedUsagePackage.EXTERNAL_CALL_INPUT__COMPUTED_USAGE_CONTEXT_EXTERNAL_CALL_INPUT: |
| 240 | return getComputedUsageContext_ExternalCallInput(); |
| 241 | } |
| 242 | return super.eGet(featureID, resolve, coreType); |
| 243 | } |
| 244 | |
| 245 | /** |
| 246 | * <!-- begin-user-doc --> |
| 247 | * <!-- end-user-doc --> |
| 248 | * @generated |
| 249 | */ |
| 250 | @SuppressWarnings("unchecked") |
| 251 | @Override |
| 252 | public void eSet(int featureID, Object newValue) { |
| 253 | switch (featureID) { |
| 254 | case ComputedUsagePackage.EXTERNAL_CALL_INPUT__PARAMETER_CHARACTERISATIONS_EXTERNAL_CALL_INPUT: |
| 255 | getParameterCharacterisations_ExternalCallInput().clear(); |
| 256 | getParameterCharacterisations_ExternalCallInput().addAll((Collection<? extends VariableUsage>)newValue); |
| 257 | return; |
| 258 | case ComputedUsagePackage.EXTERNAL_CALL_INPUT__EXTERNAL_CALL_ACTION_EXTERNAL_CALL_INPUT: |
| 259 | setExternalCallAction_ExternalCallInput((ExternalCallAction)newValue); |
| 260 | return; |
| 261 | case ComputedUsagePackage.EXTERNAL_CALL_INPUT__COMPUTED_USAGE_CONTEXT_EXTERNAL_CALL_INPUT: |
| 262 | setComputedUsageContext_ExternalCallInput((ComputedUsageContext)newValue); |
| 263 | return; |
| 264 | } |
| 265 | super.eSet(featureID, newValue); |
| 266 | } |
| 267 | |
| 268 | /** |
| 269 | * <!-- begin-user-doc --> |
| 270 | * <!-- end-user-doc --> |
| 271 | * @generated |
| 272 | */ |
| 273 | @Override |
| 274 | public void eUnset(int featureID) { |
| 275 | switch (featureID) { |
| 276 | case ComputedUsagePackage.EXTERNAL_CALL_INPUT__PARAMETER_CHARACTERISATIONS_EXTERNAL_CALL_INPUT: |
| 277 | getParameterCharacterisations_ExternalCallInput().clear(); |
| 278 | return; |
| 279 | case ComputedUsagePackage.EXTERNAL_CALL_INPUT__EXTERNAL_CALL_ACTION_EXTERNAL_CALL_INPUT: |
| 280 | setExternalCallAction_ExternalCallInput((ExternalCallAction)null); |
| 281 | return; |
| 282 | case ComputedUsagePackage.EXTERNAL_CALL_INPUT__COMPUTED_USAGE_CONTEXT_EXTERNAL_CALL_INPUT: |
| 283 | setComputedUsageContext_ExternalCallInput((ComputedUsageContext)null); |
| 284 | return; |
| 285 | } |
| 286 | super.eUnset(featureID); |
| 287 | } |
| 288 | |
| 289 | /** |
| 290 | * <!-- begin-user-doc --> |
| 291 | * <!-- end-user-doc --> |
| 292 | * @generated |
| 293 | */ |
| 294 | @Override |
| 295 | public boolean eIsSet(int featureID) { |
| 296 | switch (featureID) { |
| 297 | case ComputedUsagePackage.EXTERNAL_CALL_INPUT__PARAMETER_CHARACTERISATIONS_EXTERNAL_CALL_INPUT: |
| 298 | return parameterCharacterisations_ExternalCallInput != null && !parameterCharacterisations_ExternalCallInput.isEmpty(); |
| 299 | case ComputedUsagePackage.EXTERNAL_CALL_INPUT__EXTERNAL_CALL_ACTION_EXTERNAL_CALL_INPUT: |
| 300 | return externalCallAction_ExternalCallInput != null; |
| 301 | case ComputedUsagePackage.EXTERNAL_CALL_INPUT__COMPUTED_USAGE_CONTEXT_EXTERNAL_CALL_INPUT: |
| 302 | return getComputedUsageContext_ExternalCallInput() != null; |
| 303 | } |
| 304 | return super.eIsSet(featureID); |
| 305 | } |
| 306 | |
| 307 | } //ExternalCallInputImpl |