/**
* <copyright>
* </copyright>
*
*/
package org.eclipse.etrice.core.room.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.etrice.core.room.DetailCode;
import org.eclipse.etrice.core.room.Guard;
import org.eclipse.etrice.core.room.RoomPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Guard</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.etrice.core.room.impl.GuardImpl#getGuard <em>Guard</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class GuardImpl extends MinimalEObjectImpl.Container implements Guard
{
/**
* The cached value of the '{@link #getGuard() <em>Guard</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getGuard()
* @generated
* @ordered
*/
protected DetailCode guard;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected GuardImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return RoomPackage.Literals.GUARD;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DetailCode getGuard()
{
return guard;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetGuard(DetailCode newGuard, NotificationChain msgs)
{
DetailCode oldGuard = guard;
guard = newGuard;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, RoomPackage.GUARD__GUARD, oldGuard, newGuard);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setGuard(DetailCode newGuard)
{
if (newGuard != guard)
{
NotificationChain msgs = null;
if (guard != null)
msgs = ((InternalEObject)guard).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - RoomPackage.GUARD__GUARD, null, msgs);
if (newGuard != null)
msgs = ((InternalEObject)newGuard).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - RoomPackage.GUARD__GUARD, null, msgs);
msgs = basicSetGuard(newGuard, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, RoomPackage.GUARD__GUARD, newGuard, newGuard));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case RoomPackage.GUARD__GUARD:
return basicSetGuard(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 RoomPackage.GUARD__GUARD:
return getGuard();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case RoomPackage.GUARD__GUARD:
setGuard((DetailCode)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case RoomPackage.GUARD__GUARD:
setGuard((DetailCode)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case RoomPackage.GUARD__GUARD:
return guard != null;
}
return super.eIsSet(featureID);
}
} //GuardImpl