| /** |
| * <copyright> |
| * Copyright (c) 2013 Willink Transformations, University of York, 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 |
| * Adolfo Sanchez-Barbudo (University of York) - Bug397429 |
| * </copyright> |
| */ |
| package org.eclipse.qvto.examples.pivot.qvtoperational.impl; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| import org.eclipse.emf.common.notify.NotificationChain; |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.InternalEObject; |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| import org.eclipse.ocl.pivot.OCLExpression; |
| import org.eclipse.ocl.pivot.Property; |
| import org.eclipse.ocl.pivot.internal.PropertyImpl; |
| import org.eclipse.ocl.pivot.util.Visitor; |
| import org.eclipse.qvto.examples.pivot.qvtoperational.ContextualProperty; |
| import org.eclipse.qvto.examples.pivot.qvtoperational.QVTOperationalPackage; |
| import org.eclipse.qvto.examples.pivot.qvtoperational.util.QVTOperationalVisitor; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Contextual Property</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.qvto.examples.pivot.qvtoperational.impl.ContextualPropertyImpl#getContext <em>Context</em>}</li> |
| * <li>{@link org.eclipse.qvto.examples.pivot.qvtoperational.impl.ContextualPropertyImpl#getInitExpression <em>Init Expression</em>}</li> |
| * <li>{@link org.eclipse.qvto.examples.pivot.qvtoperational.impl.ContextualPropertyImpl#getOverridden <em>Overridden</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class ContextualPropertyImpl extends PropertyImpl implements ContextualProperty { |
| /** |
| * The cached value of the '{@link #getContext() <em>Context</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getContext() |
| * @generated |
| * @ordered |
| */ |
| protected org.eclipse.ocl.pivot.Class context; |
| |
| /** |
| * The cached value of the '{@link #getInitExpression() <em>Init Expression</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getInitExpression() |
| * @generated |
| * @ordered |
| */ |
| protected OCLExpression initExpression; |
| |
| /** |
| * The cached value of the '{@link #getOverridden() <em>Overridden</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getOverridden() |
| * @generated |
| * @ordered |
| */ |
| protected Property overridden; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected ContextualPropertyImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return QVTOperationalPackage.Literals.CONTEXTUAL_PROPERTY; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public org.eclipse.ocl.pivot.Class getContext() { |
| if (context != null && context.eIsProxy()) { |
| InternalEObject oldContext = (InternalEObject)context; |
| context = (org.eclipse.ocl.pivot.Class)eResolveProxy(oldContext); |
| if (context != oldContext) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, QVTOperationalPackage.CONTEXTUAL_PROPERTY__CONTEXT, oldContext, context)); |
| } |
| } |
| return context; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public org.eclipse.ocl.pivot.Class basicGetContext() { |
| return context; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setContext(org.eclipse.ocl.pivot.Class newContext) { |
| org.eclipse.ocl.pivot.Class oldContext = context; |
| context = newContext; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, QVTOperationalPackage.CONTEXTUAL_PROPERTY__CONTEXT, oldContext, context)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public OCLExpression getInitExpression() { |
| return initExpression; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetInitExpression(OCLExpression newInitExpression, NotificationChain msgs) { |
| OCLExpression oldInitExpression = initExpression; |
| initExpression = newInitExpression; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, QVTOperationalPackage.CONTEXTUAL_PROPERTY__INIT_EXPRESSION, oldInitExpression, newInitExpression); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setInitExpression(OCLExpression newInitExpression) { |
| if (newInitExpression != initExpression) { |
| NotificationChain msgs = null; |
| if (initExpression != null) |
| msgs = ((InternalEObject)initExpression).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - QVTOperationalPackage.CONTEXTUAL_PROPERTY__INIT_EXPRESSION, null, msgs); |
| if (newInitExpression != null) |
| msgs = ((InternalEObject)newInitExpression).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - QVTOperationalPackage.CONTEXTUAL_PROPERTY__INIT_EXPRESSION, null, msgs); |
| msgs = basicSetInitExpression(newInitExpression, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, QVTOperationalPackage.CONTEXTUAL_PROPERTY__INIT_EXPRESSION, newInitExpression, newInitExpression)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Property getOverridden() { |
| if (overridden != null && overridden.eIsProxy()) { |
| InternalEObject oldOverridden = (InternalEObject)overridden; |
| overridden = (Property)eResolveProxy(oldOverridden); |
| if (overridden != oldOverridden) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, QVTOperationalPackage.CONTEXTUAL_PROPERTY__OVERRIDDEN, oldOverridden, overridden)); |
| } |
| } |
| return overridden; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Property basicGetOverridden() { |
| return overridden; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setOverridden(Property newOverridden) { |
| Property oldOverridden = overridden; |
| overridden = newOverridden; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, QVTOperationalPackage.CONTEXTUAL_PROPERTY__OVERRIDDEN, oldOverridden, overridden)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case QVTOperationalPackage.CONTEXTUAL_PROPERTY__INIT_EXPRESSION: |
| return basicSetInitExpression(null, 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 QVTOperationalPackage.CONTEXTUAL_PROPERTY__CONTEXT: |
| if (resolve) return getContext(); |
| return basicGetContext(); |
| case QVTOperationalPackage.CONTEXTUAL_PROPERTY__INIT_EXPRESSION: |
| return getInitExpression(); |
| case QVTOperationalPackage.CONTEXTUAL_PROPERTY__OVERRIDDEN: |
| if (resolve) return getOverridden(); |
| return basicGetOverridden(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case QVTOperationalPackage.CONTEXTUAL_PROPERTY__CONTEXT: |
| setContext((org.eclipse.ocl.pivot.Class)newValue); |
| return; |
| case QVTOperationalPackage.CONTEXTUAL_PROPERTY__INIT_EXPRESSION: |
| setInitExpression((OCLExpression)newValue); |
| return; |
| case QVTOperationalPackage.CONTEXTUAL_PROPERTY__OVERRIDDEN: |
| setOverridden((Property)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case QVTOperationalPackage.CONTEXTUAL_PROPERTY__CONTEXT: |
| setContext((org.eclipse.ocl.pivot.Class)null); |
| return; |
| case QVTOperationalPackage.CONTEXTUAL_PROPERTY__INIT_EXPRESSION: |
| setInitExpression((OCLExpression)null); |
| return; |
| case QVTOperationalPackage.CONTEXTUAL_PROPERTY__OVERRIDDEN: |
| setOverridden((Property)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case QVTOperationalPackage.CONTEXTUAL_PROPERTY__CONTEXT: |
| return context != null; |
| case QVTOperationalPackage.CONTEXTUAL_PROPERTY__INIT_EXPRESSION: |
| return initExpression != null; |
| case QVTOperationalPackage.CONTEXTUAL_PROPERTY__OVERRIDDEN: |
| return overridden != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * {@inheritDoc} |
| * @generated |
| */ |
| @SuppressWarnings("unchecked") |
| @Override |
| public <R> R accept(Visitor<R> visitor) { |
| return (R) ((QVTOperationalVisitor<?>)visitor).visitContextualProperty(this); |
| } |
| |
| } //ContextualPropertyImpl |