| 1 | /** |
| 2 | * <copyright> |
| 3 | * </copyright> |
| 4 | * |
| 5 | * $Id$ |
| 6 | */ |
| 7 | package EssentialOCL.impl; |
| 8 | |
| 9 | import EMOF.Operation; |
| 10 | |
| 11 | import EssentialOCL.EssentialOCLPackage; |
| 12 | import EssentialOCL.OclExpression; |
| 13 | import EssentialOCL.OperationCallExp; |
| 14 | |
| 15 | import java.util.Collection; |
| 16 | |
| 17 | import org.eclipse.emf.common.notify.Notification; |
| 18 | import org.eclipse.emf.common.notify.NotificationChain; |
| 19 | |
| 20 | import org.eclipse.emf.common.util.EList; |
| 21 | |
| 22 | import org.eclipse.emf.ecore.EClass; |
| 23 | import org.eclipse.emf.ecore.InternalEObject; |
| 24 | |
| 25 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| 26 | |
| 27 | import org.eclipse.emf.ecore.util.EObjectContainmentEList; |
| 28 | import org.eclipse.emf.ecore.util.InternalEList; |
| 29 | |
| 30 | /** |
| 31 | * <!-- begin-user-doc --> |
| 32 | * An implementation of the model object '<em><b>Operation Call Exp</b></em>'. |
| 33 | * <!-- end-user-doc --> |
| 34 | * <p> |
| 35 | * The following features are implemented: |
| 36 | * <ul> |
| 37 | * <li>{@link EssentialOCL.impl.OperationCallExpImpl#getArgument <em>Argument</em>}</li> |
| 38 | * <li>{@link EssentialOCL.impl.OperationCallExpImpl#getReferredOperation <em>Referred Operation</em>}</li> |
| 39 | * </ul> |
| 40 | * </p> |
| 41 | * |
| 42 | * @generated |
| 43 | */ |
| 44 | public class OperationCallExpImpl extends FeatureCallExpImpl implements OperationCallExp { |
| 45 | /** |
| 46 | * The cached value of the '{@link #getArgument() <em>Argument</em>}' containment reference list. |
| 47 | * <!-- begin-user-doc --> |
| 48 | * <!-- end-user-doc --> |
| 49 | * @see #getArgument() |
| 50 | * @generated |
| 51 | * @ordered |
| 52 | */ |
| 53 | protected EList<OclExpression> argument; |
| 54 | |
| 55 | /** |
| 56 | * The cached value of the '{@link #getReferredOperation() <em>Referred Operation</em>}' reference. |
| 57 | * <!-- begin-user-doc --> |
| 58 | * <!-- end-user-doc --> |
| 59 | * @see #getReferredOperation() |
| 60 | * @generated |
| 61 | * @ordered |
| 62 | */ |
| 63 | protected Operation referredOperation; |
| 64 | |
| 65 | /** |
| 66 | * <!-- begin-user-doc --> |
| 67 | * <!-- end-user-doc --> |
| 68 | * @generated |
| 69 | */ |
| 70 | protected OperationCallExpImpl() { |
| 71 | super(); |
| 72 | } |
| 73 | |
| 74 | /** |
| 75 | * <!-- begin-user-doc --> |
| 76 | * <!-- end-user-doc --> |
| 77 | * @generated |
| 78 | */ |
| 79 | @Override |
| 80 | protected EClass eStaticClass() { |
| 81 | return EssentialOCLPackage.Literals.OPERATION_CALL_EXP; |
| 82 | } |
| 83 | |
| 84 | /** |
| 85 | * <!-- begin-user-doc --> |
| 86 | * <!-- end-user-doc --> |
| 87 | * @generated |
| 88 | */ |
| 89 | public EList<OclExpression> getArgument() { |
| 90 | if (argument == null) { |
| 91 | argument = new EObjectContainmentEList<OclExpression>(OclExpression.class, this, EssentialOCLPackage.OPERATION_CALL_EXP__ARGUMENT); |
| 92 | } |
| 93 | return argument; |
| 94 | } |
| 95 | |
| 96 | /** |
| 97 | * <!-- begin-user-doc --> |
| 98 | * <!-- end-user-doc --> |
| 99 | * @generated |
| 100 | */ |
| 101 | public Operation getReferredOperation() { |
| 102 | if (referredOperation != null && referredOperation.eIsProxy()) { |
| 103 | InternalEObject oldReferredOperation = (InternalEObject)referredOperation; |
| 104 | referredOperation = (Operation)eResolveProxy(oldReferredOperation); |
| 105 | if (referredOperation != oldReferredOperation) { |
| 106 | if (eNotificationRequired()) |
| 107 | eNotify(new ENotificationImpl(this, Notification.RESOLVE, EssentialOCLPackage.OPERATION_CALL_EXP__REFERRED_OPERATION, oldReferredOperation, referredOperation)); |
| 108 | } |
| 109 | } |
| 110 | return referredOperation; |
| 111 | } |
| 112 | |
| 113 | /** |
| 114 | * <!-- begin-user-doc --> |
| 115 | * <!-- end-user-doc --> |
| 116 | * @generated |
| 117 | */ |
| 118 | public Operation basicGetReferredOperation() { |
| 119 | return referredOperation; |
| 120 | } |
| 121 | |
| 122 | /** |
| 123 | * <!-- begin-user-doc --> |
| 124 | * <!-- end-user-doc --> |
| 125 | * @generated |
| 126 | */ |
| 127 | public void setReferredOperation(Operation newReferredOperation) { |
| 128 | Operation oldReferredOperation = referredOperation; |
| 129 | referredOperation = newReferredOperation; |
| 130 | if (eNotificationRequired()) |
| 131 | eNotify(new ENotificationImpl(this, Notification.SET, EssentialOCLPackage.OPERATION_CALL_EXP__REFERRED_OPERATION, oldReferredOperation, referredOperation)); |
| 132 | } |
| 133 | |
| 134 | /** |
| 135 | * <!-- begin-user-doc --> |
| 136 | * <!-- end-user-doc --> |
| 137 | * @generated |
| 138 | */ |
| 139 | @Override |
| 140 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| 141 | switch (featureID) { |
| 142 | case EssentialOCLPackage.OPERATION_CALL_EXP__ARGUMENT: |
| 143 | return ((InternalEList<?>)getArgument()).basicRemove(otherEnd, msgs); |
| 144 | } |
| 145 | return super.eInverseRemove(otherEnd, featureID, msgs); |
| 146 | } |
| 147 | |
| 148 | /** |
| 149 | * <!-- begin-user-doc --> |
| 150 | * <!-- end-user-doc --> |
| 151 | * @generated |
| 152 | */ |
| 153 | @Override |
| 154 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| 155 | switch (featureID) { |
| 156 | case EssentialOCLPackage.OPERATION_CALL_EXP__ARGUMENT: |
| 157 | return getArgument(); |
| 158 | case EssentialOCLPackage.OPERATION_CALL_EXP__REFERRED_OPERATION: |
| 159 | if (resolve) return getReferredOperation(); |
| 160 | return basicGetReferredOperation(); |
| 161 | } |
| 162 | return super.eGet(featureID, resolve, coreType); |
| 163 | } |
| 164 | |
| 165 | /** |
| 166 | * <!-- begin-user-doc --> |
| 167 | * <!-- end-user-doc --> |
| 168 | * @generated |
| 169 | */ |
| 170 | @SuppressWarnings("unchecked") |
| 171 | @Override |
| 172 | public void eSet(int featureID, Object newValue) { |
| 173 | switch (featureID) { |
| 174 | case EssentialOCLPackage.OPERATION_CALL_EXP__ARGUMENT: |
| 175 | getArgument().clear(); |
| 176 | getArgument().addAll((Collection<? extends OclExpression>)newValue); |
| 177 | return; |
| 178 | case EssentialOCLPackage.OPERATION_CALL_EXP__REFERRED_OPERATION: |
| 179 | setReferredOperation((Operation)newValue); |
| 180 | return; |
| 181 | } |
| 182 | super.eSet(featureID, newValue); |
| 183 | } |
| 184 | |
| 185 | /** |
| 186 | * <!-- begin-user-doc --> |
| 187 | * <!-- end-user-doc --> |
| 188 | * @generated |
| 189 | */ |
| 190 | @Override |
| 191 | public void eUnset(int featureID) { |
| 192 | switch (featureID) { |
| 193 | case EssentialOCLPackage.OPERATION_CALL_EXP__ARGUMENT: |
| 194 | getArgument().clear(); |
| 195 | return; |
| 196 | case EssentialOCLPackage.OPERATION_CALL_EXP__REFERRED_OPERATION: |
| 197 | setReferredOperation((Operation)null); |
| 198 | return; |
| 199 | } |
| 200 | super.eUnset(featureID); |
| 201 | } |
| 202 | |
| 203 | /** |
| 204 | * <!-- begin-user-doc --> |
| 205 | * <!-- end-user-doc --> |
| 206 | * @generated |
| 207 | */ |
| 208 | @Override |
| 209 | public boolean eIsSet(int featureID) { |
| 210 | switch (featureID) { |
| 211 | case EssentialOCLPackage.OPERATION_CALL_EXP__ARGUMENT: |
| 212 | return argument != null && !argument.isEmpty(); |
| 213 | case EssentialOCLPackage.OPERATION_CALL_EXP__REFERRED_OPERATION: |
| 214 | return referredOperation != null; |
| 215 | } |
| 216 | return super.eIsSet(featureID); |
| 217 | } |
| 218 | |
| 219 | } //OperationCallExpImpl |