blob: 2d8a04ff63728104d00185083677788d94fcc2c0 [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.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.jdt.annotation.NonNull;
import org.eclipse.ocl.pivot.Namespace;
import org.eclipse.ocl.xtext.basecs.BaseCSPackage;
import org.eclipse.ocl.xtext.basecs.ImportCS;
import org.eclipse.ocl.xtext.basecs.PathNameCS;
import org.eclipse.ocl.xtext.basecs.util.BaseCSVisitor;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Import CS</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.ocl.xtext.basecs.impl.ImportCSImpl#isIsAll <em>Is All</em>}</li>
* <li>{@link org.eclipse.ocl.xtext.basecs.impl.ImportCSImpl#getOwnedPathName <em>Owned Path Name</em>}</li>
* <li>{@link org.eclipse.ocl.xtext.basecs.impl.ImportCSImpl#getReferredNamespace <em>Referred Namespace</em>}</li>
* </ul>
*
* @generated
*/
public class ImportCSImpl extends NamespaceCSImpl implements ImportCS {
/**
* The number of structural features of the '<em>Import CS</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public static final int IMPORT_CS_FEATURE_COUNT = NamespaceCSImpl.NAMESPACE_CS_FEATURE_COUNT + 3;
/**
* The default value of the '{@link #isIsAll() <em>Is All</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isIsAll()
* @generated
* @ordered
*/
protected static final boolean IS_ALL_EDEFAULT = false;
/**
* The cached value of the '{@link #isIsAll() <em>Is All</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isIsAll()
* @generated
* @ordered
*/
protected boolean isAll = IS_ALL_EDEFAULT;
/**
* 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 ImportCSImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return BaseCSPackage.Literals.IMPORT_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, 7, 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 - (7), null, msgs);
if (newOwnedPathName != null)
msgs = ((InternalEObject)newOwnedPathName).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - (7), null, msgs);
msgs = basicSetOwnedPathName(newOwnedPathName, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, 7, newOwnedPathName, newOwnedPathName));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean isIsAll()
{
return isAll;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setIsAll(boolean newIsAll)
{
boolean oldIsAll = isAll;
isAll = newIsAll;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, 6, oldIsAll, isAll));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
@Override
public String toString() {
return super.toString();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case 7:
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 6:
return isIsAll();
case 7:
return getOwnedPathName();
case 8:
return getReferredNamespace();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID)
{
case 6:
setIsAll((Boolean)newValue);
return;
case 7:
setOwnedPathName((PathNameCS)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID)
{
case 6:
setIsAll(IS_ALL_EDEFAULT);
return;
case 7:
setOwnedPathName((PathNameCS)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID)
{
case 6:
return isAll != IS_ALL_EDEFAULT;
case 7:
return ownedPathName != null;
case 8:
return getReferredNamespace() != null;
}
return super.eIsSet(featureID);
}
/**
* {@inheritDoc}
* @generated
*/
@Override
public <R> R accept(@NonNull BaseCSVisitor<R> visitor) {
return visitor.visitImportCS(this);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
@Override
public Namespace getReferredNamespace() {
if (ownedPathName == null) {
return null;
}
return (Namespace) ownedPathName.getReferredElement();
}
} //ImportCSImpl