/**
*/
package org.jboss.tools.windup.windup.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.jboss.tools.windup.windup.MigrationPath;
import org.jboss.tools.windup.windup.Technology;
import org.jboss.tools.windup.windup.WindupPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Migration Path</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.jboss.tools.windup.windup.impl.MigrationPathImpl#getId <em>Id</em>}</li>
* <li>{@link org.jboss.tools.windup.windup.impl.MigrationPathImpl#getSource <em>Source</em>}</li>
* <li>{@link org.jboss.tools.windup.windup.impl.MigrationPathImpl#getTarget <em>Target</em>}</li>
* </ul>
*
* @generated
*/
public class MigrationPathImpl extends NamedElementImpl implements MigrationPath {
/**
* The default value of the '{@link #getId() <em>Id</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getId()
* @generated
* @ordered
*/
protected static final String ID_EDEFAULT = null;
/**
* The cached value of the '{@link #getId() <em>Id</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getId()
* @generated
* @ordered
*/
protected String id = ID_EDEFAULT;
/**
* The cached value of the '{@link #getSource() <em>Source</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getSource()
* @generated
* @ordered
*/
protected Technology source;
/**
* The cached value of the '{@link #getTarget() <em>Target</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTarget()
* @generated
* @ordered
*/
protected Technology target;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected MigrationPathImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return WindupPackage.eINSTANCE.getMigrationPath();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getId() {
return id;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setId(String newId) {
String oldId = id;
id = newId;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, WindupPackage.MIGRATION_PATH__ID, oldId, id));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Technology getSource() {
if (source != null && source.eIsProxy()) {
InternalEObject oldSource = (InternalEObject)source;
source = (Technology)eResolveProxy(oldSource);
if (source != oldSource) {
InternalEObject newSource = (InternalEObject)source;
NotificationChain msgs = oldSource.eInverseRemove(this, EOPPOSITE_FEATURE_BASE - WindupPackage.MIGRATION_PATH__SOURCE, null, null);
if (newSource.eInternalContainer() == null) {
msgs = newSource.eInverseAdd(this, EOPPOSITE_FEATURE_BASE - WindupPackage.MIGRATION_PATH__SOURCE, null, msgs);
}
if (msgs != null) msgs.dispatch();
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, WindupPackage.MIGRATION_PATH__SOURCE, oldSource, source));
}
}
return source;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Technology basicGetSource() {
return source;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetSource(Technology newSource, NotificationChain msgs) {
Technology oldSource = source;
source = newSource;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, WindupPackage.MIGRATION_PATH__SOURCE, oldSource, newSource);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setSource(Technology newSource) {
if (newSource != source) {
NotificationChain msgs = null;
if (source != null)
msgs = ((InternalEObject)source).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - WindupPackage.MIGRATION_PATH__SOURCE, null, msgs);
if (newSource != null)
msgs = ((InternalEObject)newSource).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - WindupPackage.MIGRATION_PATH__SOURCE, null, msgs);
msgs = basicSetSource(newSource, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, WindupPackage.MIGRATION_PATH__SOURCE, newSource, newSource));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Technology getTarget() {
if (target != null && target.eIsProxy()) {
InternalEObject oldTarget = (InternalEObject)target;
target = (Technology)eResolveProxy(oldTarget);
if (target != oldTarget) {
InternalEObject newTarget = (InternalEObject)target;
NotificationChain msgs = oldTarget.eInverseRemove(this, EOPPOSITE_FEATURE_BASE - WindupPackage.MIGRATION_PATH__TARGET, null, null);
if (newTarget.eInternalContainer() == null) {
msgs = newTarget.eInverseAdd(this, EOPPOSITE_FEATURE_BASE - WindupPackage.MIGRATION_PATH__TARGET, null, msgs);
}
if (msgs != null) msgs.dispatch();
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, WindupPackage.MIGRATION_PATH__TARGET, oldTarget, target));
}
}
return target;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Technology basicGetTarget() {
return target;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetTarget(Technology newTarget, NotificationChain msgs) {
Technology oldTarget = target;
target = newTarget;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, WindupPackage.MIGRATION_PATH__TARGET, oldTarget, newTarget);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setTarget(Technology newTarget) {
if (newTarget != target) {
NotificationChain msgs = null;
if (target != null)
msgs = ((InternalEObject)target).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - WindupPackage.MIGRATION_PATH__TARGET, null, msgs);
if (newTarget != null)
msgs = ((InternalEObject)newTarget).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - WindupPackage.MIGRATION_PATH__TARGET, null, msgs);
msgs = basicSetTarget(newTarget, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, WindupPackage.MIGRATION_PATH__TARGET, newTarget, newTarget));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case WindupPackage.MIGRATION_PATH__SOURCE:
return basicSetSource(null, msgs);
case WindupPackage.MIGRATION_PATH__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 WindupPackage.MIGRATION_PATH__ID:
return getId();
case WindupPackage.MIGRATION_PATH__SOURCE:
if (resolve) return getSource();
return basicGetSource();
case WindupPackage.MIGRATION_PATH__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 WindupPackage.MIGRATION_PATH__ID:
setId((String)newValue);
return;
case WindupPackage.MIGRATION_PATH__SOURCE:
setSource((Technology)newValue);
return;
case WindupPackage.MIGRATION_PATH__TARGET:
setTarget((Technology)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case WindupPackage.MIGRATION_PATH__ID:
setId(ID_EDEFAULT);
return;
case WindupPackage.MIGRATION_PATH__SOURCE:
setSource((Technology)null);
return;
case WindupPackage.MIGRATION_PATH__TARGET:
setTarget((Technology)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case WindupPackage.MIGRATION_PATH__ID:
return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id);
case WindupPackage.MIGRATION_PATH__SOURCE:
return source != null;
case WindupPackage.MIGRATION_PATH__TARGET:
return target != null;
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (id: ");
result.append(id);
result.append(')');
return result.toString();
}
} //MigrationPathImpl