blob: f1cd8aca3922604134fb55eb748bc890becc1222 [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.pivot.qvtimperative.impl;
import org.eclipse.emf.common.notify.Notification;
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.internal.VariableDeclarationImpl;
import org.eclipse.ocl.pivot.util.Visitor;
import org.eclipse.qvtd.pivot.qvtimperative.ImperativeTypedModel;
import org.eclipse.qvtd.pivot.qvtimperative.QVTimperativePackage;
import org.eclipse.qvtd.pivot.qvtimperative.SimpleParameter;
import org.eclipse.qvtd.pivot.qvtimperative.util.QVTimperativeVisitor;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Simple Parameter</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.qvtd.pivot.qvtimperative.impl.SimpleParameterImpl#getReferredTypedModel <em>Referred Typed Model</em>}</li>
* </ul>
*
* @generated
*/
public class SimpleParameterImpl extends MappingParameterImpl implements SimpleParameter {
/**
* The number of structural features of the '<em>Simple Parameter</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public static final int SIMPLE_PARAMETER_FEATURE_COUNT = MappingParameterImpl.MAPPING_PARAMETER_FEATURE_COUNT + 1;
/**
* The number of operations of the '<em>Simple Parameter</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public static final int SIMPLE_PARAMETER_OPERATION_COUNT = MappingParameterImpl.MAPPING_PARAMETER_OPERATION_COUNT + 0;
/**
* The cached value of the '{@link #getReferredTypedModel() <em>Referred Typed Model</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getReferredTypedModel()
* @generated
* @ordered
*/
protected ImperativeTypedModel referredTypedModel;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected SimpleParameterImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return QVTimperativePackage.Literals.SIMPLE_PARAMETER;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public ImperativeTypedModel getReferredTypedModel() {
if (referredTypedModel != null && referredTypedModel.eIsProxy()) {
InternalEObject oldReferredTypedModel = (InternalEObject)referredTypedModel;
referredTypedModel = (ImperativeTypedModel)eResolveProxy(oldReferredTypedModel);
if (referredTypedModel != oldReferredTypedModel) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, VariableDeclarationImpl.VARIABLE_DECLARATION_FEATURE_COUNT + 1, oldReferredTypedModel, referredTypedModel));
}
}
return referredTypedModel;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ImperativeTypedModel basicGetReferredTypedModel() {
return referredTypedModel;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setReferredTypedModel(ImperativeTypedModel newReferredTypedModel) {
ImperativeTypedModel oldReferredTypedModel = referredTypedModel;
referredTypedModel = newReferredTypedModel;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, VariableDeclarationImpl.VARIABLE_DECLARATION_FEATURE_COUNT + 1, oldReferredTypedModel, referredTypedModel));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case VariableDeclarationImpl.VARIABLE_DECLARATION_FEATURE_COUNT + 1:
if (resolve) return getReferredTypedModel();
return basicGetReferredTypedModel();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case VariableDeclarationImpl.VARIABLE_DECLARATION_FEATURE_COUNT + 1:
setReferredTypedModel((ImperativeTypedModel)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case VariableDeclarationImpl.VARIABLE_DECLARATION_FEATURE_COUNT + 1:
setReferredTypedModel((ImperativeTypedModel)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case VariableDeclarationImpl.VARIABLE_DECLARATION_FEATURE_COUNT + 1:
return referredTypedModel != null;
}
return super.eIsSet(featureID);
}
/**
* {@inheritDoc}
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public <R> R accept(@NonNull Visitor<R> visitor) {
return (R) ((QVTimperativeVisitor<?>)visitor).visitSimpleParameter(this);
}
} //SimpleParameterImpl