blob: 5149c2cdaeb374886e7337c88d664625bc446fb6 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2018 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:
* Adolfo Sanchez-Barbudo Herrera - initial API and implementation
*******************************************************************************/
/**
*/
package org.eclipse.qvtd.doc.miniocl.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.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.qvtd.doc.miniocl.MiniOCLPackage;
import org.eclipse.qvtd.doc.miniocl.OCLExpression;
import org.eclipse.qvtd.doc.miniocl.Operation;
import org.eclipse.qvtd.doc.miniocl.OperationCallExp;
import org.eclipse.qvtd.doc.miniocl.util.Visitor;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Operation Call Exp</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.qvtd.doc.miniocl.impl.OperationCallExpImpl#getOwnedArguments <em>Owned Arguments</em>}</li>
* <li>{@link org.eclipse.qvtd.doc.miniocl.impl.OperationCallExpImpl#getReferredOperation <em>Referred Operation</em>}</li>
* </ul>
*
* @generated
*/
public class OperationCallExpImpl extends CallExpImpl implements OperationCallExp {
/**
* The cached value of the '{@link #getOwnedArguments() <em>Owned Arguments</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOwnedArguments()
* @generated
* @ordered
*/
protected EList<OCLExpression> ownedArguments;
/**
* The cached value of the '{@link #getReferredOperation() <em>Referred Operation</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getReferredOperation()
* @generated
* @ordered
*/
protected Operation referredOperation;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected OperationCallExpImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return MiniOCLPackage.Literals.OPERATION_CALL_EXP;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<OCLExpression> getOwnedArguments() {
if (ownedArguments == null) {
ownedArguments = new EObjectContainmentEList<OCLExpression>(OCLExpression.class, this, MiniOCLPackage.OPERATION_CALL_EXP__OWNED_ARGUMENTS);
}
return ownedArguments;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Operation getReferredOperation() {
if (referredOperation != null && referredOperation.eIsProxy()) {
InternalEObject oldReferredOperation = (InternalEObject)referredOperation;
referredOperation = (Operation)eResolveProxy(oldReferredOperation);
if (referredOperation != oldReferredOperation) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, MiniOCLPackage.OPERATION_CALL_EXP__REFERRED_OPERATION, oldReferredOperation, referredOperation));
}
}
return referredOperation;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Operation basicGetReferredOperation() {
return referredOperation;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setReferredOperation(Operation newReferredOperation) {
Operation oldReferredOperation = referredOperation;
referredOperation = newReferredOperation;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, MiniOCLPackage.OPERATION_CALL_EXP__REFERRED_OPERATION, oldReferredOperation, referredOperation));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case MiniOCLPackage.OPERATION_CALL_EXP__OWNED_ARGUMENTS:
return ((InternalEList<?>)getOwnedArguments()).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 MiniOCLPackage.OPERATION_CALL_EXP__OWNED_ARGUMENTS:
return getOwnedArguments();
case MiniOCLPackage.OPERATION_CALL_EXP__REFERRED_OPERATION:
if (resolve) return getReferredOperation();
return basicGetReferredOperation();
}
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 MiniOCLPackage.OPERATION_CALL_EXP__OWNED_ARGUMENTS:
getOwnedArguments().clear();
getOwnedArguments().addAll((Collection<? extends OCLExpression>)newValue);
return;
case MiniOCLPackage.OPERATION_CALL_EXP__REFERRED_OPERATION:
setReferredOperation((Operation)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case MiniOCLPackage.OPERATION_CALL_EXP__OWNED_ARGUMENTS:
getOwnedArguments().clear();
return;
case MiniOCLPackage.OPERATION_CALL_EXP__REFERRED_OPERATION:
setReferredOperation((Operation)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case MiniOCLPackage.OPERATION_CALL_EXP__OWNED_ARGUMENTS:
return ownedArguments != null && !ownedArguments.isEmpty();
case MiniOCLPackage.OPERATION_CALL_EXP__REFERRED_OPERATION:
return referredOperation != null;
}
return super.eIsSet(featureID);
}
/**
* {@inheritDoc}
* @generated
*/
@Override
public <R> R accept(@NonNull Visitor<R> visitor) {
return visitor.visitOperationCallExp(this);
}
} //OperationCallExpImpl