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