blob: eb43c484b6e34af93247ed0d90851f9347d48faa [file] [log] [blame]
/**
* Copyright (c) 2010, 2019 Willink Transformations and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
*
* Contributors:
* E.D.Willink - Initial API and implementation
*/
package org.eclipse.qvtd.xtext.qvtbasecs.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.PathNameCS;
import org.eclipse.ocl.xtext.basecs.impl.PackageCSImpl;
import org.eclipse.ocl.xtext.basecs.util.BaseCSVisitor;
import org.eclipse.qvtd.xtext.qvtbasecs.QVTbaseCSPackage;
import org.eclipse.qvtd.xtext.qvtbasecs.QualifiedPackageCS;
import org.eclipse.qvtd.xtext.qvtbasecs.util.QVTbaseCSVisitor;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Qualified Package CS</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.qvtd.xtext.qvtbasecs.impl.QualifiedPackageCSImpl#getOwnedPathName <em>Owned Path Name</em>}</li>
* </ul>
*
* @generated
*/
public class QualifiedPackageCSImpl extends PackageCSImpl implements QualifiedPackageCS
{
/**
* The number of structural features of the '<em>Qualified Package CS</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public static final int QUALIFIED_PACKAGE_CS_FEATURE_COUNT = PackageCSImpl.PACKAGE_CS_FEATURE_COUNT + 1;
/**
* The cached value of the '{@link #getOwnedPathName() <em>Owned Path Name</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOwnedPathName()
* @generated
* @ordered
*/
protected PathNameCS ownedPathName;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected QualifiedPackageCSImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return QVTbaseCSPackage.Literals.QUALIFIED_PACKAGE_CS;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public PathNameCS getOwnedPathName()
{
return ownedPathName;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetOwnedPathName(PathNameCS newOwnedPathName, NotificationChain msgs)
{
PathNameCS oldOwnedPathName = ownedPathName;
ownedPathName = newOwnedPathName;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, PackageCSImpl.PACKAGE_CS_FEATURE_COUNT + 0, oldOwnedPathName, newOwnedPathName);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setOwnedPathName(PathNameCS newOwnedPathName)
{
if (newOwnedPathName != ownedPathName)
{
NotificationChain msgs = null;
if (ownedPathName != null)
msgs = ((InternalEObject)ownedPathName).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - (PackageCSImpl.PACKAGE_CS_FEATURE_COUNT + 0), null, msgs);
if (newOwnedPathName != null)
msgs = ((InternalEObject)newOwnedPathName).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - (PackageCSImpl.PACKAGE_CS_FEATURE_COUNT + 0), null, msgs);
msgs = basicSetOwnedPathName(newOwnedPathName, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, PackageCSImpl.PACKAGE_CS_FEATURE_COUNT + 0, newOwnedPathName, newOwnedPathName));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case PackageCSImpl.PACKAGE_CS_FEATURE_COUNT + 0:
return basicSetOwnedPathName(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 PackageCSImpl.PACKAGE_CS_FEATURE_COUNT + 0:
return getOwnedPathName();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case PackageCSImpl.PACKAGE_CS_FEATURE_COUNT + 0:
setOwnedPathName((PathNameCS)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case PackageCSImpl.PACKAGE_CS_FEATURE_COUNT + 0:
setOwnedPathName((PathNameCS)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case PackageCSImpl.PACKAGE_CS_FEATURE_COUNT + 0:
return ownedPathName != null;
}
return super.eIsSet(featureID);
}
/**
* {@inheritDoc}
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public <R> R accept(@NonNull BaseCSVisitor<R> visitor) {
if (visitor instanceof QVTbaseCSVisitor) {
return (R) ((QVTbaseCSVisitor<?>)visitor).visitQualifiedPackageCS(this);
}
else {
return super.accept(visitor);
}
}
} //QualifiedPackageCSImpl