/*******************************************************************************
* Copyright (c) 2008, 2011 Obeo.
* 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:
* Obeo - initial API and implementation
*******************************************************************************/
package org.eclipse.emf.eef.mapping.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.eef.mapping.MappingPackage;
import org.eclipse.emf.eef.mapping.ModelElement;
import org.eclipse.emf.eef.mapping.StandardElementBinding;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Standard Element Binding</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.emf.eef.mapping.impl.StandardElementBindingImpl#getModel <em>Model</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class StandardElementBindingImpl extends AbstractElementBindingImpl
implements StandardElementBinding {
/**
* The cached value of the '{@link #getModel() <em>Model</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getModel()
* @generated
* @ordered
*/
protected ModelElement model;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected StandardElementBindingImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return MappingPackage.Literals.STANDARD_ELEMENT_BINDING;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ModelElement getModel() {
if (model != null && model.eIsProxy()) {
InternalEObject oldModel = (InternalEObject) model;
model = (ModelElement) eResolveProxy(oldModel);
if (model != oldModel) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE,
MappingPackage.STANDARD_ELEMENT_BINDING__MODEL,
oldModel, model));
}
}
return model;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ModelElement basicGetModel() {
return model;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetModel(ModelElement newModel,
NotificationChain msgs) {
ModelElement oldModel = model;
model = newModel;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this,
Notification.SET,
MappingPackage.STANDARD_ELEMENT_BINDING__MODEL, oldModel,
newModel);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setModel(ModelElement newModel) {
if (newModel != model) {
NotificationChain msgs = null;
if (model != null)
msgs = ((InternalEObject) model).eInverseRemove(this,
MappingPackage.MODEL_ELEMENT__BINDING,
ModelElement.class, msgs);
if (newModel != null)
msgs = ((InternalEObject) newModel).eInverseAdd(this,
MappingPackage.MODEL_ELEMENT__BINDING,
ModelElement.class, msgs);
msgs = basicSetModel(newModel, msgs);
if (msgs != null)
msgs.dispatch();
} else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET,
MappingPackage.STANDARD_ELEMENT_BINDING__MODEL, newModel,
newModel));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd,
int featureID, NotificationChain msgs) {
switch (featureID) {
case MappingPackage.STANDARD_ELEMENT_BINDING__MODEL:
if (model != null)
msgs = ((InternalEObject) model).eInverseRemove(this,
MappingPackage.MODEL_ELEMENT__BINDING,
ModelElement.class, msgs);
return basicSetModel((ModelElement) 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 MappingPackage.STANDARD_ELEMENT_BINDING__MODEL:
return basicSetModel(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 MappingPackage.STANDARD_ELEMENT_BINDING__MODEL:
if (resolve)
return getModel();
return basicGetModel();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case MappingPackage.STANDARD_ELEMENT_BINDING__MODEL:
setModel((ModelElement) newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case MappingPackage.STANDARD_ELEMENT_BINDING__MODEL:
setModel((ModelElement) null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case MappingPackage.STANDARD_ELEMENT_BINDING__MODEL:
return model != null;
}
return super.eIsSet(featureID);
}
} //StandardElementBindingImpl