blob: db32704bd8c179b549286207a2bd3a5db89f1537 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2012, 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.qvtd.xtext.qvtrelationcs.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.jdt.annotation.Nullable;
import org.eclipse.ocl.pivot.Variable;
import org.eclipse.ocl.xtext.basecs.impl.ModelElementCSImpl;
import org.eclipse.ocl.xtext.basecs.util.BaseCSVisitor;
import org.eclipse.ocl.xtext.essentialoclcs.ExpCS;
import org.eclipse.qvtd.xtext.qvtrelationcs.DefaultValueCS;
import org.eclipse.qvtd.xtext.qvtrelationcs.QVTrelationCSPackage;
import org.eclipse.qvtd.xtext.qvtrelationcs.util.QVTrelationCSVisitor;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Default Value CS</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.qvtd.xtext.qvtrelationcs.impl.DefaultValueCSImpl#getOwnedInitExpression <em>Owned Init Expression</em>}</li>
* <li>{@link org.eclipse.qvtd.xtext.qvtrelationcs.impl.DefaultValueCSImpl#getPropertyId <em>Property Id</em>}</li>
* </ul>
*
* @generated
*/
public class DefaultValueCSImpl extends ModelElementCSImpl implements DefaultValueCS {
/**
* 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;
/**
* The cached value of the '{@link #getPropertyId() <em>Property Id</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPropertyId()
* @generated
* @ordered
*/
protected Variable propertyId;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected DefaultValueCSImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return QVTrelationCSPackage.Literals.DEFAULT_VALUE_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, QVTrelationCSPackage.DEFAULT_VALUE_CS__OWNED_INIT_EXPRESSION, 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 - QVTrelationCSPackage.DEFAULT_VALUE_CS__OWNED_INIT_EXPRESSION, null, msgs);
if (newOwnedInitExpression != null)
msgs = ((InternalEObject)newOwnedInitExpression).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - QVTrelationCSPackage.DEFAULT_VALUE_CS__OWNED_INIT_EXPRESSION, null, msgs);
msgs = basicSetOwnedInitExpression(newOwnedInitExpression, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, QVTrelationCSPackage.DEFAULT_VALUE_CS__OWNED_INIT_EXPRESSION, newOwnedInitExpression, newOwnedInitExpression));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Variable getPropertyId() {
if (propertyId != null && propertyId.eIsProxy()) {
InternalEObject oldPropertyId = (InternalEObject)propertyId;
propertyId = (Variable)eResolveProxy(oldPropertyId);
if (propertyId != oldPropertyId) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, QVTrelationCSPackage.DEFAULT_VALUE_CS__PROPERTY_ID, oldPropertyId, propertyId));
}
}
return propertyId;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Variable basicGetPropertyId() {
return propertyId;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setPropertyId(Variable newPropertyId) {
Variable oldPropertyId = propertyId;
propertyId = newPropertyId;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, QVTrelationCSPackage.DEFAULT_VALUE_CS__PROPERTY_ID, oldPropertyId, propertyId));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case QVTrelationCSPackage.DEFAULT_VALUE_CS__OWNED_INIT_EXPRESSION:
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 QVTrelationCSPackage.DEFAULT_VALUE_CS__OWNED_INIT_EXPRESSION:
return getOwnedInitExpression();
case QVTrelationCSPackage.DEFAULT_VALUE_CS__PROPERTY_ID:
if (resolve) return getPropertyId();
return basicGetPropertyId();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case QVTrelationCSPackage.DEFAULT_VALUE_CS__OWNED_INIT_EXPRESSION:
setOwnedInitExpression((ExpCS)newValue);
return;
case QVTrelationCSPackage.DEFAULT_VALUE_CS__PROPERTY_ID:
setPropertyId((Variable)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case QVTrelationCSPackage.DEFAULT_VALUE_CS__OWNED_INIT_EXPRESSION:
setOwnedInitExpression((ExpCS)null);
return;
case QVTrelationCSPackage.DEFAULT_VALUE_CS__PROPERTY_ID:
setPropertyId((Variable)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case QVTrelationCSPackage.DEFAULT_VALUE_CS__OWNED_INIT_EXPRESSION:
return ownedInitExpression != null;
case QVTrelationCSPackage.DEFAULT_VALUE_CS__PROPERTY_ID:
return propertyId != null;
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public @Nullable <R> R accept(@NonNull BaseCSVisitor<R> visitor) {
return (R) ((QVTrelationCSVisitor<?>)visitor).visitDefaultValueCS(this);
}
} //DefaultValueCSImpl