/******************************************************************************* | |
* Copyright 2011 Chair for Applied Software Engineering, | |
* Technische Universitaet Muenchen. | |
* All rights reserved. This program and the accompanying materials | |
* are made available under 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.client.test.model.classes.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.client.test.model.classes.ClassesPackage; | |
import org.eclipse.emf.emfstore.client.test.model.classes.Dependency; | |
import org.eclipse.emf.emfstore.client.test.model.classes.PackageElement; | |
import org.eclipse.emf.emfstore.client.test.model.impl.UnicaseModelElementImpl; | |
/** | |
* <!-- begin-user-doc --> An implementation of the model object '<em><b>Dependency</b></em>'. <!-- end-user-doc --> | |
* <p> | |
* The following features are implemented: | |
* <ul> | |
* <li>{@link org.eclipse.emf.emfstore.client.test.model.classes.impl.DependencyImpl#getSource <em>Source</em>}</li> | |
* <li>{@link org.eclipse.emf.emfstore.client.test.model.classes.impl.DependencyImpl#getTarget <em>Target</em>}</li> | |
* </ul> | |
* </p> | |
* | |
* @generated | |
*/ | |
public class DependencyImpl extends UnicaseModelElementImpl implements Dependency { | |
/** | |
* The cached value of the '{@link #getSource() <em>Source</em>}' reference. <!-- begin-user-doc --> <!-- | |
* end-user-doc --> | |
* | |
* @see #getSource() | |
* @generated | |
* @ordered | |
*/ | |
protected PackageElement source; | |
/** | |
* The cached value of the '{@link #getTarget() <em>Target</em>}' reference. <!-- begin-user-doc --> <!-- | |
* end-user-doc --> | |
* | |
* @see #getTarget() | |
* @generated | |
* @ordered | |
*/ | |
protected PackageElement target; | |
/** | |
* <!-- begin-user-doc --> <!-- end-user-doc --> | |
* | |
* @generated | |
*/ | |
protected DependencyImpl() { | |
super(); | |
} | |
/** | |
* <!-- begin-user-doc --> <!-- end-user-doc --> | |
* | |
* @generated | |
*/ | |
@Override | |
protected EClass eStaticClass() { | |
return ClassesPackage.Literals.DEPENDENCY; | |
} | |
/** | |
* <!-- begin-user-doc --> <!-- end-user-doc --> | |
* | |
* @generated | |
*/ | |
public PackageElement getSource() { | |
if (source != null && source.eIsProxy()) { | |
InternalEObject oldSource = (InternalEObject) source; | |
source = (PackageElement) eResolveProxy(oldSource); | |
if (source != oldSource) { | |
if (eNotificationRequired()) | |
eNotify(new ENotificationImpl(this, Notification.RESOLVE, ClassesPackage.DEPENDENCY__SOURCE, | |
oldSource, source)); | |
} | |
} | |
return source; | |
} | |
/** | |
* <!-- begin-user-doc --> <!-- end-user-doc --> | |
* | |
* @generated | |
*/ | |
public PackageElement basicGetSource() { | |
return source; | |
} | |
/** | |
* <!-- begin-user-doc --> <!-- end-user-doc --> | |
* | |
* @generated | |
*/ | |
public NotificationChain basicSetSource(PackageElement newSource, NotificationChain msgs) { | |
PackageElement oldSource = source; | |
source = newSource; | |
if (eNotificationRequired()) { | |
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, | |
ClassesPackage.DEPENDENCY__SOURCE, oldSource, newSource); | |
if (msgs == null) | |
msgs = notification; | |
else | |
msgs.add(notification); | |
} | |
return msgs; | |
} | |
/** | |
* <!-- begin-user-doc --> <!-- end-user-doc --> | |
* | |
* @generated | |
*/ | |
public void setSource(PackageElement newSource) { | |
if (newSource != source) { | |
NotificationChain msgs = null; | |
if (source != null) | |
msgs = ((InternalEObject) source).eInverseRemove(this, | |
ClassesPackage.PACKAGE_ELEMENT__OUTGOING_DEPENDENCIES, PackageElement.class, msgs); | |
if (newSource != null) | |
msgs = ((InternalEObject) newSource).eInverseAdd(this, | |
ClassesPackage.PACKAGE_ELEMENT__OUTGOING_DEPENDENCIES, PackageElement.class, msgs); | |
msgs = basicSetSource(newSource, msgs); | |
if (msgs != null) | |
msgs.dispatch(); | |
} else if (eNotificationRequired()) | |
eNotify(new ENotificationImpl(this, Notification.SET, ClassesPackage.DEPENDENCY__SOURCE, newSource, | |
newSource)); | |
} | |
/** | |
* <!-- begin-user-doc --> <!-- end-user-doc --> | |
* | |
* @generated | |
*/ | |
public PackageElement getTarget() { | |
if (target != null && target.eIsProxy()) { | |
InternalEObject oldTarget = (InternalEObject) target; | |
target = (PackageElement) eResolveProxy(oldTarget); | |
if (target != oldTarget) { | |
if (eNotificationRequired()) | |
eNotify(new ENotificationImpl(this, Notification.RESOLVE, ClassesPackage.DEPENDENCY__TARGET, | |
oldTarget, target)); | |
} | |
} | |
return target; | |
} | |
/** | |
* <!-- begin-user-doc --> <!-- end-user-doc --> | |
* | |
* @generated | |
*/ | |
public PackageElement basicGetTarget() { | |
return target; | |
} | |
/** | |
* <!-- begin-user-doc --> <!-- end-user-doc --> | |
* | |
* @generated | |
*/ | |
public NotificationChain basicSetTarget(PackageElement newTarget, NotificationChain msgs) { | |
PackageElement oldTarget = target; | |
target = newTarget; | |
if (eNotificationRequired()) { | |
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, | |
ClassesPackage.DEPENDENCY__TARGET, oldTarget, newTarget); | |
if (msgs == null) | |
msgs = notification; | |
else | |
msgs.add(notification); | |
} | |
return msgs; | |
} | |
/** | |
* <!-- begin-user-doc --> <!-- end-user-doc --> | |
* | |
* @generated | |
*/ | |
public void setTarget(PackageElement newTarget) { | |
if (newTarget != target) { | |
NotificationChain msgs = null; | |
if (target != null) | |
msgs = ((InternalEObject) target).eInverseRemove(this, | |
ClassesPackage.PACKAGE_ELEMENT__INCOMING_DEPENDENCIES, PackageElement.class, msgs); | |
if (newTarget != null) | |
msgs = ((InternalEObject) newTarget).eInverseAdd(this, | |
ClassesPackage.PACKAGE_ELEMENT__INCOMING_DEPENDENCIES, PackageElement.class, msgs); | |
msgs = basicSetTarget(newTarget, msgs); | |
if (msgs != null) | |
msgs.dispatch(); | |
} else if (eNotificationRequired()) | |
eNotify(new ENotificationImpl(this, Notification.SET, ClassesPackage.DEPENDENCY__TARGET, newTarget, | |
newTarget)); | |
} | |
/** | |
* <!-- begin-user-doc --> <!-- end-user-doc --> | |
* | |
* @generated | |
*/ | |
@Override | |
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { | |
switch (featureID) { | |
case ClassesPackage.DEPENDENCY__SOURCE: | |
if (source != null) | |
msgs = ((InternalEObject) source).eInverseRemove(this, | |
ClassesPackage.PACKAGE_ELEMENT__OUTGOING_DEPENDENCIES, PackageElement.class, msgs); | |
return basicSetSource((PackageElement) otherEnd, msgs); | |
case ClassesPackage.DEPENDENCY__TARGET: | |
if (target != null) | |
msgs = ((InternalEObject) target).eInverseRemove(this, | |
ClassesPackage.PACKAGE_ELEMENT__INCOMING_DEPENDENCIES, PackageElement.class, msgs); | |
return basicSetTarget((PackageElement) otherEnd, msgs); | |
} | |
return super.eInverseAdd(otherEnd, featureID, msgs); | |
} | |
/** | |
* <!-- begin-user-doc --> <!-- end-user-doc --> | |
* | |
* @generated | |
*/ | |
@Override | |
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { | |
switch (featureID) { | |
case ClassesPackage.DEPENDENCY__SOURCE: | |
return basicSetSource(null, msgs); | |
case ClassesPackage.DEPENDENCY__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 ClassesPackage.DEPENDENCY__SOURCE: | |
if (resolve) | |
return getSource(); | |
return basicGetSource(); | |
case ClassesPackage.DEPENDENCY__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 ClassesPackage.DEPENDENCY__SOURCE: | |
setSource((PackageElement) newValue); | |
return; | |
case ClassesPackage.DEPENDENCY__TARGET: | |
setTarget((PackageElement) newValue); | |
return; | |
} | |
super.eSet(featureID, newValue); | |
} | |
/** | |
* <!-- begin-user-doc --> <!-- end-user-doc --> | |
* | |
* @generated | |
*/ | |
@Override | |
public void eUnset(int featureID) { | |
switch (featureID) { | |
case ClassesPackage.DEPENDENCY__SOURCE: | |
setSource((PackageElement) null); | |
return; | |
case ClassesPackage.DEPENDENCY__TARGET: | |
setTarget((PackageElement) null); | |
return; | |
} | |
super.eUnset(featureID); | |
} | |
/** | |
* <!-- begin-user-doc --> <!-- end-user-doc --> | |
* | |
* @generated | |
*/ | |
@Override | |
public boolean eIsSet(int featureID) { | |
switch (featureID) { | |
case ClassesPackage.DEPENDENCY__SOURCE: | |
return source != null; | |
case ClassesPackage.DEPENDENCY__TARGET: | |
return target != null; | |
} | |
return super.eIsSet(featureID); | |
} | |
} // DependencyImpl |