blob: 6455fcd04d17ea0e2b881f9c4f1bc2823564da19 [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.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.jdt.annotation.Nullable;
import org.eclipse.ocl.xtext.basecs.util.BaseCSVisitor;
import org.eclipse.qvtd.pivot.qvtimperative.Mapping;
import org.eclipse.qvtd.xtext.qvtimperativecs.MappingCallBindingCS;
import org.eclipse.qvtd.xtext.qvtimperativecs.MappingCallCS;
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#isIsInfinite <em>Is Infinite</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#getReferredMapping <em>Referred Mapping</em>}</li>
* </ul>
*
* @generated
*/
public class MappingCallCSImpl extends MappingStatementCSImpl implements MappingCallCS {
/**
* The default value of the '{@link #isIsInfinite() <em>Is Infinite</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isIsInfinite()
* @generated
* @ordered
*/
protected static final boolean IS_INFINITE_EDEFAULT = false;
/**
* The cached value of the '{@link #isIsInfinite() <em>Is Infinite</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isIsInfinite()
* @generated
* @ordered
*/
protected boolean isInfinite = IS_INFINITE_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<MappingCallBindingCS> ownedBindings;
/**
* 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 isIsInfinite() {
return isInfinite;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setIsInfinite(boolean newIsInfinite) {
boolean oldIsInfinite = isInfinite;
isInfinite = newIsInfinite;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, QVTimperativeCSPackage.MAPPING_CALL_CS__IS_INFINITE, oldIsInfinite, isInfinite));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Mapping getReferredMapping() {
if (referredMapping != null && referredMapping.eIsProxy()) {
InternalEObject oldReferredMapping = (InternalEObject)referredMapping;
referredMapping = (Mapping)eResolveProxy(oldReferredMapping);
if (referredMapping != oldReferredMapping) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, QVTimperativeCSPackage.MAPPING_CALL_CS__REFERRED_MAPPING, oldReferredMapping, referredMapping));
}
}
return referredMapping;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Mapping basicGetReferredMapping() {
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, QVTimperativeCSPackage.MAPPING_CALL_CS__REFERRED_MAPPING, oldReferredMapping, referredMapping));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
return super.toString();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EList<MappingCallBindingCS> getOwnedBindings() {
if (ownedBindings == null) {
ownedBindings = new EObjectContainmentWithInverseEList<MappingCallBindingCS>(MappingCallBindingCS.class, this, QVTimperativeCSPackage.MAPPING_CALL_CS__OWNED_BINDINGS, QVTimperativeCSPackage.MAPPING_CALL_BINDING_CS__OWNING_MAPPING_CALL);
}
return ownedBindings;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case QVTimperativeCSPackage.MAPPING_CALL_CS__OWNED_BINDINGS:
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 QVTimperativeCSPackage.MAPPING_CALL_CS__OWNED_BINDINGS:
return ((InternalEList<?>)getOwnedBindings()).basicRemove(otherEnd, 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 QVTimperativeCSPackage.MAPPING_CALL_CS__IS_INFINITE:
return isIsInfinite();
case QVTimperativeCSPackage.MAPPING_CALL_CS__OWNED_BINDINGS:
return getOwnedBindings();
case QVTimperativeCSPackage.MAPPING_CALL_CS__REFERRED_MAPPING:
if (resolve) return getReferredMapping();
return basicGetReferredMapping();
}
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 QVTimperativeCSPackage.MAPPING_CALL_CS__IS_INFINITE:
setIsInfinite((Boolean)newValue);
return;
case QVTimperativeCSPackage.MAPPING_CALL_CS__OWNED_BINDINGS:
getOwnedBindings().clear();
getOwnedBindings().addAll((Collection<? extends MappingCallBindingCS>)newValue);
return;
case QVTimperativeCSPackage.MAPPING_CALL_CS__REFERRED_MAPPING:
setReferredMapping((Mapping)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case QVTimperativeCSPackage.MAPPING_CALL_CS__IS_INFINITE:
setIsInfinite(IS_INFINITE_EDEFAULT);
return;
case QVTimperativeCSPackage.MAPPING_CALL_CS__OWNED_BINDINGS:
getOwnedBindings().clear();
return;
case QVTimperativeCSPackage.MAPPING_CALL_CS__REFERRED_MAPPING:
setReferredMapping((Mapping)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case QVTimperativeCSPackage.MAPPING_CALL_CS__IS_INFINITE:
return isInfinite != IS_INFINITE_EDEFAULT;
case QVTimperativeCSPackage.MAPPING_CALL_CS__OWNED_BINDINGS:
return ownedBindings != null && !ownedBindings.isEmpty();
case QVTimperativeCSPackage.MAPPING_CALL_CS__REFERRED_MAPPING:
return referredMapping != 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) ((QVTimperativeCSVisitor<?>)visitor).visitMappingCallCS(this);
}
} //MappingCallCSImpl