| /** |
| * <copyright> |
| * </copyright> |
| * |
| * $Id: UnpackExpImpl.java,v 1.2 2009/01/25 23:11:18 radvorak Exp $ |
| */ |
| package org.eclipse.m2m.qvt.oml.emof.ImperativeOCL.impl; |
| |
| import java.util.Collection; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| import org.eclipse.emf.common.notify.NotificationChain; |
| import org.eclipse.emf.common.util.EList; |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.InternalEObject; |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| import org.eclipse.emf.ecore.util.EObjectResolvingEList; |
| import org.eclipse.m2m.qvt.oml.emof.ImperativeOCL.ImperativeOCLPackage; |
| import org.eclipse.m2m.qvt.oml.emof.ImperativeOCL.UnpackExp; |
| import org.eclipse.qvt.declarative.emof.EssentialOCL.OclExpression; |
| import org.eclipse.qvt.declarative.emof.EssentialOCL.Variable; |
| |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Unpack Exp</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.m2m.qvt.oml.emof.ImperativeOCL.impl.UnpackExpImpl#getSource <em>Source</em>}</li> |
| * <li>{@link org.eclipse.m2m.qvt.oml.emof.ImperativeOCL.impl.UnpackExpImpl#getTargetVariable <em>Target Variable</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class UnpackExpImpl extends ImperativeExpressionImpl implements UnpackExp { |
| /** |
| * The cached value of the '{@link #getSource() <em>Source</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getSource() |
| * @generated |
| * @ordered |
| */ |
| protected OclExpression source; |
| |
| /** |
| * The cached value of the '{@link #getTargetVariable() <em>Target Variable</em>}' reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getTargetVariable() |
| * @generated |
| * @ordered |
| */ |
| protected EList<Variable> targetVariable; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected UnpackExpImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return ImperativeOCLPackage.Literals.UNPACK_EXP; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public OclExpression getSource() { |
| return source; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetSource(OclExpression newSource, NotificationChain msgs) { |
| OclExpression oldSource = source; |
| source = newSource; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ImperativeOCLPackage.UNPACK_EXP__SOURCE, oldSource, newSource); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setSource(OclExpression newSource) { |
| if (newSource != source) { |
| NotificationChain msgs = null; |
| if (source != null) |
| msgs = ((InternalEObject)source).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ImperativeOCLPackage.UNPACK_EXP__SOURCE, null, msgs); |
| if (newSource != null) |
| msgs = ((InternalEObject)newSource).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ImperativeOCLPackage.UNPACK_EXP__SOURCE, null, msgs); |
| msgs = basicSetSource(newSource, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ImperativeOCLPackage.UNPACK_EXP__SOURCE, newSource, newSource)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<Variable> getTargetVariable() { |
| if (targetVariable == null) { |
| targetVariable = new EObjectResolvingEList<Variable>(Variable.class, this, ImperativeOCLPackage.UNPACK_EXP__TARGET_VARIABLE); |
| } |
| return targetVariable; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case ImperativeOCLPackage.UNPACK_EXP__SOURCE: |
| return basicSetSource(null, msgs); |
| } |
| return super.eInverseRemove(otherEnd, featureID, msgs); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case ImperativeOCLPackage.UNPACK_EXP__SOURCE: |
| return getSource(); |
| case ImperativeOCLPackage.UNPACK_EXP__TARGET_VARIABLE: |
| return getTargetVariable(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @SuppressWarnings("unchecked") |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case ImperativeOCLPackage.UNPACK_EXP__SOURCE: |
| setSource((OclExpression)newValue); |
| return; |
| case ImperativeOCLPackage.UNPACK_EXP__TARGET_VARIABLE: |
| getTargetVariable().clear(); |
| getTargetVariable().addAll((Collection<? extends Variable>)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case ImperativeOCLPackage.UNPACK_EXP__SOURCE: |
| setSource((OclExpression)null); |
| return; |
| case ImperativeOCLPackage.UNPACK_EXP__TARGET_VARIABLE: |
| getTargetVariable().clear(); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case ImperativeOCLPackage.UNPACK_EXP__SOURCE: |
| return source != null; |
| case ImperativeOCLPackage.UNPACK_EXP__TARGET_VARIABLE: |
| return targetVariable != null && !targetVariable.isEmpty(); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| } //UnpackExpImpl |