| /**
|
| * *******************************************************************************
|
| * Copyright (c) 2009, 2019 Mia-Software 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:
|
| *
|
| * Fabien Giquel (Mia-Software) - initial API and implementation
|
| * Gregoire DUPE (Mia-Software) - initial API and implementation
|
| * *******************************************************************************
|
| *
|
| * $Id$
|
| */ |
| package org.eclipse.modisco.java.nousages.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.EObjectContainmentWithInverseEList;
|
| import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList;
|
| import org.eclipse.emf.ecore.util.InternalEList;
|
| import org.eclipse.modisco.java.AbstractMethodDeclaration;
|
| import org.eclipse.modisco.java.AbstractMethodInvocation;
|
| import org.eclipse.modisco.java.Block;
|
| import org.eclipse.modisco.java.MethodRef;
|
| import org.eclipse.modisco.java.SingleVariableDeclaration;
|
| import org.eclipse.modisco.java.TypeAccess;
|
| import org.eclipse.modisco.java.TypeParameter;
|
| import org.eclipse.modisco.java.nousages.meta.JavaPackage;
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * An implementation of the model object '<em><b>Abstract Method Declaration</b></em>'.
|
| * <!-- end-user-doc -->
|
| * <p>
|
| * The following features are implemented:
|
| * <ul>
|
| * <li>{@link org.eclipse.modisco.java.nousages.impl.AbstractMethodDeclarationImpl#getBody <em>Body</em>}</li>
|
| * <li>{@link org.eclipse.modisco.java.nousages.impl.AbstractMethodDeclarationImpl#getParameters <em>Parameters</em>}</li>
|
| * <li>{@link org.eclipse.modisco.java.nousages.impl.AbstractMethodDeclarationImpl#getThrownExceptions <em>Thrown Exceptions</em>}</li>
|
| * <li>{@link org.eclipse.modisco.java.nousages.impl.AbstractMethodDeclarationImpl#getTypeParameters <em>Type Parameters</em>}</li>
|
| * </ul>
|
| * </p>
|
| *
|
| * @generated
|
| */
|
| public abstract class AbstractMethodDeclarationImpl extends BodyDeclarationImpl implements AbstractMethodDeclaration {
|
| /**
|
| * The cached value of the '{@link #getBody() <em>Body</em>}' containment reference.
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @see #getBody()
|
| * @generated
|
| * @ordered
|
| */
|
| protected Block body;
|
|
|
| /**
|
| * The cached value of the '{@link #getParameters() <em>Parameters</em>}' containment reference list.
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @see #getParameters()
|
| * @generated
|
| * @ordered
|
| */
|
| protected EList<SingleVariableDeclaration> parameters;
|
|
|
| /**
|
| * The cached value of the '{@link #getThrownExceptions() <em>Thrown Exceptions</em>}' containment reference list.
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @see #getThrownExceptions()
|
| * @generated
|
| * @ordered
|
| */
|
| protected EList<TypeAccess> thrownExceptions;
|
|
|
| /**
|
| * The cached value of the '{@link #getTypeParameters() <em>Type Parameters</em>}' containment reference list.
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @see #getTypeParameters()
|
| * @generated
|
| * @ordered
|
| */
|
| protected EList<TypeParameter> typeParameters;
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| protected AbstractMethodDeclarationImpl() {
|
| super();
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| @Override
|
| protected EClass eStaticClass() {
|
| return JavaPackage.eINSTANCE.getAbstractMethodDeclaration();
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| public Block getBody() {
|
| return body;
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| public NotificationChain basicSetBody(Block newBody, NotificationChain msgs) {
|
| Block oldBody = body;
|
| body = newBody;
|
| if (eNotificationRequired()) {
|
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, JavaPackage.ABSTRACT_METHOD_DECLARATION__BODY, oldBody, newBody);
|
| if (msgs == null) msgs = notification; else msgs.add(notification);
|
| }
|
| return msgs;
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| public void setBody(Block newBody) {
|
| if (newBody != body) {
|
| NotificationChain msgs = null;
|
| if (body != null)
|
| msgs = ((InternalEObject)body).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - JavaPackage.ABSTRACT_METHOD_DECLARATION__BODY, null, msgs);
|
| if (newBody != null)
|
| msgs = ((InternalEObject)newBody).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - JavaPackage.ABSTRACT_METHOD_DECLARATION__BODY, null, msgs);
|
| msgs = basicSetBody(newBody, msgs);
|
| if (msgs != null) msgs.dispatch();
|
| }
|
| else if (eNotificationRequired())
|
| eNotify(new ENotificationImpl(this, Notification.SET, JavaPackage.ABSTRACT_METHOD_DECLARATION__BODY, newBody, newBody));
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| public EList<SingleVariableDeclaration> getParameters() {
|
| if (parameters == null) {
|
| parameters = new EObjectContainmentWithInverseEList<SingleVariableDeclaration>(SingleVariableDeclaration.class, this, JavaPackage.ABSTRACT_METHOD_DECLARATION__PARAMETERS, JavaPackage.SINGLE_VARIABLE_DECLARATION__METHOD_DECLARATION);
|
| }
|
| return parameters;
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| public EList<TypeAccess> getThrownExceptions() {
|
| if (thrownExceptions == null) {
|
| thrownExceptions = new EObjectContainmentEList<TypeAccess>(TypeAccess.class, this, JavaPackage.ABSTRACT_METHOD_DECLARATION__THROWN_EXCEPTIONS);
|
| }
|
| return thrownExceptions;
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| public EList<TypeParameter> getTypeParameters() {
|
| if (typeParameters == null) {
|
| typeParameters = new EObjectContainmentEList<TypeParameter>(TypeParameter.class, this, JavaPackage.ABSTRACT_METHOD_DECLARATION__TYPE_PARAMETERS);
|
| }
|
| return typeParameters;
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| @SuppressWarnings("unchecked")
|
| @Override
|
| public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
|
| switch (featureID) {
|
| case JavaPackage.ABSTRACT_METHOD_DECLARATION__PARAMETERS:
|
| return ((InternalEList<InternalEObject>)(InternalEList<?>)getParameters()).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 JavaPackage.ABSTRACT_METHOD_DECLARATION__BODY:
|
| return basicSetBody(null, msgs);
|
| case JavaPackage.ABSTRACT_METHOD_DECLARATION__PARAMETERS:
|
| return ((InternalEList<?>)getParameters()).basicRemove(otherEnd, msgs);
|
| case JavaPackage.ABSTRACT_METHOD_DECLARATION__THROWN_EXCEPTIONS:
|
| return ((InternalEList<?>)getThrownExceptions()).basicRemove(otherEnd, msgs);
|
| case JavaPackage.ABSTRACT_METHOD_DECLARATION__TYPE_PARAMETERS:
|
| return ((InternalEList<?>)getTypeParameters()).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 JavaPackage.ABSTRACT_METHOD_DECLARATION__BODY:
|
| return getBody();
|
| case JavaPackage.ABSTRACT_METHOD_DECLARATION__PARAMETERS:
|
| return getParameters();
|
| case JavaPackage.ABSTRACT_METHOD_DECLARATION__THROWN_EXCEPTIONS:
|
| return getThrownExceptions();
|
| case JavaPackage.ABSTRACT_METHOD_DECLARATION__TYPE_PARAMETERS:
|
| return getTypeParameters();
|
| }
|
| 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 JavaPackage.ABSTRACT_METHOD_DECLARATION__BODY:
|
| setBody((Block)newValue);
|
| return;
|
| case JavaPackage.ABSTRACT_METHOD_DECLARATION__PARAMETERS:
|
| getParameters().clear();
|
| getParameters().addAll((Collection<? extends SingleVariableDeclaration>)newValue);
|
| return;
|
| case JavaPackage.ABSTRACT_METHOD_DECLARATION__THROWN_EXCEPTIONS:
|
| getThrownExceptions().clear();
|
| getThrownExceptions().addAll((Collection<? extends TypeAccess>)newValue);
|
| return;
|
| case JavaPackage.ABSTRACT_METHOD_DECLARATION__TYPE_PARAMETERS:
|
| getTypeParameters().clear();
|
| getTypeParameters().addAll((Collection<? extends TypeParameter>)newValue);
|
| return;
|
| }
|
| super.eSet(featureID, newValue);
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| @Override
|
| public void eUnset(int featureID) {
|
| switch (featureID) {
|
| case JavaPackage.ABSTRACT_METHOD_DECLARATION__BODY:
|
| setBody((Block)null);
|
| return;
|
| case JavaPackage.ABSTRACT_METHOD_DECLARATION__PARAMETERS:
|
| getParameters().clear();
|
| return;
|
| case JavaPackage.ABSTRACT_METHOD_DECLARATION__THROWN_EXCEPTIONS:
|
| getThrownExceptions().clear();
|
| return;
|
| case JavaPackage.ABSTRACT_METHOD_DECLARATION__TYPE_PARAMETERS:
|
| getTypeParameters().clear();
|
| return;
|
| }
|
| super.eUnset(featureID);
|
| }
|
|
|
| /**
|
| * <!-- begin-user-doc -->
|
| * <!-- end-user-doc -->
|
| * @generated
|
| */
|
| @Override
|
| public boolean eIsSet(int featureID) {
|
| switch (featureID) {
|
| case JavaPackage.ABSTRACT_METHOD_DECLARATION__BODY:
|
| return body != null;
|
| case JavaPackage.ABSTRACT_METHOD_DECLARATION__PARAMETERS:
|
| return parameters != null && !parameters.isEmpty();
|
| case JavaPackage.ABSTRACT_METHOD_DECLARATION__THROWN_EXCEPTIONS:
|
| return thrownExceptions != null && !thrownExceptions.isEmpty();
|
| case JavaPackage.ABSTRACT_METHOD_DECLARATION__TYPE_PARAMETERS:
|
| return typeParameters != null && !typeParameters.isEmpty();
|
| }
|
| return super.eIsSet(featureID);
|
| }
|
|
|
| } //AbstractMethodDeclarationImpl
|