blob: 06d4b2f0e664da7041b15e7fcb360698d0a5636f [file] [log] [blame]
/**
* <copyright>
*
* Copyright (c) 2013, 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
*
* </copyright>
*/
package org.eclipse.qvtd.xtext.qvtcorecs.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.TypedElementCSImpl;
import org.eclipse.ocl.xtext.basecs.util.BaseCSVisitor;
import org.eclipse.ocl.xtext.essentialoclcs.ExpCS;
import org.eclipse.qvtd.xtext.qvtcorecs.QVTcoreCSPackage;
import org.eclipse.qvtd.xtext.qvtcorecs.UnrealizedVariableCS;
import org.eclipse.qvtd.xtext.qvtcorecs.util.QVTcoreCSVisitor;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Unrealized Variable CS</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.qvtd.xtext.qvtcorecs.impl.UnrealizedVariableCSImpl#getOwnedInitExpression <em>Owned Init Expression</em>}</li>
* </ul>
*
* @generated
*/
public class UnrealizedVariableCSImpl extends RealizeableVariableCSImpl implements UnrealizedVariableCS {
/**
* The number of structural features of the '<em>Unrealized Variable CS</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public static final int UNREALIZED_VARIABLE_CS_FEATURE_COUNT = RealizeableVariableCSImpl.REALIZEABLE_VARIABLE_CS_FEATURE_COUNT + 1;
/**
* The cached value of the '{@link #getOwnedInitExpression() <em>Owned Init Expression</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOwnedInitExpression()
* @generated
* @ordered
*/
protected ExpCS ownedInitExpression;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected UnrealizedVariableCSImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return QVTcoreCSPackage.Literals.UNREALIZED_VARIABLE_CS;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public ExpCS getOwnedInitExpression() {
return ownedInitExpression;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetOwnedInitExpression(ExpCS newOwnedInitExpression, NotificationChain msgs) {
ExpCS oldOwnedInitExpression = ownedInitExpression;
ownedInitExpression = newOwnedInitExpression;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, TypedElementCSImpl.TYPED_ELEMENT_CS_FEATURE_COUNT + 0, oldOwnedInitExpression, newOwnedInitExpression);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setOwnedInitExpression(ExpCS newOwnedInitExpression) {
if (newOwnedInitExpression != ownedInitExpression) {
NotificationChain msgs = null;
if (ownedInitExpression != null)
msgs = ((InternalEObject)ownedInitExpression).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - (TypedElementCSImpl.TYPED_ELEMENT_CS_FEATURE_COUNT + 0), null, msgs);
if (newOwnedInitExpression != null)
msgs = ((InternalEObject)newOwnedInitExpression).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - (TypedElementCSImpl.TYPED_ELEMENT_CS_FEATURE_COUNT + 0), null, msgs);
msgs = basicSetOwnedInitExpression(newOwnedInitExpression, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TypedElementCSImpl.TYPED_ELEMENT_CS_FEATURE_COUNT + 0, newOwnedInitExpression, newOwnedInitExpression));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case TypedElementCSImpl.TYPED_ELEMENT_CS_FEATURE_COUNT + 0:
return basicSetOwnedInitExpression(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 TypedElementCSImpl.TYPED_ELEMENT_CS_FEATURE_COUNT + 0:
return getOwnedInitExpression();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case TypedElementCSImpl.TYPED_ELEMENT_CS_FEATURE_COUNT + 0:
setOwnedInitExpression((ExpCS)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case TypedElementCSImpl.TYPED_ELEMENT_CS_FEATURE_COUNT + 0:
setOwnedInitExpression((ExpCS)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case TypedElementCSImpl.TYPED_ELEMENT_CS_FEATURE_COUNT + 0:
return ownedInitExpression != null;
}
return super.eIsSet(featureID);
}
/**
* {@inheritDoc}
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public <R> R accept(@NonNull BaseCSVisitor<R> visitor) {
return (R) ((QVTcoreCSVisitor<?>)visitor).visitUnrealizedVariableCS(this);
}
} //UnrealizedVariableCSImpl