| /** |
| * Copyright (c) 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.emf.compare.uml2.internal.impl; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| import org.eclipse.emf.compare.Diff; |
| import org.eclipse.emf.compare.ReferenceChange; |
| import org.eclipse.emf.compare.impl.DiffImpl; |
| import org.eclipse.emf.compare.uml2.internal.UMLComparePackage; |
| import org.eclipse.emf.compare.uml2.internal.UMLDiff; |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.EObject; |
| import org.eclipse.emf.ecore.EReference; |
| import org.eclipse.emf.ecore.InternalEObject; |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| |
| /** |
| * <!-- begin-user-doc --> An implementation of the model object '<em><b>UML Diff</b></em>'. <!-- end-user-doc |
| * --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.emf.compare.uml2.internal.impl.UMLDiffImpl#getDiscriminant <em>Discriminant</em>}</li> |
| * <li>{@link org.eclipse.emf.compare.uml2.internal.impl.UMLDiffImpl#getEReference <em>EReference</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public abstract class UMLDiffImpl extends DiffImpl implements UMLDiff { |
| /** |
| * The cached value of the '{@link #getDiscriminant() <em>Discriminant</em>}' reference. <!-- |
| * begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @see #getDiscriminant() |
| * @generated |
| * @ordered |
| */ |
| protected EObject discriminant; |
| |
| /** |
| * The cached value of the '{@link #getEReference() <em>EReference</em>}' reference. |
| * <!-- begin-user-doc |
| * --> <!-- end-user-doc --> |
| * @see #getEReference() |
| * @generated |
| * @ordered |
| */ |
| protected EReference eReference; |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| protected UMLDiffImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return UMLComparePackage.Literals.UML_DIFF; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| public EObject getDiscriminant() { |
| if (discriminant != null && discriminant.eIsProxy()) { |
| InternalEObject oldDiscriminant = (InternalEObject)discriminant; |
| discriminant = eResolveProxy(oldDiscriminant); |
| if (discriminant != oldDiscriminant) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, |
| UMLComparePackage.UML_DIFF__DISCRIMINANT, oldDiscriminant, discriminant)); |
| } |
| } |
| return discriminant; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| public EObject basicGetDiscriminant() { |
| return discriminant; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setDiscriminant(EObject newDiscriminant) { |
| EObject oldDiscriminant = discriminant; |
| discriminant = newDiscriminant; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, UMLComparePackage.UML_DIFF__DISCRIMINANT, |
| oldDiscriminant, discriminant)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| public EReference getEReference() { |
| if (eReference != null && eReference.eIsProxy()) { |
| InternalEObject oldEReference = (InternalEObject)eReference; |
| eReference = (EReference)eResolveProxy(oldEReference); |
| if (eReference != oldEReference) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, |
| UMLComparePackage.UML_DIFF__EREFERENCE, oldEReference, eReference)); |
| } |
| } |
| return eReference; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| public EReference basicGetEReference() { |
| return eReference; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setEReference(EReference newEReference) { |
| EReference oldEReference = eReference; |
| eReference = newEReference; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, UMLComparePackage.UML_DIFF__EREFERENCE, |
| oldEReference, eReference)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated NOT |
| */ |
| public boolean isMainDiff(Diff diff) { |
| if (diff instanceof ReferenceChange) { |
| EObject value = ((ReferenceChange)diff).getValue(); |
| return value == getDiscriminant(); |
| } |
| return false; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case UMLComparePackage.UML_DIFF__DISCRIMINANT: |
| if (resolve) |
| return getDiscriminant(); |
| return basicGetDiscriminant(); |
| case UMLComparePackage.UML_DIFF__EREFERENCE: |
| if (resolve) |
| return getEReference(); |
| return basicGetEReference(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case UMLComparePackage.UML_DIFF__DISCRIMINANT: |
| setDiscriminant((EObject)newValue); |
| return; |
| case UMLComparePackage.UML_DIFF__EREFERENCE: |
| setEReference((EReference)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case UMLComparePackage.UML_DIFF__DISCRIMINANT: |
| setDiscriminant((EObject)null); |
| return; |
| case UMLComparePackage.UML_DIFF__EREFERENCE: |
| setEReference((EReference)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case UMLComparePackage.UML_DIFF__DISCRIMINANT: |
| return discriminant != null; |
| case UMLComparePackage.UML_DIFF__EREFERENCE: |
| return eReference != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| } // UMLDiffImpl |