| /******************************************************************************* |
| * Copyright (c) 2008, 2012 Obeo. |
| * 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: |
| * Obeo - initial API and implementation |
| *******************************************************************************/ |
| package org.eclipse.acceleo.model.mtl.impl; |
| |
| import java.util.Collection; |
| |
| import org.eclipse.acceleo.model.mtl.MtlPackage; |
| import org.eclipse.acceleo.model.mtl.Query; |
| import org.eclipse.acceleo.model.mtl.QueryInvocation; |
| 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.ocl.ecore.OCLExpression; |
| |
| /** |
| * <!-- begin-user-doc --> An implementation of the model object ' <em><b>Query Invocation</b></em>'. <!-- |
| * end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.acceleo.model.mtl.impl.QueryInvocationImpl#getDefinition <em>Definition</em>}</li> |
| * <li>{@link org.eclipse.acceleo.model.mtl.impl.QueryInvocationImpl#getArgument <em>Argument</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class QueryInvocationImpl extends TemplateExpressionImpl implements QueryInvocation { |
| /** |
| * The cached value of the '{@link #getDefinition() <em>Definition</em>}' reference. <!-- begin-user-doc |
| * --> <!-- end-user-doc --> |
| * |
| * @see #getDefinition() |
| * @generated |
| * @ordered |
| */ |
| protected Query definition; |
| |
| /** |
| * The cached value of the '{@link #getArgument() <em>Argument</em>}' containment reference list. <!-- |
| * begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @see #getArgument() |
| * @generated |
| * @ordered |
| */ |
| protected EList<OCLExpression> argument; |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| protected QueryInvocationImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return MtlPackage.Literals.QUERY_INVOCATION; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public Query getDefinition() { |
| if (definition != null && definition.eIsProxy()) { |
| InternalEObject oldDefinition = (InternalEObject)definition; |
| definition = (Query)eResolveProxy(oldDefinition); |
| if (definition != oldDefinition) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, |
| MtlPackage.QUERY_INVOCATION__DEFINITION, oldDefinition, definition)); |
| } |
| } |
| return definition; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public Query basicGetDefinition() { |
| return definition; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public void setDefinition(Query newDefinition) { |
| Query oldDefinition = definition; |
| definition = newDefinition; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, MtlPackage.QUERY_INVOCATION__DEFINITION, |
| oldDefinition, definition)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public EList<OCLExpression> getArgument() { |
| if (argument == null) { |
| argument = new EObjectContainmentEList<OCLExpression>(OCLExpression.class, this, |
| MtlPackage.QUERY_INVOCATION__ARGUMENT); |
| } |
| return argument; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case MtlPackage.QUERY_INVOCATION__ARGUMENT: |
| return ((InternalEList<?>)getArgument()).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 MtlPackage.QUERY_INVOCATION__DEFINITION: |
| if (resolve) |
| return getDefinition(); |
| return basicGetDefinition(); |
| case MtlPackage.QUERY_INVOCATION__ARGUMENT: |
| return getArgument(); |
| } |
| 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 MtlPackage.QUERY_INVOCATION__DEFINITION: |
| setDefinition((Query)newValue); |
| return; |
| case MtlPackage.QUERY_INVOCATION__ARGUMENT: |
| getArgument().clear(); |
| getArgument().addAll((Collection<? extends OCLExpression>)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case MtlPackage.QUERY_INVOCATION__DEFINITION: |
| setDefinition((Query)null); |
| return; |
| case MtlPackage.QUERY_INVOCATION__ARGUMENT: |
| getArgument().clear(); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case MtlPackage.QUERY_INVOCATION__DEFINITION: |
| return definition != null; |
| case MtlPackage.QUERY_INVOCATION__ARGUMENT: |
| return argument != null && !argument.isEmpty(); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| } // QueryInvocationImpl |