blob: 42f714d5e7bc4b78a0f6766b2bcbd0e13061e9e0 [file] [log] [blame]
/**
* Copyright (c) 2011-2018 EclipseSource Muenchen GmbH and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* EclipseSource Munich - initial API and implementation
*/
package org.eclipse.emf.ecp.view.keyattribute.test.example.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.ecore.impl.MinimalEObjectImpl;
import org.eclipse.emf.ecp.view.keyattribute.test.example.ExamplePackage;
import org.eclipse.emf.ecp.view.keyattribute.test.example.IntermediateTarget;
import org.eclipse.emf.ecp.view.keyattribute.test.example.Target;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Intermediate Target</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.emf.ecp.view.keyattribute.test.example.impl.IntermediateTargetImpl#getTarget
* <em>Target</em>}</li>
* </ul>
*
* @generated
*/
public class IntermediateTargetImpl extends MinimalEObjectImpl.Container implements IntermediateTarget {
/**
* The cached value of the '{@link #getTarget() <em>Target</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @see #getTarget()
* @generated
* @ordered
*/
protected Target target;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
protected IntermediateTargetImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return ExamplePackage.Literals.INTERMEDIATE_TARGET;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public Target getTarget() {
return target;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
public NotificationChain basicSetTarget(Target newTarget, NotificationChain msgs) {
final Target oldTarget = target;
target = newTarget;
if (eNotificationRequired()) {
final ENotificationImpl notification = new ENotificationImpl(this, Notification.SET,
ExamplePackage.INTERMEDIATE_TARGET__TARGET, oldTarget, newTarget);
if (msgs == null) {
msgs = notification;
} else {
msgs.add(notification);
}
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public void setTarget(Target newTarget) {
if (newTarget != target) {
NotificationChain msgs = null;
if (target != null) {
msgs = ((InternalEObject) target).eInverseRemove(this,
EOPPOSITE_FEATURE_BASE - ExamplePackage.INTERMEDIATE_TARGET__TARGET, null, msgs);
}
if (newTarget != null) {
msgs = ((InternalEObject) newTarget).eInverseAdd(this,
EOPPOSITE_FEATURE_BASE - ExamplePackage.INTERMEDIATE_TARGET__TARGET, null, msgs);
}
msgs = basicSetTarget(newTarget, msgs);
if (msgs != null) {
msgs.dispatch();
}
} else if (eNotificationRequired()) {
eNotify(new ENotificationImpl(this, Notification.SET, ExamplePackage.INTERMEDIATE_TARGET__TARGET, newTarget,
newTarget));
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case ExamplePackage.INTERMEDIATE_TARGET__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 ExamplePackage.INTERMEDIATE_TARGET__TARGET:
return getTarget();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case ExamplePackage.INTERMEDIATE_TARGET__TARGET:
setTarget((Target) newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case ExamplePackage.INTERMEDIATE_TARGET__TARGET:
setTarget((Target) null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case ExamplePackage.INTERMEDIATE_TARGET__TARGET:
return target != null;
}
return super.eIsSet(featureID);
}
} // IntermediateTargetImpl