/******************************************************************************* * Copyright (c) 2010, 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.basecs.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.emf.ecore.util.EcoreUtil; import org.eclipse.ocl.xtext.basecs.BaseCSPackage; import org.eclipse.ocl.xtext.basecs.TemplateParameterCS; import org.eclipse.ocl.xtext.basecs.TemplateSignatureCS; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Template Parameter CS</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * </p> * <ul> * <li>{@link org.eclipse.ocl.xtext.basecs.impl.TemplateParameterCSImpl#getOwningSignature <em>Owning Signature</em>}</li> * </ul> * * @generated */ public abstract class TemplateParameterCSImpl extends NamedElementCSImpl implements TemplateParameterCS { /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected TemplateParameterCSImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return BaseCSPackage.Literals.TEMPLATE_PARAMETER_CS; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public TemplateSignatureCS getOwningSignature() { if (eContainerFeatureID() != BaseCSPackage.TEMPLATE_PARAMETER_CS__OWNING_SIGNATURE) return null; return (TemplateSignatureCS)eInternalContainer(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetOwningSignature(TemplateSignatureCS newOwningSignature, NotificationChain msgs) { msgs = eBasicSetContainer((InternalEObject)newOwningSignature, BaseCSPackage.TEMPLATE_PARAMETER_CS__OWNING_SIGNATURE, msgs); return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void setOwningSignature(TemplateSignatureCS newOwningSignature) { if (newOwningSignature != eInternalContainer() || (eContainerFeatureID() != BaseCSPackage.TEMPLATE_PARAMETER_CS__OWNING_SIGNATURE && newOwningSignature != null)) { if (EcoreUtil.isAncestor(this, newOwningSignature)) throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); //$NON-NLS-1$ NotificationChain msgs = null; if (eInternalContainer() != null) msgs = eBasicRemoveFromContainer(msgs); if (newOwningSignature != null) msgs = ((InternalEObject)newOwningSignature).eInverseAdd(this, BaseCSPackage.TEMPLATE_SIGNATURE_CS__OWNED_PARAMETERS, TemplateSignatureCS.class, msgs); msgs = basicSetOwningSignature(newOwningSignature, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, BaseCSPackage.TEMPLATE_PARAMETER_CS__OWNING_SIGNATURE, newOwningSignature, newOwningSignature)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case BaseCSPackage.TEMPLATE_PARAMETER_CS__OWNING_SIGNATURE: if (eInternalContainer() != null) msgs = eBasicRemoveFromContainer(msgs); return basicSetOwningSignature((TemplateSignatureCS)otherEnd, msgs); } return super.eInverseAdd(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case BaseCSPackage.TEMPLATE_PARAMETER_CS__OWNING_SIGNATURE: return basicSetOwningSignature(null, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { switch (eContainerFeatureID()) { case BaseCSPackage.TEMPLATE_PARAMETER_CS__OWNING_SIGNATURE: return eInternalContainer().eInverseRemove(this, BaseCSPackage.TEMPLATE_SIGNATURE_CS__OWNED_PARAMETERS, TemplateSignatureCS.class, msgs); } return super.eBasicRemoveFromContainerFeature(msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case BaseCSPackage.TEMPLATE_PARAMETER_CS__OWNING_SIGNATURE: return getOwningSignature(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case BaseCSPackage.TEMPLATE_PARAMETER_CS__OWNING_SIGNATURE: setOwningSignature((TemplateSignatureCS)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case BaseCSPackage.TEMPLATE_PARAMETER_CS__OWNING_SIGNATURE: setOwningSignature((TemplateSignatureCS)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case BaseCSPackage.TEMPLATE_PARAMETER_CS__OWNING_SIGNATURE: return getOwningSignature() != null; } return super.eIsSet(featureID); } } //TemplateParameterCSImpl