| /******************************************************************************* |
| * Copyright (c) 2008-2011 Chair for Applied Software Engineering, |
| * Technische Universitaet Muenchen. |
| * 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: |
| ******************************************************************************/ |
| package org.eclipse.emf.emfstore.internal.server.model.versioning.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.emf.emfstore.internal.server.model.impl.api.versionspec.ESAncestorVersionSpecImpl; |
| import org.eclipse.emf.emfstore.internal.server.model.versioning.AncestorVersionSpec; |
| import org.eclipse.emf.emfstore.internal.server.model.versioning.PrimaryVersionSpec; |
| import org.eclipse.emf.emfstore.internal.server.model.versioning.VersioningPackage; |
| |
| /** |
| * <!-- begin-user-doc --> An implementation of the model object ' <em><b>Ancestor Version Spec</b></em>'. <!-- |
| * end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.emf.emfstore.internal.server.model.versioning.impl.AncestorVersionSpecImpl#getTarget |
| * <em>Target</em>}</li> |
| * <li>{@link org.eclipse.emf.emfstore.internal.server.model.versioning.impl.AncestorVersionSpecImpl#getSource |
| * <em>Source</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class AncestorVersionSpecImpl extends VersionSpecImpl implements AncestorVersionSpec { |
| |
| /** |
| * The cached value of the '{@link #getTarget() <em>Target</em>}' containment reference. |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @see #getTarget() |
| * @generated |
| * @ordered |
| */ |
| protected PrimaryVersionSpec target; |
| |
| /** |
| * The cached value of the '{@link #getSource() <em>Source</em>}' containment reference. |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @see #getSource() |
| * @generated |
| * @ordered |
| */ |
| protected PrimaryVersionSpec source; |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| protected AncestorVersionSpecImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return VersioningPackage.Literals.ANCESTOR_VERSION_SPEC; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public PrimaryVersionSpec getTarget() { |
| if (target != null && target.eIsProxy()) { |
| final InternalEObject oldTarget = (InternalEObject) target; |
| target = (PrimaryVersionSpec) eResolveProxy(oldTarget); |
| if (target != oldTarget) { |
| final InternalEObject newTarget = (InternalEObject) target; |
| NotificationChain msgs = oldTarget.eInverseRemove(this, |
| EOPPOSITE_FEATURE_BASE - VersioningPackage.ANCESTOR_VERSION_SPEC__TARGET, null, null); |
| if (newTarget.eInternalContainer() == null) { |
| msgs = newTarget.eInverseAdd(this, |
| EOPPOSITE_FEATURE_BASE - VersioningPackage.ANCESTOR_VERSION_SPEC__TARGET, null, msgs); |
| } |
| if (msgs != null) { |
| msgs.dispatch(); |
| } |
| if (eNotificationRequired()) { |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, |
| VersioningPackage.ANCESTOR_VERSION_SPEC__TARGET, oldTarget, target)); |
| } |
| } |
| } |
| return target; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public PrimaryVersionSpec basicGetTarget() { |
| return target; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public NotificationChain basicSetTarget(PrimaryVersionSpec newTarget, NotificationChain msgs) { |
| final PrimaryVersionSpec oldTarget = target; |
| target = newTarget; |
| if (eNotificationRequired()) { |
| final ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, |
| VersioningPackage.ANCESTOR_VERSION_SPEC__TARGET, oldTarget, newTarget); |
| if (msgs == null) { |
| msgs = notification; |
| } else { |
| msgs.add(notification); |
| } |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public void setTarget(PrimaryVersionSpec newTarget) { |
| if (newTarget != target) { |
| NotificationChain msgs = null; |
| if (target != null) { |
| msgs = ((InternalEObject) target).eInverseRemove(this, |
| EOPPOSITE_FEATURE_BASE - VersioningPackage.ANCESTOR_VERSION_SPEC__TARGET, null, msgs); |
| } |
| if (newTarget != null) { |
| msgs = ((InternalEObject) newTarget).eInverseAdd(this, |
| EOPPOSITE_FEATURE_BASE - VersioningPackage.ANCESTOR_VERSION_SPEC__TARGET, null, msgs); |
| } |
| msgs = basicSetTarget(newTarget, msgs); |
| if (msgs != null) { |
| msgs.dispatch(); |
| } |
| } else if (eNotificationRequired()) { |
| eNotify(new ENotificationImpl(this, Notification.SET, VersioningPackage.ANCESTOR_VERSION_SPEC__TARGET, |
| newTarget, newTarget)); |
| } |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public PrimaryVersionSpec getSource() { |
| if (source != null && source.eIsProxy()) { |
| final InternalEObject oldSource = (InternalEObject) source; |
| source = (PrimaryVersionSpec) eResolveProxy(oldSource); |
| if (source != oldSource) { |
| final InternalEObject newSource = (InternalEObject) source; |
| NotificationChain msgs = oldSource.eInverseRemove(this, |
| EOPPOSITE_FEATURE_BASE - VersioningPackage.ANCESTOR_VERSION_SPEC__SOURCE, null, null); |
| if (newSource.eInternalContainer() == null) { |
| msgs = newSource.eInverseAdd(this, |
| EOPPOSITE_FEATURE_BASE - VersioningPackage.ANCESTOR_VERSION_SPEC__SOURCE, null, msgs); |
| } |
| if (msgs != null) { |
| msgs.dispatch(); |
| } |
| if (eNotificationRequired()) { |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, |
| VersioningPackage.ANCESTOR_VERSION_SPEC__SOURCE, oldSource, source)); |
| } |
| } |
| } |
| return source; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public PrimaryVersionSpec basicGetSource() { |
| return source; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public NotificationChain basicSetSource(PrimaryVersionSpec newSource, NotificationChain msgs) { |
| final PrimaryVersionSpec oldSource = source; |
| source = newSource; |
| if (eNotificationRequired()) { |
| final ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, |
| VersioningPackage.ANCESTOR_VERSION_SPEC__SOURCE, oldSource, newSource); |
| if (msgs == null) { |
| msgs = notification; |
| } else { |
| msgs.add(notification); |
| } |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public void setSource(PrimaryVersionSpec newSource) { |
| if (newSource != source) { |
| NotificationChain msgs = null; |
| if (source != null) { |
| msgs = ((InternalEObject) source).eInverseRemove(this, |
| EOPPOSITE_FEATURE_BASE - VersioningPackage.ANCESTOR_VERSION_SPEC__SOURCE, null, msgs); |
| } |
| if (newSource != null) { |
| msgs = ((InternalEObject) newSource).eInverseAdd(this, |
| EOPPOSITE_FEATURE_BASE - VersioningPackage.ANCESTOR_VERSION_SPEC__SOURCE, null, msgs); |
| } |
| msgs = basicSetSource(newSource, msgs); |
| if (msgs != null) { |
| msgs.dispatch(); |
| } |
| } else if (eNotificationRequired()) { |
| eNotify(new ENotificationImpl(this, Notification.SET, VersioningPackage.ANCESTOR_VERSION_SPEC__SOURCE, |
| newSource, newSource)); |
| } |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case VersioningPackage.ANCESTOR_VERSION_SPEC__TARGET: |
| return basicSetTarget(null, msgs); |
| case VersioningPackage.ANCESTOR_VERSION_SPEC__SOURCE: |
| return basicSetSource(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 VersioningPackage.ANCESTOR_VERSION_SPEC__TARGET: |
| if (resolve) { |
| return getTarget(); |
| } |
| return basicGetTarget(); |
| case VersioningPackage.ANCESTOR_VERSION_SPEC__SOURCE: |
| if (resolve) { |
| return getSource(); |
| } |
| return basicGetSource(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case VersioningPackage.ANCESTOR_VERSION_SPEC__TARGET: |
| setTarget((PrimaryVersionSpec) newValue); |
| return; |
| case VersioningPackage.ANCESTOR_VERSION_SPEC__SOURCE: |
| setSource((PrimaryVersionSpec) newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case VersioningPackage.ANCESTOR_VERSION_SPEC__TARGET: |
| setTarget((PrimaryVersionSpec) null); |
| return; |
| case VersioningPackage.ANCESTOR_VERSION_SPEC__SOURCE: |
| setSource((PrimaryVersionSpec) null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case VersioningPackage.ANCESTOR_VERSION_SPEC__TARGET: |
| return target != null; |
| case VersioningPackage.ANCESTOR_VERSION_SPEC__SOURCE: |
| return source != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * @generated NOT |
| */ |
| private ESAncestorVersionSpecImpl apiImpl; |
| |
| /** |
| * |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.emf.emfstore.internal.common.api.APIDelegate#toAPI() |
| * |
| * @generated NOT |
| */ |
| public ESAncestorVersionSpecImpl toAPI() { |
| if (apiImpl == null) { |
| apiImpl = createAPI(); |
| } |
| |
| return apiImpl; |
| } |
| |
| /** |
| * |
| * {@inheritDoc} |
| * |
| * @see org.eclipse.emf.emfstore.internal.common.api.APIDelegate#createAPI() |
| * |
| * @generated NOT |
| */ |
| public ESAncestorVersionSpecImpl createAPI() { |
| return new ESAncestorVersionSpecImpl(this); |
| } |
| |
| } // AncestorVersionSpecImpl |