blob: 0a82174d623d997603c63cc3ddd4fc96a217159f [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2013, 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.qvtcorebasecs.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.util.BaseCSVisitor;
import org.eclipse.ocl.xtext.essentialoclcs.ExpCS;
import org.eclipse.ocl.xtext.essentialoclcs.impl.ExpCSImpl;
import org.eclipse.qvtd.xtext.qvtcorebasecs.PredicateOrAssignmentCS;
import org.eclipse.qvtd.xtext.qvtcorebasecs.QVTcoreBaseCSPackage;
import org.eclipse.qvtd.xtext.qvtcorebasecs.util.QVTcoreBaseCSVisitor;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Assignment CS</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.qvtd.xtext.qvtcorebasecs.impl.PredicateOrAssignmentCSImpl#isIsDefault <em>Is Default</em>}</li>
* <li>{@link org.eclipse.qvtd.xtext.qvtcorebasecs.impl.PredicateOrAssignmentCSImpl#getOwnedTarget <em>Owned Target</em>}</li>
* <li>{@link org.eclipse.qvtd.xtext.qvtcorebasecs.impl.PredicateOrAssignmentCSImpl#getOwnedInitExpression <em>Owned Init Expression</em>}</li>
* </ul>
*
* @generated
*/
public class PredicateOrAssignmentCSImpl extends ExpCSImpl implements PredicateOrAssignmentCS {
/**
* The default value of the '{@link #isIsDefault() <em>Is Default</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isIsDefault()
* @generated
* @ordered
*/
protected static final boolean IS_DEFAULT_EDEFAULT = false;
/**
* The cached value of the '{@link #isIsDefault() <em>Is Default</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isIsDefault()
* @generated
* @ordered
*/
protected boolean isDefault = IS_DEFAULT_EDEFAULT;
/**
* The cached value of the '{@link #getOwnedTarget() <em>Owned Target</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOwnedTarget()
* @generated
* @ordered
*/
protected ExpCS ownedTarget;
/**
* 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 PredicateOrAssignmentCSImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return QVTcoreBaseCSPackage.Literals.PREDICATE_OR_ASSIGNMENT_CS;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean isIsDefault() {
return isDefault;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setIsDefault(boolean newIsDefault) {
boolean oldIsDefault = isDefault;
isDefault = newIsDefault;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, QVTcoreBaseCSPackage.PREDICATE_OR_ASSIGNMENT_CS__IS_DEFAULT, oldIsDefault, isDefault));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public ExpCS getOwnedTarget() {
return ownedTarget;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetOwnedTarget(ExpCS newOwnedTarget, NotificationChain msgs) {
ExpCS oldOwnedTarget = ownedTarget;
ownedTarget = newOwnedTarget;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, QVTcoreBaseCSPackage.PREDICATE_OR_ASSIGNMENT_CS__OWNED_TARGET, oldOwnedTarget, newOwnedTarget);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setOwnedTarget(ExpCS newOwnedTarget) {
if (newOwnedTarget != ownedTarget) {
NotificationChain msgs = null;
if (ownedTarget != null)
msgs = ((InternalEObject)ownedTarget).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - QVTcoreBaseCSPackage.PREDICATE_OR_ASSIGNMENT_CS__OWNED_TARGET, null, msgs);
if (newOwnedTarget != null)
msgs = ((InternalEObject)newOwnedTarget).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - QVTcoreBaseCSPackage.PREDICATE_OR_ASSIGNMENT_CS__OWNED_TARGET, null, msgs);
msgs = basicSetOwnedTarget(newOwnedTarget, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, QVTcoreBaseCSPackage.PREDICATE_OR_ASSIGNMENT_CS__OWNED_TARGET, newOwnedTarget, newOwnedTarget));
}
/**
* <!-- 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, QVTcoreBaseCSPackage.PREDICATE_OR_ASSIGNMENT_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 - QVTcoreBaseCSPackage.PREDICATE_OR_ASSIGNMENT_CS__OWNED_INIT_EXPRESSION, null, msgs);
if (newOwnedInitExpression != null)
msgs = ((InternalEObject)newOwnedInitExpression).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - QVTcoreBaseCSPackage.PREDICATE_OR_ASSIGNMENT_CS__OWNED_INIT_EXPRESSION, null, msgs);
msgs = basicSetOwnedInitExpression(newOwnedInitExpression, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, QVTcoreBaseCSPackage.PREDICATE_OR_ASSIGNMENT_CS__OWNED_INIT_EXPRESSION, newOwnedInitExpression, newOwnedInitExpression));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@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 QVTcoreBaseCSPackage.PREDICATE_OR_ASSIGNMENT_CS__OWNED_TARGET:
return basicSetOwnedTarget(null, msgs);
case QVTcoreBaseCSPackage.PREDICATE_OR_ASSIGNMENT_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 QVTcoreBaseCSPackage.PREDICATE_OR_ASSIGNMENT_CS__IS_DEFAULT:
return isIsDefault();
case QVTcoreBaseCSPackage.PREDICATE_OR_ASSIGNMENT_CS__OWNED_TARGET:
return getOwnedTarget();
case QVTcoreBaseCSPackage.PREDICATE_OR_ASSIGNMENT_CS__OWNED_INIT_EXPRESSION:
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 QVTcoreBaseCSPackage.PREDICATE_OR_ASSIGNMENT_CS__IS_DEFAULT:
setIsDefault((Boolean)newValue);
return;
case QVTcoreBaseCSPackage.PREDICATE_OR_ASSIGNMENT_CS__OWNED_TARGET:
setOwnedTarget((ExpCS)newValue);
return;
case QVTcoreBaseCSPackage.PREDICATE_OR_ASSIGNMENT_CS__OWNED_INIT_EXPRESSION:
setOwnedInitExpression((ExpCS)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case QVTcoreBaseCSPackage.PREDICATE_OR_ASSIGNMENT_CS__IS_DEFAULT:
setIsDefault(IS_DEFAULT_EDEFAULT);
return;
case QVTcoreBaseCSPackage.PREDICATE_OR_ASSIGNMENT_CS__OWNED_TARGET:
setOwnedTarget((ExpCS)null);
return;
case QVTcoreBaseCSPackage.PREDICATE_OR_ASSIGNMENT_CS__OWNED_INIT_EXPRESSION:
setOwnedInitExpression((ExpCS)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case QVTcoreBaseCSPackage.PREDICATE_OR_ASSIGNMENT_CS__IS_DEFAULT:
return isDefault != IS_DEFAULT_EDEFAULT;
case QVTcoreBaseCSPackage.PREDICATE_OR_ASSIGNMENT_CS__OWNED_TARGET:
return ownedTarget != null;
case QVTcoreBaseCSPackage.PREDICATE_OR_ASSIGNMENT_CS__OWNED_INIT_EXPRESSION:
return ownedInitExpression != null;
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public <R> R accept(@NonNull BaseCSVisitor<R> visitor) {
return (R) ((QVTcoreBaseCSVisitor<?>)visitor).visitPredicateOrAssignmentCS(this);
}
} //AssignmentCSImpl