/** * <copyright> * </copyright> * */ package org.eclipse.etrice.core.room.impl; import org.eclipse.emf.common.notify.Notification; 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.InterfaceItem; import org.eclipse.etrice.core.room.ProtocolClass; import org.eclipse.etrice.core.room.RoomPackage; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Interface Item</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.eclipse.etrice.core.room.impl.InterfaceItemImpl#getName <em>Name</em>}</li> * <li>{@link org.eclipse.etrice.core.room.impl.InterfaceItemImpl#getProtocol <em>Protocol</em>}</li> * </ul> * </p> * * @generated */ public class InterfaceItemImpl extends MinimalEObjectImpl.Container implements InterfaceItem { /** * The default value of the '{@link #getName() <em>Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getName() * @generated * @ordered */ protected static final String NAME_EDEFAULT = null; /** * The cached value of the '{@link #getName() <em>Name</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getName() * @generated * @ordered */ protected String name = NAME_EDEFAULT; /** * The cached value of the '{@link #getProtocol() <em>Protocol</em>}' reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getProtocol() * @generated * @ordered */ protected ProtocolClass protocol; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected InterfaceItemImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return RoomPackage.Literals.INTERFACE_ITEM; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getName() { return name; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setName(String newName) { String oldName = name; name = newName; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, RoomPackage.INTERFACE_ITEM__NAME, oldName, name)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public ProtocolClass getProtocol() { if (protocol != null && protocol.eIsProxy()) { InternalEObject oldProtocol = (InternalEObject)protocol; protocol = (ProtocolClass)eResolveProxy(oldProtocol); if (protocol != oldProtocol) { if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, RoomPackage.INTERFACE_ITEM__PROTOCOL, oldProtocol, protocol)); } } return protocol; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public ProtocolClass basicGetProtocol() { return protocol; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setProtocol(ProtocolClass newProtocol) { ProtocolClass oldProtocol = protocol; protocol = newProtocol; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, RoomPackage.INTERFACE_ITEM__PROTOCOL, oldProtocol, protocol)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case RoomPackage.INTERFACE_ITEM__NAME: return getName(); case RoomPackage.INTERFACE_ITEM__PROTOCOL: if (resolve) return getProtocol(); return basicGetProtocol(); } 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.INTERFACE_ITEM__NAME: setName((String)newValue); return; case RoomPackage.INTERFACE_ITEM__PROTOCOL: setProtocol((ProtocolClass)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case RoomPackage.INTERFACE_ITEM__NAME: setName(NAME_EDEFAULT); return; case RoomPackage.INTERFACE_ITEM__PROTOCOL: setProtocol((ProtocolClass)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case RoomPackage.INTERFACE_ITEM__NAME: return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); case RoomPackage.INTERFACE_ITEM__PROTOCOL: return protocol != 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(" (name: "); result.append(name); result.append(')'); return result.toString(); } } //InterfaceItemImpl