| 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 java.util.Collection; |
| 14 | |
| 15 | import org.eclipse.emf.common.notify.NotificationChain; |
| 16 | |
| 17 | import org.eclipse.emf.common.util.EList; |
| 18 | |
| 19 | import org.eclipse.emf.ecore.EClass; |
| 20 | import org.eclipse.emf.ecore.InternalEObject; |
| 21 | |
| 22 | import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList; |
| 23 | import org.eclipse.emf.ecore.util.InternalEList; |
| 24 | |
| 25 | /** |
| 26 | * <!-- begin-user-doc --> |
| 27 | * An implementation of the model object '<em><b>Enumeration</b></em>'. |
| 28 | * <!-- end-user-doc --> |
| 29 | * <p> |
| 30 | * The following features are implemented: |
| 31 | * <ul> |
| 32 | * <li>{@link EMOF.impl.EnumerationImpl#getOwnedLiteral <em>Owned Literal</em>}</li> |
| 33 | * </ul> |
| 34 | * </p> |
| 35 | * |
| 36 | * @generated |
| 37 | */ |
| 38 | public class EnumerationImpl extends DataTypeImpl implements Enumeration { |
| 39 | /** |
| 40 | * The cached value of the '{@link #getOwnedLiteral() <em>Owned Literal</em>}' containment reference list. |
| 41 | * <!-- begin-user-doc --> |
| 42 | * <!-- end-user-doc --> |
| 43 | * @see #getOwnedLiteral() |
| 44 | * @generated |
| 45 | * @ordered |
| 46 | */ |
| 47 | protected EList<EnumerationLiteral> ownedLiteral; |
| 48 | |
| 49 | /** |
| 50 | * <!-- begin-user-doc --> |
| 51 | * <!-- end-user-doc --> |
| 52 | * @generated |
| 53 | */ |
| 54 | protected EnumerationImpl() { |
| 55 | super(); |
| 56 | } |
| 57 | |
| 58 | /** |
| 59 | * <!-- begin-user-doc --> |
| 60 | * <!-- end-user-doc --> |
| 61 | * @generated |
| 62 | */ |
| 63 | @Override |
| 64 | protected EClass eStaticClass() { |
| 65 | return EMOFPackage.Literals.ENUMERATION; |
| 66 | } |
| 67 | |
| 68 | /** |
| 69 | * <!-- begin-user-doc --> |
| 70 | * <!-- end-user-doc --> |
| 71 | * @generated |
| 72 | */ |
| 73 | public EList<EnumerationLiteral> getOwnedLiteral() { |
| 74 | if (ownedLiteral == null) { |
| 75 | ownedLiteral = new EObjectContainmentWithInverseEList<EnumerationLiteral>(EnumerationLiteral.class, this, EMOFPackage.ENUMERATION__OWNED_LITERAL, EMOFPackage.ENUMERATION_LITERAL__ENUMERATION); |
| 76 | } |
| 77 | return ownedLiteral; |
| 78 | } |
| 79 | |
| 80 | /** |
| 81 | * <!-- begin-user-doc --> |
| 82 | * <!-- end-user-doc --> |
| 83 | * @generated |
| 84 | */ |
| 85 | @SuppressWarnings("unchecked") |
| 86 | @Override |
| 87 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| 88 | switch (featureID) { |
| 89 | case EMOFPackage.ENUMERATION__OWNED_LITERAL: |
| 90 | return ((InternalEList<InternalEObject>)(InternalEList<?>)getOwnedLiteral()).basicAdd(otherEnd, msgs); |
| 91 | } |
| 92 | return super.eInverseAdd(otherEnd, featureID, msgs); |
| 93 | } |
| 94 | |
| 95 | /** |
| 96 | * <!-- begin-user-doc --> |
| 97 | * <!-- end-user-doc --> |
| 98 | * @generated |
| 99 | */ |
| 100 | @Override |
| 101 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| 102 | switch (featureID) { |
| 103 | case EMOFPackage.ENUMERATION__OWNED_LITERAL: |
| 104 | return ((InternalEList<?>)getOwnedLiteral()).basicRemove(otherEnd, msgs); |
| 105 | } |
| 106 | return super.eInverseRemove(otherEnd, featureID, msgs); |
| 107 | } |
| 108 | |
| 109 | /** |
| 110 | * <!-- begin-user-doc --> |
| 111 | * <!-- end-user-doc --> |
| 112 | * @generated |
| 113 | */ |
| 114 | @Override |
| 115 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| 116 | switch (featureID) { |
| 117 | case EMOFPackage.ENUMERATION__OWNED_LITERAL: |
| 118 | return getOwnedLiteral(); |
| 119 | } |
| 120 | return super.eGet(featureID, resolve, coreType); |
| 121 | } |
| 122 | |
| 123 | /** |
| 124 | * <!-- begin-user-doc --> |
| 125 | * <!-- end-user-doc --> |
| 126 | * @generated |
| 127 | */ |
| 128 | @SuppressWarnings("unchecked") |
| 129 | @Override |
| 130 | public void eSet(int featureID, Object newValue) { |
| 131 | switch (featureID) { |
| 132 | case EMOFPackage.ENUMERATION__OWNED_LITERAL: |
| 133 | getOwnedLiteral().clear(); |
| 134 | getOwnedLiteral().addAll((Collection<? extends EnumerationLiteral>)newValue); |
| 135 | return; |
| 136 | } |
| 137 | super.eSet(featureID, newValue); |
| 138 | } |
| 139 | |
| 140 | /** |
| 141 | * <!-- begin-user-doc --> |
| 142 | * <!-- end-user-doc --> |
| 143 | * @generated |
| 144 | */ |
| 145 | @Override |
| 146 | public void eUnset(int featureID) { |
| 147 | switch (featureID) { |
| 148 | case EMOFPackage.ENUMERATION__OWNED_LITERAL: |
| 149 | getOwnedLiteral().clear(); |
| 150 | return; |
| 151 | } |
| 152 | super.eUnset(featureID); |
| 153 | } |
| 154 | |
| 155 | /** |
| 156 | * <!-- begin-user-doc --> |
| 157 | * <!-- end-user-doc --> |
| 158 | * @generated |
| 159 | */ |
| 160 | @Override |
| 161 | public boolean eIsSet(int featureID) { |
| 162 | switch (featureID) { |
| 163 | case EMOFPackage.ENUMERATION__OWNED_LITERAL: |
| 164 | return ownedLiteral != null && !ownedLiteral.isEmpty(); |
| 165 | } |
| 166 | return super.eIsSet(featureID); |
| 167 | } |
| 168 | |
| 169 | } //EnumerationImpl |