| 1 | /** |
| 2 | * <copyright> |
| 3 | * </copyright> |
| 4 | * |
| 5 | * $Id$ |
| 6 | */ |
| 7 | package EMOF.impl; |
| 8 | |
| 9 | import EMOF.EMOFPackage; |
| 10 | import EMOF.Enumeration; |
| 11 | import EMOF.EnumerationLiteral; |
| 12 | |
| 13 | import org.eclipse.emf.common.notify.Notification; |
| 14 | import org.eclipse.emf.common.notify.NotificationChain; |
| 15 | |
| 16 | import org.eclipse.emf.ecore.EClass; |
| 17 | import org.eclipse.emf.ecore.InternalEObject; |
| 18 | |
| 19 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| 20 | |
| 21 | import org.eclipse.emf.ecore.util.EcoreUtil; |
| 22 | |
| 23 | /** |
| 24 | * <!-- begin-user-doc --> |
| 25 | * An implementation of the model object '<em><b>Enumeration Literal</b></em>'. |
| 26 | * <!-- end-user-doc --> |
| 27 | * <p> |
| 28 | * The following features are implemented: |
| 29 | * <ul> |
| 30 | * <li>{@link EMOF.impl.EnumerationLiteralImpl#getEnumeration <em>Enumeration</em>}</li> |
| 31 | * </ul> |
| 32 | * </p> |
| 33 | * |
| 34 | * @generated |
| 35 | */ |
| 36 | public class EnumerationLiteralImpl extends NamedElementImpl implements EnumerationLiteral { |
| 37 | /** |
| 38 | * <!-- begin-user-doc --> |
| 39 | * <!-- end-user-doc --> |
| 40 | * @generated |
| 41 | */ |
| 42 | protected EnumerationLiteralImpl() { |
| 43 | super(); |
| 44 | } |
| 45 | |
| 46 | /** |
| 47 | * <!-- begin-user-doc --> |
| 48 | * <!-- end-user-doc --> |
| 49 | * @generated |
| 50 | */ |
| 51 | @Override |
| 52 | protected EClass eStaticClass() { |
| 53 | return EMOFPackage.Literals.ENUMERATION_LITERAL; |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * <!-- begin-user-doc --> |
| 58 | * <!-- end-user-doc --> |
| 59 | * @generated |
| 60 | */ |
| 61 | public Enumeration getEnumeration() { |
| 62 | if (eContainerFeatureID() != EMOFPackage.ENUMERATION_LITERAL__ENUMERATION) return null; |
| 63 | return (Enumeration)eContainer(); |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * <!-- begin-user-doc --> |
| 68 | * <!-- end-user-doc --> |
| 69 | * @generated |
| 70 | */ |
| 71 | public NotificationChain basicSetEnumeration(Enumeration newEnumeration, NotificationChain msgs) { |
| 72 | msgs = eBasicSetContainer((InternalEObject)newEnumeration, EMOFPackage.ENUMERATION_LITERAL__ENUMERATION, msgs); |
| 73 | return msgs; |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * <!-- begin-user-doc --> |
| 78 | * <!-- end-user-doc --> |
| 79 | * @generated |
| 80 | */ |
| 81 | public void setEnumeration(Enumeration newEnumeration) { |
| 82 | if (newEnumeration != eInternalContainer() || (eContainerFeatureID() != EMOFPackage.ENUMERATION_LITERAL__ENUMERATION && newEnumeration != null)) { |
| 83 | if (EcoreUtil.isAncestor(this, newEnumeration)) |
| 84 | throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); |
| 85 | NotificationChain msgs = null; |
| 86 | if (eInternalContainer() != null) |
| 87 | msgs = eBasicRemoveFromContainer(msgs); |
| 88 | if (newEnumeration != null) |
| 89 | msgs = ((InternalEObject)newEnumeration).eInverseAdd(this, EMOFPackage.ENUMERATION__OWNED_LITERAL, Enumeration.class, msgs); |
| 90 | msgs = basicSetEnumeration(newEnumeration, msgs); |
| 91 | if (msgs != null) msgs.dispatch(); |
| 92 | } |
| 93 | else if (eNotificationRequired()) |
| 94 | eNotify(new ENotificationImpl(this, Notification.SET, EMOFPackage.ENUMERATION_LITERAL__ENUMERATION, newEnumeration, newEnumeration)); |
| 95 | } |
| 96 | |
| 97 | /** |
| 98 | * <!-- begin-user-doc --> |
| 99 | * <!-- end-user-doc --> |
| 100 | * @generated |
| 101 | */ |
| 102 | @Override |
| 103 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| 104 | switch (featureID) { |
| 105 | case EMOFPackage.ENUMERATION_LITERAL__ENUMERATION: |
| 106 | if (eInternalContainer() != null) |
| 107 | msgs = eBasicRemoveFromContainer(msgs); |
| 108 | return basicSetEnumeration((Enumeration)otherEnd, msgs); |
| 109 | } |
| 110 | return super.eInverseAdd(otherEnd, featureID, msgs); |
| 111 | } |
| 112 | |
| 113 | /** |
| 114 | * <!-- begin-user-doc --> |
| 115 | * <!-- end-user-doc --> |
| 116 | * @generated |
| 117 | */ |
| 118 | @Override |
| 119 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| 120 | switch (featureID) { |
| 121 | case EMOFPackage.ENUMERATION_LITERAL__ENUMERATION: |
| 122 | return basicSetEnumeration(null, msgs); |
| 123 | } |
| 124 | return super.eInverseRemove(otherEnd, featureID, msgs); |
| 125 | } |
| 126 | |
| 127 | /** |
| 128 | * <!-- begin-user-doc --> |
| 129 | * <!-- end-user-doc --> |
| 130 | * @generated |
| 131 | */ |
| 132 | @Override |
| 133 | public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { |
| 134 | switch (eContainerFeatureID()) { |
| 135 | case EMOFPackage.ENUMERATION_LITERAL__ENUMERATION: |
| 136 | return eInternalContainer().eInverseRemove(this, EMOFPackage.ENUMERATION__OWNED_LITERAL, Enumeration.class, msgs); |
| 137 | } |
| 138 | return super.eBasicRemoveFromContainerFeature(msgs); |
| 139 | } |
| 140 | |
| 141 | /** |
| 142 | * <!-- begin-user-doc --> |
| 143 | * <!-- end-user-doc --> |
| 144 | * @generated |
| 145 | */ |
| 146 | @Override |
| 147 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| 148 | switch (featureID) { |
| 149 | case EMOFPackage.ENUMERATION_LITERAL__ENUMERATION: |
| 150 | return getEnumeration(); |
| 151 | } |
| 152 | return super.eGet(featureID, resolve, coreType); |
| 153 | } |
| 154 | |
| 155 | /** |
| 156 | * <!-- begin-user-doc --> |
| 157 | * <!-- end-user-doc --> |
| 158 | * @generated |
| 159 | */ |
| 160 | @Override |
| 161 | public void eSet(int featureID, Object newValue) { |
| 162 | switch (featureID) { |
| 163 | case EMOFPackage.ENUMERATION_LITERAL__ENUMERATION: |
| 164 | setEnumeration((Enumeration)newValue); |
| 165 | return; |
| 166 | } |
| 167 | super.eSet(featureID, newValue); |
| 168 | } |
| 169 | |
| 170 | /** |
| 171 | * <!-- begin-user-doc --> |
| 172 | * <!-- end-user-doc --> |
| 173 | * @generated |
| 174 | */ |
| 175 | @Override |
| 176 | public void eUnset(int featureID) { |
| 177 | switch (featureID) { |
| 178 | case EMOFPackage.ENUMERATION_LITERAL__ENUMERATION: |
| 179 | setEnumeration((Enumeration)null); |
| 180 | return; |
| 181 | } |
| 182 | super.eUnset(featureID); |
| 183 | } |
| 184 | |
| 185 | /** |
| 186 | * <!-- begin-user-doc --> |
| 187 | * <!-- end-user-doc --> |
| 188 | * @generated |
| 189 | */ |
| 190 | @Override |
| 191 | public boolean eIsSet(int featureID) { |
| 192 | switch (featureID) { |
| 193 | case EMOFPackage.ENUMERATION_LITERAL__ENUMERATION: |
| 194 | return getEnumeration() != null; |
| 195 | } |
| 196 | return super.eIsSet(featureID); |
| 197 | } |
| 198 | |
| 199 | } //EnumerationLiteralImpl |