| 1 | /** |
| 2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
| 3 | * |
| 4 | * $Id$ |
| 5 | */ |
| 6 | package de.uka.ipd.sdq.pcm.repository.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.util.EcoreUtil; |
| 14 | |
| 15 | import de.uka.ipd.sdq.pcm.repository.EventGroup; |
| 16 | import de.uka.ipd.sdq.pcm.repository.EventType; |
| 17 | import de.uka.ipd.sdq.pcm.repository.Parameter; |
| 18 | import de.uka.ipd.sdq.pcm.repository.RepositoryPackage; |
| 19 | |
| 20 | /** |
| 21 | * <!-- begin-user-doc --> |
| 22 | * An implementation of the model object '<em><b>Event Type</b></em>'. |
| 23 | * <!-- end-user-doc --> |
| 24 | * <p> |
| 25 | * The following features are implemented: |
| 26 | * <ul> |
| 27 | * <li>{@link de.uka.ipd.sdq.pcm.repository.impl.EventTypeImpl#getParameter__EventType <em>Parameter Event Type</em>}</li> |
| 28 | * <li>{@link de.uka.ipd.sdq.pcm.repository.impl.EventTypeImpl#getEventGroup__EventType <em>Event Group Event Type</em>}</li> |
| 29 | * </ul> |
| 30 | * </p> |
| 31 | * |
| 32 | * @generated |
| 33 | */ |
| 34 | public class EventTypeImpl extends SignatureImpl implements EventType { |
| 35 | /** |
| 36 | * <!-- begin-user-doc --> |
| 37 | * <!-- end-user-doc --> |
| 38 | * @generated |
| 39 | */ |
| 40 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
| 41 | |
| 42 | /** |
| 43 | * The cached value of the '{@link #getParameter__EventType() <em>Parameter Event Type</em>}' containment reference. |
| 44 | * <!-- begin-user-doc --> |
| 45 | * <!-- end-user-doc --> |
| 46 | * @see #getParameter__EventType() |
| 47 | * @generated |
| 48 | * @ordered |
| 49 | */ |
| 50 | protected Parameter parameter__EventType; |
| 51 | |
| 52 | /** |
| 53 | * <!-- begin-user-doc --> |
| 54 | * <!-- end-user-doc --> |
| 55 | * @generated |
| 56 | */ |
| 57 | protected EventTypeImpl() { |
| 58 | super(); |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * <!-- begin-user-doc --> |
| 63 | * <!-- end-user-doc --> |
| 64 | * @generated |
| 65 | */ |
| 66 | @Override |
| 67 | protected EClass eStaticClass() { |
| 68 | return RepositoryPackage.Literals.EVENT_TYPE; |
| 69 | } |
| 70 | |
| 71 | /** |
| 72 | * <!-- begin-user-doc --> |
| 73 | * <!-- end-user-doc --> |
| 74 | * @generated |
| 75 | */ |
| 76 | public EventGroup getEventGroup__EventType() { |
| 77 | if (eContainerFeatureID() != RepositoryPackage.EVENT_TYPE__EVENT_GROUP_EVENT_TYPE) return null; |
| 78 | return (EventGroup)eContainer(); |
| 79 | } |
| 80 | |
| 81 | /** |
| 82 | * <!-- begin-user-doc --> |
| 83 | * <!-- end-user-doc --> |
| 84 | * @generated |
| 85 | */ |
| 86 | public NotificationChain basicSetEventGroup__EventType(EventGroup newEventGroup__EventType, NotificationChain msgs) { |
| 87 | msgs = eBasicSetContainer((InternalEObject)newEventGroup__EventType, RepositoryPackage.EVENT_TYPE__EVENT_GROUP_EVENT_TYPE, msgs); |
| 88 | return msgs; |
| 89 | } |
| 90 | |
| 91 | /** |
| 92 | * <!-- begin-user-doc --> |
| 93 | * <!-- end-user-doc --> |
| 94 | * @generated |
| 95 | */ |
| 96 | public void setEventGroup__EventType(EventGroup newEventGroup__EventType) { |
| 97 | if (newEventGroup__EventType != eInternalContainer() || (eContainerFeatureID() != RepositoryPackage.EVENT_TYPE__EVENT_GROUP_EVENT_TYPE && newEventGroup__EventType != null)) { |
| 98 | if (EcoreUtil.isAncestor(this, newEventGroup__EventType)) |
| 99 | throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); |
| 100 | NotificationChain msgs = null; |
| 101 | if (eInternalContainer() != null) |
| 102 | msgs = eBasicRemoveFromContainer(msgs); |
| 103 | if (newEventGroup__EventType != null) |
| 104 | msgs = ((InternalEObject)newEventGroup__EventType).eInverseAdd(this, RepositoryPackage.EVENT_GROUP__EVENT_TYPES_EVENT_GROUP, EventGroup.class, msgs); |
| 105 | msgs = basicSetEventGroup__EventType(newEventGroup__EventType, msgs); |
| 106 | if (msgs != null) msgs.dispatch(); |
| 107 | } |
| 108 | else if (eNotificationRequired()) |
| 109 | eNotify(new ENotificationImpl(this, Notification.SET, RepositoryPackage.EVENT_TYPE__EVENT_GROUP_EVENT_TYPE, newEventGroup__EventType, newEventGroup__EventType)); |
| 110 | } |
| 111 | |
| 112 | /** |
| 113 | * <!-- begin-user-doc --> |
| 114 | * <!-- end-user-doc --> |
| 115 | * @generated |
| 116 | */ |
| 117 | public Parameter getParameter__EventType() { |
| 118 | return parameter__EventType; |
| 119 | } |
| 120 | |
| 121 | /** |
| 122 | * <!-- begin-user-doc --> |
| 123 | * <!-- end-user-doc --> |
| 124 | * @generated |
| 125 | */ |
| 126 | public NotificationChain basicSetParameter__EventType(Parameter newParameter__EventType, NotificationChain msgs) { |
| 127 | Parameter oldParameter__EventType = parameter__EventType; |
| 128 | parameter__EventType = newParameter__EventType; |
| 129 | if (eNotificationRequired()) { |
| 130 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, RepositoryPackage.EVENT_TYPE__PARAMETER_EVENT_TYPE, oldParameter__EventType, newParameter__EventType); |
| 131 | if (msgs == null) msgs = notification; else msgs.add(notification); |
| 132 | } |
| 133 | return msgs; |
| 134 | } |
| 135 | |
| 136 | /** |
| 137 | * <!-- begin-user-doc --> |
| 138 | * <!-- end-user-doc --> |
| 139 | * @generated |
| 140 | */ |
| 141 | public void setParameter__EventType(Parameter newParameter__EventType) { |
| 142 | if (newParameter__EventType != parameter__EventType) { |
| 143 | NotificationChain msgs = null; |
| 144 | if (parameter__EventType != null) |
| 145 | msgs = ((InternalEObject)parameter__EventType).eInverseRemove(this, RepositoryPackage.PARAMETER__EVENT_TYPE_PARAMETER, Parameter.class, msgs); |
| 146 | if (newParameter__EventType != null) |
| 147 | msgs = ((InternalEObject)newParameter__EventType).eInverseAdd(this, RepositoryPackage.PARAMETER__EVENT_TYPE_PARAMETER, Parameter.class, msgs); |
| 148 | msgs = basicSetParameter__EventType(newParameter__EventType, msgs); |
| 149 | if (msgs != null) msgs.dispatch(); |
| 150 | } |
| 151 | else if (eNotificationRequired()) |
| 152 | eNotify(new ENotificationImpl(this, Notification.SET, RepositoryPackage.EVENT_TYPE__PARAMETER_EVENT_TYPE, newParameter__EventType, newParameter__EventType)); |
| 153 | } |
| 154 | |
| 155 | /** |
| 156 | * <!-- begin-user-doc --> |
| 157 | * <!-- end-user-doc --> |
| 158 | * @generated |
| 159 | */ |
| 160 | @Override |
| 161 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| 162 | switch (featureID) { |
| 163 | case RepositoryPackage.EVENT_TYPE__PARAMETER_EVENT_TYPE: |
| 164 | if (parameter__EventType != null) |
| 165 | msgs = ((InternalEObject)parameter__EventType).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - RepositoryPackage.EVENT_TYPE__PARAMETER_EVENT_TYPE, null, msgs); |
| 166 | return basicSetParameter__EventType((Parameter)otherEnd, msgs); |
| 167 | case RepositoryPackage.EVENT_TYPE__EVENT_GROUP_EVENT_TYPE: |
| 168 | if (eInternalContainer() != null) |
| 169 | msgs = eBasicRemoveFromContainer(msgs); |
| 170 | return basicSetEventGroup__EventType((EventGroup)otherEnd, msgs); |
| 171 | } |
| 172 | return super.eInverseAdd(otherEnd, featureID, msgs); |
| 173 | } |
| 174 | |
| 175 | /** |
| 176 | * <!-- begin-user-doc --> |
| 177 | * <!-- end-user-doc --> |
| 178 | * @generated |
| 179 | */ |
| 180 | @Override |
| 181 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| 182 | switch (featureID) { |
| 183 | case RepositoryPackage.EVENT_TYPE__PARAMETER_EVENT_TYPE: |
| 184 | return basicSetParameter__EventType(null, msgs); |
| 185 | case RepositoryPackage.EVENT_TYPE__EVENT_GROUP_EVENT_TYPE: |
| 186 | return basicSetEventGroup__EventType(null, msgs); |
| 187 | } |
| 188 | return super.eInverseRemove(otherEnd, featureID, msgs); |
| 189 | } |
| 190 | |
| 191 | /** |
| 192 | * <!-- begin-user-doc --> |
| 193 | * <!-- end-user-doc --> |
| 194 | * @generated |
| 195 | */ |
| 196 | @Override |
| 197 | public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { |
| 198 | switch (eContainerFeatureID()) { |
| 199 | case RepositoryPackage.EVENT_TYPE__EVENT_GROUP_EVENT_TYPE: |
| 200 | return eInternalContainer().eInverseRemove(this, RepositoryPackage.EVENT_GROUP__EVENT_TYPES_EVENT_GROUP, EventGroup.class, msgs); |
| 201 | } |
| 202 | return super.eBasicRemoveFromContainerFeature(msgs); |
| 203 | } |
| 204 | |
| 205 | /** |
| 206 | * <!-- begin-user-doc --> |
| 207 | * <!-- end-user-doc --> |
| 208 | * @generated |
| 209 | */ |
| 210 | @Override |
| 211 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| 212 | switch (featureID) { |
| 213 | case RepositoryPackage.EVENT_TYPE__PARAMETER_EVENT_TYPE: |
| 214 | return getParameter__EventType(); |
| 215 | case RepositoryPackage.EVENT_TYPE__EVENT_GROUP_EVENT_TYPE: |
| 216 | return getEventGroup__EventType(); |
| 217 | } |
| 218 | return super.eGet(featureID, resolve, coreType); |
| 219 | } |
| 220 | |
| 221 | /** |
| 222 | * <!-- begin-user-doc --> |
| 223 | * <!-- end-user-doc --> |
| 224 | * @generated |
| 225 | */ |
| 226 | @Override |
| 227 | public void eSet(int featureID, Object newValue) { |
| 228 | switch (featureID) { |
| 229 | case RepositoryPackage.EVENT_TYPE__PARAMETER_EVENT_TYPE: |
| 230 | setParameter__EventType((Parameter)newValue); |
| 231 | return; |
| 232 | case RepositoryPackage.EVENT_TYPE__EVENT_GROUP_EVENT_TYPE: |
| 233 | setEventGroup__EventType((EventGroup)newValue); |
| 234 | return; |
| 235 | } |
| 236 | super.eSet(featureID, newValue); |
| 237 | } |
| 238 | |
| 239 | /** |
| 240 | * <!-- begin-user-doc --> |
| 241 | * <!-- end-user-doc --> |
| 242 | * @generated |
| 243 | */ |
| 244 | @Override |
| 245 | public void eUnset(int featureID) { |
| 246 | switch (featureID) { |
| 247 | case RepositoryPackage.EVENT_TYPE__PARAMETER_EVENT_TYPE: |
| 248 | setParameter__EventType((Parameter)null); |
| 249 | return; |
| 250 | case RepositoryPackage.EVENT_TYPE__EVENT_GROUP_EVENT_TYPE: |
| 251 | setEventGroup__EventType((EventGroup)null); |
| 252 | return; |
| 253 | } |
| 254 | super.eUnset(featureID); |
| 255 | } |
| 256 | |
| 257 | /** |
| 258 | * <!-- begin-user-doc --> |
| 259 | * <!-- end-user-doc --> |
| 260 | * @generated |
| 261 | */ |
| 262 | @Override |
| 263 | public boolean eIsSet(int featureID) { |
| 264 | switch (featureID) { |
| 265 | case RepositoryPackage.EVENT_TYPE__PARAMETER_EVENT_TYPE: |
| 266 | return parameter__EventType != null; |
| 267 | case RepositoryPackage.EVENT_TYPE__EVENT_GROUP_EVENT_TYPE: |
| 268 | return getEventGroup__EventType() != null; |
| 269 | } |
| 270 | return super.eIsSet(featureID); |
| 271 | } |
| 272 | |
| 273 | } //EventTypeImpl |