/******************************************************************************* * Copyright (c) 2014, 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.ocl.xtext.basecs.BaseCSPackage; import org.eclipse.ocl.xtext.basecs.TemplateSignatureCS; import org.eclipse.ocl.xtext.basecs.TemplateableElementCS; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Templateable Element CS</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * </p> * <ul> * <li>{@link org.eclipse.ocl.xtext.basecs.impl.TemplateableElementCSImpl#getOwnedSignature <em>Owned Signature</em>}</li> * </ul> * * @generated */ public abstract class TemplateableElementCSImpl extends ElementCSImpl implements TemplateableElementCS { /** * The cached value of the '{@link #getOwnedSignature() <em>Owned Signature</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getOwnedSignature() * @generated * @ordered */ protected TemplateSignatureCS ownedSignature; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected TemplateableElementCSImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return BaseCSPackage.Literals.TEMPLATEABLE_ELEMENT_CS; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public TemplateSignatureCS getOwnedSignature() { return ownedSignature; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetOwnedSignature(TemplateSignatureCS newOwnedSignature, NotificationChain msgs) { TemplateSignatureCS oldOwnedSignature = ownedSignature; ownedSignature = newOwnedSignature; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, BaseCSPackage.TEMPLATEABLE_ELEMENT_CS__OWNED_SIGNATURE, oldOwnedSignature, newOwnedSignature); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void setOwnedSignature(TemplateSignatureCS newOwnedSignature) { if (newOwnedSignature != ownedSignature) { NotificationChain msgs = null; if (ownedSignature != null) msgs = ((InternalEObject)ownedSignature).eInverseRemove(this, BaseCSPackage.TEMPLATE_SIGNATURE_CS__OWNING_ELEMENT, TemplateSignatureCS.class, msgs); if (newOwnedSignature != null) msgs = ((InternalEObject)newOwnedSignature).eInverseAdd(this, BaseCSPackage.TEMPLATE_SIGNATURE_CS__OWNING_ELEMENT, TemplateSignatureCS.class, msgs); msgs = basicSetOwnedSignature(newOwnedSignature, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, BaseCSPackage.TEMPLATEABLE_ELEMENT_CS__OWNED_SIGNATURE, newOwnedSignature, newOwnedSignature)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case BaseCSPackage.TEMPLATEABLE_ELEMENT_CS__OWNED_SIGNATURE: if (ownedSignature != null) msgs = ((InternalEObject)ownedSignature).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - BaseCSPackage.TEMPLATEABLE_ELEMENT_CS__OWNED_SIGNATURE, null, msgs); return basicSetOwnedSignature((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.TEMPLATEABLE_ELEMENT_CS__OWNED_SIGNATURE: return basicSetOwnedSignature(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 BaseCSPackage.TEMPLATEABLE_ELEMENT_CS__OWNED_SIGNATURE: return getOwnedSignature(); } 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.TEMPLATEABLE_ELEMENT_CS__OWNED_SIGNATURE: setOwnedSignature((TemplateSignatureCS)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case BaseCSPackage.TEMPLATEABLE_ELEMENT_CS__OWNED_SIGNATURE: setOwnedSignature((TemplateSignatureCS)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case BaseCSPackage.TEMPLATEABLE_ELEMENT_CS__OWNED_SIGNATURE: return ownedSignature != null; } return super.eIsSet(featureID); } } //TemplateableElementCSImpl