blob: 843b039ed4f7b7cef9acb4391c86a4d7196d1e20 [file] [log] [blame]
/*******************************************************************************
* 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
*******************************************************************************/
package org.eclipse.qvtd.xtext.qvtimperativecs.impl;
import java.util.Collection;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.ocl.xtext.basecs.PathNameCS;
import org.eclipse.ocl.xtext.basecs.impl.ModelElementCSImpl;
import org.eclipse.ocl.xtext.basecs.util.BaseCSVisitor;
import org.eclipse.ocl.xtext.essentialoclcs.impl.ExpCSImpl;
import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
import org.eclipse.qvtd.xtext.qvtimperativecs.MappingCallCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.MappingParameterBindingCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.QVTimperativeCSPackage;
import org.eclipse.qvtd.xtext.qvtimperativecs.util.QVTimperativeCSVisitor;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Mapping Call CS</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.qvtd.xtext.qvtimperativecs.impl.MappingCallCSImpl#isIsInstall <em>Is Install</em>}</li>
* <li>{@link org.eclipse.qvtd.xtext.qvtimperativecs.impl.MappingCallCSImpl#isIsInvoke <em>Is Invoke</em>}</li>
* <li>{@link org.eclipse.qvtd.xtext.qvtimperativecs.impl.MappingCallCSImpl#getOwnedBindings <em>Owned Bindings</em>}</li>
* <li>{@link org.eclipse.qvtd.xtext.qvtimperativecs.impl.MappingCallCSImpl#getOwnedPathName <em>Owned Path Name</em>}</li>
* <li>{@link org.eclipse.qvtd.xtext.qvtimperativecs.impl.MappingCallCSImpl#getReferredMapping <em>Referred Mapping</em>}</li>
* </ul>
*
* @generated
*/
public class MappingCallCSImpl extends MappingStatementCSImpl implements MappingCallCS {
/**
* The number of structural features of the '<em>Mapping Call CS</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public static final int MAPPING_CALL_CS_FEATURE_COUNT = MappingStatementCSImpl.MAPPING_STATEMENT_CS_FEATURE_COUNT + 5;
/**
* The default value of the '{@link #isIsInstall() <em>Is Install</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isIsInstall()
* @generated
* @ordered
*/
protected static final boolean IS_INSTALL_EDEFAULT = false;
/**
* The cached value of the '{@link #isIsInstall() <em>Is Install</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isIsInstall()
* @generated
* @ordered
*/
protected boolean isInstall = IS_INSTALL_EDEFAULT;
/**
* The default value of the '{@link #isIsInvoke() <em>Is Invoke</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isIsInvoke()
* @generated
* @ordered
*/
protected static final boolean IS_INVOKE_EDEFAULT = false;
/**
* The cached value of the '{@link #isIsInvoke() <em>Is Invoke</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isIsInvoke()
* @generated
* @ordered
*/
protected boolean isInvoke = IS_INVOKE_EDEFAULT;
/**
* The cached value of the '{@link #getOwnedBindings() <em>Owned Bindings</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOwnedBindings()
* @generated
* @ordered
*/
protected EList<MappingParameterBindingCS> ownedBindings;
/**
* 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;
/**
* The cached value of the '{@link #getReferredMapping() <em>Referred Mapping</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getReferredMapping()
* @generated
* @ordered
*/
protected Mapping referredMapping;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected MappingCallCSImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return QVTimperativeCSPackage.Literals.MAPPING_CALL_CS;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean isIsInstall() {
return isInstall;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setIsInstall(boolean newIsInstall) {
boolean oldIsInstall = isInstall;
isInstall = newIsInstall;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 0, oldIsInstall, isInstall));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean isIsInvoke() {
return isInvoke;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setIsInvoke(boolean newIsInvoke) {
boolean oldIsInvoke = isInvoke;
isInvoke = newIsInvoke;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 1, oldIsInvoke, isInvoke));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Mapping getReferredMapping() {
return referredMapping;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setReferredMapping(Mapping newReferredMapping) {
Mapping oldReferredMapping = referredMapping;
referredMapping = newReferredMapping;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 4, oldReferredMapping, referredMapping));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
@Override
public String toString() {
return super.toString();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EList<MappingParameterBindingCS> getOwnedBindings() {
if (ownedBindings == null) {
ownedBindings = new EObjectContainmentWithInverseEList<MappingParameterBindingCS>(MappingParameterBindingCS.class, this, ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 2, ExpCSImpl.EXP_CS_FEATURE_COUNT + 0);
}
return ownedBindings;
}
/**
* <!-- 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, ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 3, 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 - (ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 3), null, msgs);
if (newOwnedPathName != null)
msgs = ((InternalEObject)newOwnedPathName).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - (ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 3), null, msgs);
msgs = basicSetOwnedPathName(newOwnedPathName, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 3, newOwnedPathName, newOwnedPathName));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 2:
return ((InternalEList<InternalEObject>)(InternalEList<?>)getOwnedBindings()).basicAdd(otherEnd, msgs);
}
return super.eInverseAdd(otherEnd, featureID, msgs);
}
/**
* <!-- 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 + 2:
return ((InternalEList<?>)getOwnedBindings()).basicRemove(otherEnd, msgs);
case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 3:
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 ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 0:
return isIsInstall();
case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 1:
return isIsInvoke();
case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 2:
return getOwnedBindings();
case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 3:
return getOwnedPathName();
case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 4:
return getReferredMapping();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 0:
setIsInstall((Boolean)newValue);
return;
case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 1:
setIsInvoke((Boolean)newValue);
return;
case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 2:
getOwnedBindings().clear();
getOwnedBindings().addAll((Collection<? extends MappingParameterBindingCS>)newValue);
return;
case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 3:
setOwnedPathName((PathNameCS)newValue);
return;
case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 4:
setReferredMapping((Mapping)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 + 0:
setIsInstall(IS_INSTALL_EDEFAULT);
return;
case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 1:
setIsInvoke(IS_INVOKE_EDEFAULT);
return;
case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 2:
getOwnedBindings().clear();
return;
case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 3:
setOwnedPathName((PathNameCS)null);
return;
case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 4:
setReferredMapping((Mapping)null);
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 + 0:
return isInstall != IS_INSTALL_EDEFAULT;
case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 1:
return isInvoke != IS_INVOKE_EDEFAULT;
case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 2:
return ownedBindings != null && !ownedBindings.isEmpty();
case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 3:
return ownedPathName != null;
case ModelElementCSImpl.MODEL_ELEMENT_CS_FEATURE_COUNT + 4:
return referredMapping != null;
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public <R> R accept(@NonNull BaseCSVisitor<R> visitor) {
if (visitor instanceof QVTimperativeCSVisitor) {
return (R) ((QVTimperativeCSVisitor<?>)visitor).visitMappingCallCS(this);
}
else {
return super.accept(visitor);
}
}
} //MappingCallCSImpl