/** * <copyright> * Copyright (c) 2013 Willink Transformations, University of York, and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * E.D.Willink - Initial API and implementation * Adolfo Sanchez-Barbudo (University of York) - Bug397429 * </copyright> */ package org.eclipse.qvto.examples.pivot.imperativeocl.impl; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.notify.NotificationChain; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.ocl.pivot.OCLExpression; import org.eclipse.ocl.pivot.Type; import org.eclipse.ocl.pivot.util.Visitor; import org.eclipse.qvto.examples.pivot.imperativeocl.ImperativeOCLPackage; import org.eclipse.qvto.examples.pivot.imperativeocl.RaiseExp; import org.eclipse.qvto.examples.pivot.imperativeocl.util.ImperativeOCLVisitor; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Raise Exp</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * </p> * <ul> * <li>{@link org.eclipse.qvto.examples.pivot.imperativeocl.impl.RaiseExpImpl#getArgument <em>Argument</em>}</li> * <li>{@link org.eclipse.qvto.examples.pivot.imperativeocl.impl.RaiseExpImpl#getException <em>Exception</em>}</li> * </ul> * * @generated */ public class RaiseExpImpl extends ImperativeExpressionImpl implements RaiseExp { /** * The cached value of the '{@link #getArgument() <em>Argument</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getArgument() * @generated * @ordered */ protected OCLExpression argument; /** * The cached value of the '{@link #getException() <em>Exception</em>}' reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getException() * @generated * @ordered */ protected Type exception; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected RaiseExpImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return ImperativeOCLPackage.Literals.RAISE_EXP; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public OCLExpression getArgument() { return argument; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetArgument(OCLExpression newArgument, NotificationChain msgs) { OCLExpression oldArgument = argument; argument = newArgument; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ImperativeOCLPackage.RAISE_EXP__ARGUMENT, oldArgument, newArgument); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setArgument(OCLExpression newArgument) { if (newArgument != argument) { NotificationChain msgs = null; if (argument != null) msgs = ((InternalEObject)argument).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ImperativeOCLPackage.RAISE_EXP__ARGUMENT, null, msgs); if (newArgument != null) msgs = ((InternalEObject)newArgument).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ImperativeOCLPackage.RAISE_EXP__ARGUMENT, null, msgs); msgs = basicSetArgument(newArgument, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, ImperativeOCLPackage.RAISE_EXP__ARGUMENT, newArgument, newArgument)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Type getException() { if (exception != null && exception.eIsProxy()) { InternalEObject oldException = (InternalEObject)exception; exception = (Type)eResolveProxy(oldException); if (exception != oldException) { if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, ImperativeOCLPackage.RAISE_EXP__EXCEPTION, oldException, exception)); } } return exception; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Type basicGetException() { return exception; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setException(Type newException) { Type oldException = exception; exception = newException; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, ImperativeOCLPackage.RAISE_EXP__EXCEPTION, oldException, exception)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case ImperativeOCLPackage.RAISE_EXP__ARGUMENT: return basicSetArgument(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.RAISE_EXP__ARGUMENT: return getArgument(); case ImperativeOCLPackage.RAISE_EXP__EXCEPTION: if (resolve) return getException(); return basicGetException(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case ImperativeOCLPackage.RAISE_EXP__ARGUMENT: setArgument((OCLExpression)newValue); return; case ImperativeOCLPackage.RAISE_EXP__EXCEPTION: setException((Type)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case ImperativeOCLPackage.RAISE_EXP__ARGUMENT: setArgument((OCLExpression)null); return; case ImperativeOCLPackage.RAISE_EXP__EXCEPTION: setException((Type)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case ImperativeOCLPackage.RAISE_EXP__ARGUMENT: return argument != null; case ImperativeOCLPackage.RAISE_EXP__EXCEPTION: return exception != null; } return super.eIsSet(featureID); } /** * {@inheritDoc} * @generated */ @SuppressWarnings("unchecked") @Override public <R> R accept(Visitor<R> visitor) { return (R) ((ImperativeOCLVisitor<?>)visitor).visitRaiseExp(this); } } //RaiseExpImpl