/*******************************************************************************
* Copyright (c) 2006-2012
* Software Technology Group, Dresden University of Technology
* DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
*
* 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:
* Software Technology Group - TU Dresden, Germany;
* DevBoost GmbH - Berlin, Germany
* - initial API and implementation
******************************************************************************/
/**
* <copyright>
* </copyright>
*
* $Id$
*/
package org.reuseware.sokan.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.EObjectImpl;
import org.reuseware.sokan.ID;
import org.reuseware.sokan.IdentifiableElement;
import org.reuseware.sokan.SokanPackage;
/**
* <!-- begin-user-doc --> An implementation of the model object '
* <em><b>Identifiable Element</b></em>'. <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.reuseware.sokan.impl.IdentifiableElementImpl#getId <em>Id</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public abstract class IdentifiableElementImpl extends EObjectImpl implements
IdentifiableElement {
/**
* The cached value of the '{@link #getId() <em>Id</em>}' containment reference.
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @see #getId()
* @generated
* @ordered
*/
protected ID id;
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
protected IdentifiableElementImpl() {
super();
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return SokanPackage.Literals.IDENTIFIABLE_ELEMENT;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public ID getId() {
return id;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetId(ID newId, NotificationChain msgs) {
ID oldId = id;
id = newId;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SokanPackage.IDENTIFIABLE_ELEMENT__ID, oldId, newId);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
public void setId(ID newId) {
if (newId != id) {
NotificationChain msgs = null;
if (id != null)
msgs = ((InternalEObject)id).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SokanPackage.IDENTIFIABLE_ELEMENT__ID, null, msgs);
if (newId != null)
msgs = ((InternalEObject)newId).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SokanPackage.IDENTIFIABLE_ELEMENT__ID, null, msgs);
msgs = basicSetId(newId, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SokanPackage.IDENTIFIABLE_ELEMENT__ID, newId, newId));
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd,
int featureID, NotificationChain msgs) {
switch (featureID) {
case SokanPackage.IDENTIFIABLE_ELEMENT__ID:
return basicSetId(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 SokanPackage.IDENTIFIABLE_ELEMENT__ID:
return getId();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case SokanPackage.IDENTIFIABLE_ELEMENT__ID:
setId((ID)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case SokanPackage.IDENTIFIABLE_ELEMENT__ID:
setId((ID)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case SokanPackage.IDENTIFIABLE_ELEMENT__ID:
return id != null;
}
return super.eIsSet(featureID);
}
} // IdentifiableElementImpl