| 1 | /** |
| 2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
| 3 | * |
| 4 | * $Id$ |
| 5 | */ |
| 6 | package de.uka.ipd.sdq.pcm.parameter.impl; |
| 7 | |
| 8 | import org.eclipse.emf.common.notify.Notification; |
| 9 | import org.eclipse.emf.common.notify.NotificationChain; |
| 10 | import org.eclipse.emf.ecore.EClass; |
| 11 | import org.eclipse.emf.ecore.InternalEObject; |
| 12 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| 13 | import org.eclipse.emf.ecore.impl.EObjectImpl; |
| 14 | import org.eclipse.emf.ecore.util.EcoreUtil; |
| 15 | |
| 16 | import de.uka.ipd.sdq.pcm.core.CorePackage; |
| 17 | import de.uka.ipd.sdq.pcm.core.PCMRandomVariable; |
| 18 | import de.uka.ipd.sdq.pcm.parameter.ParameterPackage; |
| 19 | import de.uka.ipd.sdq.pcm.parameter.VariableCharacterisation; |
| 20 | import de.uka.ipd.sdq.pcm.parameter.VariableCharacterisationType; |
| 21 | import de.uka.ipd.sdq.pcm.parameter.VariableUsage; |
| 22 | |
| 23 | /** |
| 24 | * <!-- begin-user-doc --> |
| 25 | * An implementation of the model object '<em><b>Variable Characterisation</b></em>'. |
| 26 | * <!-- end-user-doc --> |
| 27 | * <p> |
| 28 | * The following features are implemented: |
| 29 | * <ul> |
| 30 | * <li>{@link de.uka.ipd.sdq.pcm.parameter.impl.VariableCharacterisationImpl#getType <em>Type</em>}</li> |
| 31 | * <li>{@link de.uka.ipd.sdq.pcm.parameter.impl.VariableCharacterisationImpl#getSpecification_VariableCharacterisation <em>Specification Variable Characterisation</em>}</li> |
| 32 | * <li>{@link de.uka.ipd.sdq.pcm.parameter.impl.VariableCharacterisationImpl#getVariableUsage_VariableCharacterisation <em>Variable Usage Variable Characterisation</em>}</li> |
| 33 | * </ul> |
| 34 | * </p> |
| 35 | * |
| 36 | * @generated |
| 37 | */ |
| 38 | public class VariableCharacterisationImpl extends EObjectImpl implements VariableCharacterisation { |
| 39 | /** |
| 40 | * <!-- begin-user-doc --> |
| 41 | * <!-- end-user-doc --> |
| 42 | * @generated |
| 43 | */ |
| 44 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
| 45 | |
| 46 | /** |
| 47 | * The default value of the '{@link #getType() <em>Type</em>}' attribute. |
| 48 | * <!-- begin-user-doc --> |
| 49 | * <!-- end-user-doc --> |
| 50 | * @see #getType() |
| 51 | * @generated |
| 52 | * @ordered |
| 53 | */ |
| 54 | protected static final VariableCharacterisationType TYPE_EDEFAULT = VariableCharacterisationType.STRUCTURE; |
| 55 | |
| 56 | /** |
| 57 | * The cached value of the '{@link #getType() <em>Type</em>}' attribute. |
| 58 | * <!-- begin-user-doc --> |
| 59 | * <!-- end-user-doc --> |
| 60 | * @see #getType() |
| 61 | * @generated |
| 62 | * @ordered |
| 63 | */ |
| 64 | protected VariableCharacterisationType type = TYPE_EDEFAULT; |
| 65 | |
| 66 | /** |
| 67 | * The cached value of the '{@link #getSpecification_VariableCharacterisation() <em>Specification Variable Characterisation</em>}' containment reference. |
| 68 | * <!-- begin-user-doc --> |
| 69 | * <!-- end-user-doc --> |
| 70 | * @see #getSpecification_VariableCharacterisation() |
| 71 | * @generated |
| 72 | * @ordered |
| 73 | */ |
| 74 | protected PCMRandomVariable specification_VariableCharacterisation; |
| 75 | |
| 76 | /** |
| 77 | * <!-- begin-user-doc --> |
| 78 | * <!-- end-user-doc --> |
| 79 | * @generated |
| 80 | */ |
| 81 | protected VariableCharacterisationImpl() { |
| 82 | super(); |
| 83 | } |
| 84 | |
| 85 | /** |
| 86 | * <!-- begin-user-doc --> |
| 87 | * <!-- end-user-doc --> |
| 88 | * @generated |
| 89 | */ |
| 90 | @Override |
| 91 | protected EClass eStaticClass() { |
| 92 | return ParameterPackage.Literals.VARIABLE_CHARACTERISATION; |
| 93 | } |
| 94 | |
| 95 | /** |
| 96 | * <!-- begin-user-doc --> |
| 97 | * <!-- end-user-doc --> |
| 98 | * @generated |
| 99 | */ |
| 100 | public VariableCharacterisationType getType() { |
| 101 | return type; |
| 102 | } |
| 103 | |
| 104 | /** |
| 105 | * <!-- begin-user-doc --> |
| 106 | * <!-- end-user-doc --> |
| 107 | * @generated |
| 108 | */ |
| 109 | public void setType(VariableCharacterisationType newType) { |
| 110 | VariableCharacterisationType oldType = type; |
| 111 | type = newType == null ? TYPE_EDEFAULT : newType; |
| 112 | if (eNotificationRequired()) |
| 113 | eNotify(new ENotificationImpl(this, Notification.SET, ParameterPackage.VARIABLE_CHARACTERISATION__TYPE, oldType, type)); |
| 114 | } |
| 115 | |
| 116 | /** |
| 117 | * <!-- begin-user-doc --> |
| 118 | * <!-- end-user-doc --> |
| 119 | * @generated |
| 120 | */ |
| 121 | public PCMRandomVariable getSpecification_VariableCharacterisation() { |
| 122 | return specification_VariableCharacterisation; |
| 123 | } |
| 124 | |
| 125 | /** |
| 126 | * <!-- begin-user-doc --> |
| 127 | * <!-- end-user-doc --> |
| 128 | * @generated |
| 129 | */ |
| 130 | public NotificationChain basicSetSpecification_VariableCharacterisation(PCMRandomVariable newSpecification_VariableCharacterisation, NotificationChain msgs) { |
| 131 | PCMRandomVariable oldSpecification_VariableCharacterisation = specification_VariableCharacterisation; |
| 132 | specification_VariableCharacterisation = newSpecification_VariableCharacterisation; |
| 133 | if (eNotificationRequired()) { |
| 134 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ParameterPackage.VARIABLE_CHARACTERISATION__SPECIFICATION_VARIABLE_CHARACTERISATION, oldSpecification_VariableCharacterisation, newSpecification_VariableCharacterisation); |
| 135 | if (msgs == null) msgs = notification; else msgs.add(notification); |
| 136 | } |
| 137 | return msgs; |
| 138 | } |
| 139 | |
| 140 | /** |
| 141 | * <!-- begin-user-doc --> |
| 142 | * <!-- end-user-doc --> |
| 143 | * @generated |
| 144 | */ |
| 145 | public void setSpecification_VariableCharacterisation(PCMRandomVariable newSpecification_VariableCharacterisation) { |
| 146 | if (newSpecification_VariableCharacterisation != specification_VariableCharacterisation) { |
| 147 | NotificationChain msgs = null; |
| 148 | if (specification_VariableCharacterisation != null) |
| 149 | msgs = ((InternalEObject)specification_VariableCharacterisation).eInverseRemove(this, CorePackage.PCM_RANDOM_VARIABLE__VARIABLE_CHARACTERISATION_SPECIFICATION, PCMRandomVariable.class, msgs); |
| 150 | if (newSpecification_VariableCharacterisation != null) |
| 151 | msgs = ((InternalEObject)newSpecification_VariableCharacterisation).eInverseAdd(this, CorePackage.PCM_RANDOM_VARIABLE__VARIABLE_CHARACTERISATION_SPECIFICATION, PCMRandomVariable.class, msgs); |
| 152 | msgs = basicSetSpecification_VariableCharacterisation(newSpecification_VariableCharacterisation, msgs); |
| 153 | if (msgs != null) msgs.dispatch(); |
| 154 | } |
| 155 | else if (eNotificationRequired()) |
| 156 | eNotify(new ENotificationImpl(this, Notification.SET, ParameterPackage.VARIABLE_CHARACTERISATION__SPECIFICATION_VARIABLE_CHARACTERISATION, newSpecification_VariableCharacterisation, newSpecification_VariableCharacterisation)); |
| 157 | } |
| 158 | |
| 159 | /** |
| 160 | * <!-- begin-user-doc --> |
| 161 | * <!-- end-user-doc --> |
| 162 | * @generated |
| 163 | */ |
| 164 | public VariableUsage getVariableUsage_VariableCharacterisation() { |
| 165 | if (eContainerFeatureID() != ParameterPackage.VARIABLE_CHARACTERISATION__VARIABLE_USAGE_VARIABLE_CHARACTERISATION) return null; |
| 166 | return (VariableUsage)eContainer(); |
| 167 | } |
| 168 | |
| 169 | /** |
| 170 | * <!-- begin-user-doc --> |
| 171 | * <!-- end-user-doc --> |
| 172 | * @generated |
| 173 | */ |
| 174 | public NotificationChain basicSetVariableUsage_VariableCharacterisation(VariableUsage newVariableUsage_VariableCharacterisation, NotificationChain msgs) { |
| 175 | msgs = eBasicSetContainer((InternalEObject)newVariableUsage_VariableCharacterisation, ParameterPackage.VARIABLE_CHARACTERISATION__VARIABLE_USAGE_VARIABLE_CHARACTERISATION, msgs); |
| 176 | return msgs; |
| 177 | } |
| 178 | |
| 179 | /** |
| 180 | * <!-- begin-user-doc --> |
| 181 | * <!-- end-user-doc --> |
| 182 | * @generated |
| 183 | */ |
| 184 | public void setVariableUsage_VariableCharacterisation(VariableUsage newVariableUsage_VariableCharacterisation) { |
| 185 | if (newVariableUsage_VariableCharacterisation != eInternalContainer() || (eContainerFeatureID() != ParameterPackage.VARIABLE_CHARACTERISATION__VARIABLE_USAGE_VARIABLE_CHARACTERISATION && newVariableUsage_VariableCharacterisation != null)) { |
| 186 | if (EcoreUtil.isAncestor(this, newVariableUsage_VariableCharacterisation)) |
| 187 | throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); |
| 188 | NotificationChain msgs = null; |
| 189 | if (eInternalContainer() != null) |
| 190 | msgs = eBasicRemoveFromContainer(msgs); |
| 191 | if (newVariableUsage_VariableCharacterisation != null) |
| 192 | msgs = ((InternalEObject)newVariableUsage_VariableCharacterisation).eInverseAdd(this, ParameterPackage.VARIABLE_USAGE__VARIABLE_CHARACTERISATION_VARIABLE_USAGE, VariableUsage.class, msgs); |
| 193 | msgs = basicSetVariableUsage_VariableCharacterisation(newVariableUsage_VariableCharacterisation, msgs); |
| 194 | if (msgs != null) msgs.dispatch(); |
| 195 | } |
| 196 | else if (eNotificationRequired()) |
| 197 | eNotify(new ENotificationImpl(this, Notification.SET, ParameterPackage.VARIABLE_CHARACTERISATION__VARIABLE_USAGE_VARIABLE_CHARACTERISATION, newVariableUsage_VariableCharacterisation, newVariableUsage_VariableCharacterisation)); |
| 198 | } |
| 199 | |
| 200 | /** |
| 201 | * <!-- begin-user-doc --> |
| 202 | * <!-- end-user-doc --> |
| 203 | * @generated |
| 204 | */ |
| 205 | @Override |
| 206 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| 207 | switch (featureID) { |
| 208 | case ParameterPackage.VARIABLE_CHARACTERISATION__SPECIFICATION_VARIABLE_CHARACTERISATION: |
| 209 | if (specification_VariableCharacterisation != null) |
| 210 | msgs = ((InternalEObject)specification_VariableCharacterisation).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ParameterPackage.VARIABLE_CHARACTERISATION__SPECIFICATION_VARIABLE_CHARACTERISATION, null, msgs); |
| 211 | return basicSetSpecification_VariableCharacterisation((PCMRandomVariable)otherEnd, msgs); |
| 212 | case ParameterPackage.VARIABLE_CHARACTERISATION__VARIABLE_USAGE_VARIABLE_CHARACTERISATION: |
| 213 | if (eInternalContainer() != null) |
| 214 | msgs = eBasicRemoveFromContainer(msgs); |
| 215 | return basicSetVariableUsage_VariableCharacterisation((VariableUsage)otherEnd, msgs); |
| 216 | } |
| 217 | return super.eInverseAdd(otherEnd, featureID, msgs); |
| 218 | } |
| 219 | |
| 220 | /** |
| 221 | * <!-- begin-user-doc --> |
| 222 | * <!-- end-user-doc --> |
| 223 | * @generated |
| 224 | */ |
| 225 | @Override |
| 226 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| 227 | switch (featureID) { |
| 228 | case ParameterPackage.VARIABLE_CHARACTERISATION__SPECIFICATION_VARIABLE_CHARACTERISATION: |
| 229 | return basicSetSpecification_VariableCharacterisation(null, msgs); |
| 230 | case ParameterPackage.VARIABLE_CHARACTERISATION__VARIABLE_USAGE_VARIABLE_CHARACTERISATION: |
| 231 | return basicSetVariableUsage_VariableCharacterisation(null, msgs); |
| 232 | } |
| 233 | return super.eInverseRemove(otherEnd, featureID, msgs); |
| 234 | } |
| 235 | |
| 236 | /** |
| 237 | * <!-- begin-user-doc --> |
| 238 | * <!-- end-user-doc --> |
| 239 | * @generated |
| 240 | */ |
| 241 | @Override |
| 242 | public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { |
| 243 | switch (eContainerFeatureID()) { |
| 244 | case ParameterPackage.VARIABLE_CHARACTERISATION__VARIABLE_USAGE_VARIABLE_CHARACTERISATION: |
| 245 | return eInternalContainer().eInverseRemove(this, ParameterPackage.VARIABLE_USAGE__VARIABLE_CHARACTERISATION_VARIABLE_USAGE, VariableUsage.class, msgs); |
| 246 | } |
| 247 | return super.eBasicRemoveFromContainerFeature(msgs); |
| 248 | } |
| 249 | |
| 250 | /** |
| 251 | * <!-- begin-user-doc --> |
| 252 | * <!-- end-user-doc --> |
| 253 | * @generated |
| 254 | */ |
| 255 | @Override |
| 256 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| 257 | switch (featureID) { |
| 258 | case ParameterPackage.VARIABLE_CHARACTERISATION__TYPE: |
| 259 | return getType(); |
| 260 | case ParameterPackage.VARIABLE_CHARACTERISATION__SPECIFICATION_VARIABLE_CHARACTERISATION: |
| 261 | return getSpecification_VariableCharacterisation(); |
| 262 | case ParameterPackage.VARIABLE_CHARACTERISATION__VARIABLE_USAGE_VARIABLE_CHARACTERISATION: |
| 263 | return getVariableUsage_VariableCharacterisation(); |
| 264 | } |
| 265 | return super.eGet(featureID, resolve, coreType); |
| 266 | } |
| 267 | |
| 268 | /** |
| 269 | * <!-- begin-user-doc --> |
| 270 | * <!-- end-user-doc --> |
| 271 | * @generated |
| 272 | */ |
| 273 | @Override |
| 274 | public void eSet(int featureID, Object newValue) { |
| 275 | switch (featureID) { |
| 276 | case ParameterPackage.VARIABLE_CHARACTERISATION__TYPE: |
| 277 | setType((VariableCharacterisationType)newValue); |
| 278 | return; |
| 279 | case ParameterPackage.VARIABLE_CHARACTERISATION__SPECIFICATION_VARIABLE_CHARACTERISATION: |
| 280 | setSpecification_VariableCharacterisation((PCMRandomVariable)newValue); |
| 281 | return; |
| 282 | case ParameterPackage.VARIABLE_CHARACTERISATION__VARIABLE_USAGE_VARIABLE_CHARACTERISATION: |
| 283 | setVariableUsage_VariableCharacterisation((VariableUsage)newValue); |
| 284 | return; |
| 285 | } |
| 286 | super.eSet(featureID, newValue); |
| 287 | } |
| 288 | |
| 289 | /** |
| 290 | * <!-- begin-user-doc --> |
| 291 | * <!-- end-user-doc --> |
| 292 | * @generated |
| 293 | */ |
| 294 | @Override |
| 295 | public void eUnset(int featureID) { |
| 296 | switch (featureID) { |
| 297 | case ParameterPackage.VARIABLE_CHARACTERISATION__TYPE: |
| 298 | setType(TYPE_EDEFAULT); |
| 299 | return; |
| 300 | case ParameterPackage.VARIABLE_CHARACTERISATION__SPECIFICATION_VARIABLE_CHARACTERISATION: |
| 301 | setSpecification_VariableCharacterisation((PCMRandomVariable)null); |
| 302 | return; |
| 303 | case ParameterPackage.VARIABLE_CHARACTERISATION__VARIABLE_USAGE_VARIABLE_CHARACTERISATION: |
| 304 | setVariableUsage_VariableCharacterisation((VariableUsage)null); |
| 305 | return; |
| 306 | } |
| 307 | super.eUnset(featureID); |
| 308 | } |
| 309 | |
| 310 | /** |
| 311 | * <!-- begin-user-doc --> |
| 312 | * <!-- end-user-doc --> |
| 313 | * @generated |
| 314 | */ |
| 315 | @Override |
| 316 | public boolean eIsSet(int featureID) { |
| 317 | switch (featureID) { |
| 318 | case ParameterPackage.VARIABLE_CHARACTERISATION__TYPE: |
| 319 | return type != TYPE_EDEFAULT; |
| 320 | case ParameterPackage.VARIABLE_CHARACTERISATION__SPECIFICATION_VARIABLE_CHARACTERISATION: |
| 321 | return specification_VariableCharacterisation != null; |
| 322 | case ParameterPackage.VARIABLE_CHARACTERISATION__VARIABLE_USAGE_VARIABLE_CHARACTERISATION: |
| 323 | return getVariableUsage_VariableCharacterisation() != null; |
| 324 | } |
| 325 | return super.eIsSet(featureID); |
| 326 | } |
| 327 | |
| 328 | /** |
| 329 | * <!-- begin-user-doc --> |
| 330 | * <!-- end-user-doc --> |
| 331 | * @generated |
| 332 | */ |
| 333 | @Override |
| 334 | public String toString() { |
| 335 | if (eIsProxy()) return super.toString(); |
| 336 | |
| 337 | StringBuffer result = new StringBuffer(super.toString()); |
| 338 | result.append(" (type: "); |
| 339 | result.append(type); |
| 340 | result.append(')'); |
| 341 | return result.toString(); |
| 342 | } |
| 343 | |
| 344 | } //VariableCharacterisationImpl |