/******************************************************************************* * Copyright (c) 2011, 2015 Willink Transformations 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 *******************************************************************************/ package org.eclipse.ocl.xtext.essentialoclcs.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.jdt.annotation.NonNull; import org.eclipse.ocl.xtext.basecs.impl.SpecificationCSImpl; import org.eclipse.ocl.xtext.basecs.util.BaseCSVisitor; import org.eclipse.ocl.xtext.essentialoclcs.EssentialOCLCSPackage; import org.eclipse.ocl.xtext.essentialoclcs.ExpCS; import org.eclipse.ocl.xtext.essentialoclcs.ExpSpecificationCS; import org.eclipse.ocl.xtext.essentialoclcs.util.EssentialOCLCSVisitor; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Exp Constraint CS</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * </p> * <ul> * <li>{@link org.eclipse.ocl.xtext.essentialoclcs.impl.ExpSpecificationCSImpl#getOwnedExpression <em>Owned Expression</em>}</li> * </ul> * * @generated */ public class ExpSpecificationCSImpl extends SpecificationCSImpl implements ExpSpecificationCS { /** * The cached value of the '{@link #getOwnedExpression() <em>Owned Expression</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getOwnedExpression() * @generated * @ordered */ protected ExpCS ownedExpression; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected ExpSpecificationCSImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return EssentialOCLCSPackage.Literals.EXP_SPECIFICATION_CS; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public ExpCS getOwnedExpression() { return ownedExpression; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetOwnedExpression(ExpCS newOwnedExpression, NotificationChain msgs) { ExpCS oldOwnedExpression = ownedExpression; ownedExpression = newOwnedExpression; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EssentialOCLCSPackage.EXP_SPECIFICATION_CS__OWNED_EXPRESSION, oldOwnedExpression, newOwnedExpression); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void setOwnedExpression(ExpCS newOwnedExpression) { if (newOwnedExpression != ownedExpression) { NotificationChain msgs = null; if (ownedExpression != null) msgs = ((InternalEObject)ownedExpression).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EssentialOCLCSPackage.EXP_SPECIFICATION_CS__OWNED_EXPRESSION, null, msgs); if (newOwnedExpression != null) msgs = ((InternalEObject)newOwnedExpression).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EssentialOCLCSPackage.EXP_SPECIFICATION_CS__OWNED_EXPRESSION, null, msgs); msgs = basicSetOwnedExpression(newOwnedExpression, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, EssentialOCLCSPackage.EXP_SPECIFICATION_CS__OWNED_EXPRESSION, newOwnedExpression, newOwnedExpression)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case EssentialOCLCSPackage.EXP_SPECIFICATION_CS__OWNED_EXPRESSION: return basicSetOwnedExpression(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 EssentialOCLCSPackage.EXP_SPECIFICATION_CS__OWNED_EXPRESSION: return getOwnedExpression(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case EssentialOCLCSPackage.EXP_SPECIFICATION_CS__OWNED_EXPRESSION: setOwnedExpression((ExpCS)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case EssentialOCLCSPackage.EXP_SPECIFICATION_CS__OWNED_EXPRESSION: setOwnedExpression((ExpCS)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case EssentialOCLCSPackage.EXP_SPECIFICATION_CS__OWNED_EXPRESSION: return ownedExpression != null; } return super.eIsSet(featureID); } /** * {@inheritDoc} * @generated */ @SuppressWarnings("unchecked") @Override public <R> R accept(@NonNull BaseCSVisitor<R> visitor) { return (R) ((EssentialOCLCSVisitor<?>)visitor).visitExpSpecificationCS(this); } @Override public void setExprString(String newExprString) { assert newExprString != null; super.setExprString(newExprString); } } //ExpConstraintCSImpl