blob: 9370341068eec82eefef838a4ff7d3aac1b4e5b7 [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.qvtimperativecs.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.Property;
import org.eclipse.ocl.pivot.VariableDeclaration;
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.qvtimperativecs.QVTimperativeCSPackage;
import org.eclipse.qvtd.xtext.qvtimperativecs.SetStatementCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.util.QVTimperativeCSVisitor;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Set Statement CS</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.qvtd.xtext.qvtimperativecs.impl.SetStatementCSImpl#getReferredProperty <em>Referred Property</em>}</li>
* <li>{@link org.eclipse.qvtd.xtext.qvtimperativecs.impl.SetStatementCSImpl#getReferredVariable <em>Referred Variable</em>}</li>
* <li>{@link org.eclipse.qvtd.xtext.qvtimperativecs.impl.SetStatementCSImpl#getOwnedExpression <em>Owned Expression</em>}</li>
* <li>{@link org.eclipse.qvtd.xtext.qvtimperativecs.impl.SetStatementCSImpl#isIsNotify <em>Is Notify</em>}</li>
* <li>{@link org.eclipse.qvtd.xtext.qvtimperativecs.impl.SetStatementCSImpl#isIsPartial <em>Is Partial</em>}</li>
* </ul>
*
* @generated
*/
public class SetStatementCSImpl extends ObservableStatementCSImpl implements SetStatementCS {
/**
* The number of structural features of the '<em>Set Statement CS</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public static final int SET_STATEMENT_CS_FEATURE_COUNT = ObservableStatementCSImpl.OBSERVABLE_STATEMENT_CS_FEATURE_COUNT + 5;
/**
* The cached value of the '{@link #getReferredProperty() <em>Referred Property</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getReferredProperty()
* @generated
* @ordered
*/
protected Property referredProperty;
/**
* The cached value of the '{@link #getReferredVariable() <em>Referred Variable</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getReferredVariable()
* @generated
* @ordered
*/
protected VariableDeclaration referredVariable;
/**
* The cached value of the '{@link #getOwnedExpression() <em>Owned Expression</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOwnedExpression()
* @generated
* @ordered
*/
protected ExpCS ownedExpression;
/**
* The default value of the '{@link #isIsNotify() <em>Is Notify</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isIsNotify()
* @generated
* @ordered
*/
protected static final boolean IS_NOTIFY_EDEFAULT = false;
/**
* The cached value of the '{@link #isIsNotify() <em>Is Notify</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isIsNotify()
* @generated
* @ordered
*/
protected boolean isNotify = IS_NOTIFY_EDEFAULT;
/**
* The default value of the '{@link #isIsPartial() <em>Is Partial</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isIsPartial()
* @generated
* @ordered
*/
protected static final boolean IS_PARTIAL_EDEFAULT = false;
/**
* The cached value of the '{@link #isIsPartial() <em>Is Partial</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isIsPartial()
* @generated
* @ordered
*/
protected boolean isPartial = IS_PARTIAL_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected SetStatementCSImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return QVTimperativeCSPackage.Literals.SET_STATEMENT_CS;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Property getReferredProperty() {
if (referredProperty != null && referredProperty.eIsProxy()) {
InternalEObject oldReferredProperty = (InternalEObject)referredProperty;
referredProperty = (Property)eResolveProxy(oldReferredProperty);
if (referredProperty != oldReferredProperty) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 1, oldReferredProperty, referredProperty));
}
}
return referredProperty;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Property basicGetReferredProperty() {
return referredProperty;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setReferredProperty(Property newReferredProperty) {
Property oldReferredProperty = referredProperty;
referredProperty = newReferredProperty;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 1, oldReferredProperty, referredProperty));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public VariableDeclaration getReferredVariable() {
if (referredVariable != null && referredVariable.eIsProxy()) {
InternalEObject oldReferredVariable = (InternalEObject)referredVariable;
referredVariable = (VariableDeclaration)eResolveProxy(oldReferredVariable);
if (referredVariable != oldReferredVariable) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 2, oldReferredVariable, referredVariable));
}
}
return referredVariable;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public VariableDeclaration basicGetReferredVariable() {
return referredVariable;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setReferredVariable(VariableDeclaration newReferredVariable) {
VariableDeclaration oldReferredVariable = referredVariable;
referredVariable = newReferredVariable;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 2, oldReferredVariable, referredVariable));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public ExpCS getOwnedExpression() {
return ownedExpression;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetOwnedExpression(ExpCS newOwnedExpression, NotificationChain msgs) {
ExpCS oldOwnedExpression = ownedExpression;
ownedExpression = newOwnedExpression;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 3, oldOwnedExpression, newOwnedExpression);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setOwnedExpression(ExpCS newOwnedExpression) {
if (newOwnedExpression != ownedExpression) {
NotificationChain msgs = null;
if (ownedExpression != null)
msgs = ((InternalEObject)ownedExpression).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - (ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 3), null, msgs);
if (newOwnedExpression != null)
msgs = ((InternalEObject)newOwnedExpression).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - (ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 3), null, msgs);
msgs = basicSetOwnedExpression(newOwnedExpression, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 3, newOwnedExpression, newOwnedExpression));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean isIsNotify() {
return isNotify;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setIsNotify(boolean newIsNotify) {
boolean oldIsNotify = isNotify;
isNotify = newIsNotify;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 4, oldIsNotify, isNotify));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean isIsPartial() {
return isPartial;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setIsPartial(boolean newIsPartial) {
boolean oldIsPartial = isPartial;
isPartial = newIsPartial;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 5, oldIsPartial, isPartial));
}
/**
* <!-- 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 ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 3:
return basicSetOwnedExpression(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 ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 1:
if (resolve) return getReferredProperty();
return basicGetReferredProperty();
case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 2:
if (resolve) return getReferredVariable();
return basicGetReferredVariable();
case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 3:
return getOwnedExpression();
case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 4:
return isIsNotify();
case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 5:
return isIsPartial();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 1:
setReferredProperty((Property)newValue);
return;
case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 2:
setReferredVariable((VariableDeclaration)newValue);
return;
case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 3:
setOwnedExpression((ExpCS)newValue);
return;
case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 4:
setIsNotify((Boolean)newValue);
return;
case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 5:
setIsPartial((Boolean)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 1:
setReferredProperty((Property)null);
return;
case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 2:
setReferredVariable((VariableDeclaration)null);
return;
case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 3:
setOwnedExpression((ExpCS)null);
return;
case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 4:
setIsNotify(IS_NOTIFY_EDEFAULT);
return;
case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 5:
setIsPartial(IS_PARTIAL_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 1:
return referredProperty != null;
case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 2:
return referredVariable != null;
case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 3:
return ownedExpression != null;
case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 4:
return isNotify != IS_NOTIFY_EDEFAULT;
case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 5:
return isPartial != IS_PARTIAL_EDEFAULT;
}
return super.eIsSet(featureID);
}
/**
* {@inheritDoc}
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public <R> R accept(@NonNull BaseCSVisitor<R> visitor) {
return (R) ((QVTimperativeCSVisitor<?>)visitor).visitSetStatementCS(this);
}
} //SetStatementCSImpl