/** | |
/** | |
* Copyright (c) 2010, 2012 Ericsson | |
* | |
* 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 | |
* | |
* Description: | |
* | |
* Contributors: | |
* Alvaro Sanchez-Leon - Initial API and implementation | |
* | |
*/ | |
package org.eclipse.mylyn.reviews.r4e.core.model.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.mylyn.reviews.r4e.core.model.R4EContent; | |
import org.eclipse.mylyn.reviews.r4e.core.model.R4EDelta; | |
import org.eclipse.mylyn.reviews.r4e.core.model.RModelPackage; | |
/** | |
* <!-- begin-user-doc --> | |
* An implementation of the model object '<em><b>R4E Delta</b></em>'. | |
* <!-- end-user-doc --> | |
* <p> | |
* The following features are implemented: | |
* <ul> | |
* <li>{@link org.eclipse.mylyn.reviews.r4e.core.model.impl.R4EDeltaImpl#getBase <em>Base</em>}</li> | |
* <li>{@link org.eclipse.mylyn.reviews.r4e.core.model.impl.R4EDeltaImpl#getTarget <em>Target</em>}</li> | |
* </ul> | |
* </p> | |
* | |
* @generated | |
*/ | |
public class R4EDeltaImpl extends R4EIDComponentImpl implements R4EDelta { | |
/** | |
* The cached value of the '{@link #getBase() <em>Base</em>}' containment reference. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getBase() | |
* @generated | |
* @ordered | |
*/ | |
protected R4EContent base; | |
/** | |
* The cached value of the '{@link #getTarget() <em>Target</em>}' containment reference. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getTarget() | |
* @generated | |
* @ordered | |
*/ | |
protected R4EContent target; | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
protected R4EDeltaImpl() { | |
super(); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
protected EClass eStaticClass() { | |
return RModelPackage.Literals.R4E_DELTA; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public R4EContent getBase() { | |
if (base != null && base.eIsProxy()) { | |
InternalEObject oldBase = (InternalEObject)base; | |
base = (R4EContent)eResolveProxy(oldBase); | |
if (base != oldBase) { | |
InternalEObject newBase = (InternalEObject)base; | |
NotificationChain msgs = oldBase.eInverseRemove(this, EOPPOSITE_FEATURE_BASE - RModelPackage.R4E_DELTA__BASE, null, null); | |
if (newBase.eInternalContainer() == null) { | |
msgs = newBase.eInverseAdd(this, EOPPOSITE_FEATURE_BASE - RModelPackage.R4E_DELTA__BASE, null, msgs); | |
} | |
if (msgs != null) msgs.dispatch(); | |
if (eNotificationRequired()) | |
eNotify(new ENotificationImpl(this, Notification.RESOLVE, RModelPackage.R4E_DELTA__BASE, oldBase, base)); | |
} | |
} | |
return base; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public R4EContent basicGetBase() { | |
return base; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public NotificationChain basicSetBase(R4EContent newBase, NotificationChain msgs) { | |
R4EContent oldBase = base; | |
base = newBase; | |
if (eNotificationRequired()) { | |
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, RModelPackage.R4E_DELTA__BASE, oldBase, newBase); | |
if (msgs == null) msgs = notification; else msgs.add(notification); | |
} | |
return msgs; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public void setBase(R4EContent newBase) { | |
if (newBase != base) { | |
NotificationChain msgs = null; | |
if (base != null) | |
msgs = ((InternalEObject)base).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - RModelPackage.R4E_DELTA__BASE, null, msgs); | |
if (newBase != null) | |
msgs = ((InternalEObject)newBase).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - RModelPackage.R4E_DELTA__BASE, null, msgs); | |
msgs = basicSetBase(newBase, msgs); | |
if (msgs != null) msgs.dispatch(); | |
} | |
else if (eNotificationRequired()) | |
eNotify(new ENotificationImpl(this, Notification.SET, RModelPackage.R4E_DELTA__BASE, newBase, newBase)); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public R4EContent getTarget() { | |
if (target != null && target.eIsProxy()) { | |
InternalEObject oldTarget = (InternalEObject)target; | |
target = (R4EContent)eResolveProxy(oldTarget); | |
if (target != oldTarget) { | |
InternalEObject newTarget = (InternalEObject)target; | |
NotificationChain msgs = oldTarget.eInverseRemove(this, EOPPOSITE_FEATURE_BASE - RModelPackage.R4E_DELTA__TARGET, null, null); | |
if (newTarget.eInternalContainer() == null) { | |
msgs = newTarget.eInverseAdd(this, EOPPOSITE_FEATURE_BASE - RModelPackage.R4E_DELTA__TARGET, null, msgs); | |
} | |
if (msgs != null) msgs.dispatch(); | |
if (eNotificationRequired()) | |
eNotify(new ENotificationImpl(this, Notification.RESOLVE, RModelPackage.R4E_DELTA__TARGET, oldTarget, target)); | |
} | |
} | |
return target; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public R4EContent basicGetTarget() { | |
return target; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public NotificationChain basicSetTarget(R4EContent newTarget, NotificationChain msgs) { | |
R4EContent oldTarget = target; | |
target = newTarget; | |
if (eNotificationRequired()) { | |
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, RModelPackage.R4E_DELTA__TARGET, oldTarget, newTarget); | |
if (msgs == null) msgs = notification; else msgs.add(notification); | |
} | |
return msgs; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public void setTarget(R4EContent newTarget) { | |
if (newTarget != target) { | |
NotificationChain msgs = null; | |
if (target != null) | |
msgs = ((InternalEObject)target).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - RModelPackage.R4E_DELTA__TARGET, null, msgs); | |
if (newTarget != null) | |
msgs = ((InternalEObject)newTarget).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - RModelPackage.R4E_DELTA__TARGET, null, msgs); | |
msgs = basicSetTarget(newTarget, msgs); | |
if (msgs != null) msgs.dispatch(); | |
} | |
else if (eNotificationRequired()) | |
eNotify(new ENotificationImpl(this, Notification.SET, RModelPackage.R4E_DELTA__TARGET, newTarget, newTarget)); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { | |
switch (featureID) { | |
case RModelPackage.R4E_DELTA__BASE: | |
return basicSetBase(null, msgs); | |
case RModelPackage.R4E_DELTA__TARGET: | |
return basicSetTarget(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 RModelPackage.R4E_DELTA__BASE: | |
if (resolve) return getBase(); | |
return basicGetBase(); | |
case RModelPackage.R4E_DELTA__TARGET: | |
if (resolve) return getTarget(); | |
return basicGetTarget(); | |
} | |
return super.eGet(featureID, resolve, coreType); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public void eSet(int featureID, Object newValue) { | |
switch (featureID) { | |
case RModelPackage.R4E_DELTA__BASE: | |
setBase((R4EContent)newValue); | |
return; | |
case RModelPackage.R4E_DELTA__TARGET: | |
setTarget((R4EContent)newValue); | |
return; | |
} | |
super.eSet(featureID, newValue); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public void eUnset(int featureID) { | |
switch (featureID) { | |
case RModelPackage.R4E_DELTA__BASE: | |
setBase((R4EContent)null); | |
return; | |
case RModelPackage.R4E_DELTA__TARGET: | |
setTarget((R4EContent)null); | |
return; | |
} | |
super.eUnset(featureID); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public boolean eIsSet(int featureID) { | |
switch (featureID) { | |
case RModelPackage.R4E_DELTA__BASE: | |
return base != null; | |
case RModelPackage.R4E_DELTA__TARGET: | |
return target != null; | |
} | |
return super.eIsSet(featureID); | |
} | |
} //R4EDeltaImpl |