/** */ package org.example.entities.entities.impl; import java.util.Collection; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.notify.NotificationChain; import org.eclipse.emf.common.util.EList; 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.ecore.util.EObjectContainmentEList; import org.eclipse.emf.ecore.util.InternalEList; import org.example.entities.entities.Attribute; import org.example.entities.entities.EntitiesPackage; import org.example.entities.entities.Entity; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Entity</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.example.entities.entities.impl.EntityImpl#getName <em>Name</em>}</li> * <li>{@link org.example.entities.entities.impl.EntityImpl#getSuperType <em>Super Type</em>}</li> * <li>{@link org.example.entities.entities.impl.EntityImpl#getAttributes <em>Attributes</em>}</li> * </ul> * </p> * * @generated */ public class EntityImpl extends MinimalEObjectImpl.Container implements Entity { /** * 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 #getSuperType() <em>Super Type</em>}' reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getSuperType() * @generated * @ordered */ protected Entity superType; /** * The cached value of the '{@link #getAttributes() <em>Attributes</em>}' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getAttributes() * @generated * @ordered */ protected EList<Attribute> attributes; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected EntityImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return EntitiesPackage.Literals.ENTITY; } /** * <!-- 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, EntitiesPackage.ENTITY__NAME, oldName, name)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Entity getSuperType() { if (superType != null && superType.eIsProxy()) { InternalEObject oldSuperType = (InternalEObject)superType; superType = (Entity)eResolveProxy(oldSuperType); if (superType != oldSuperType) { if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, EntitiesPackage.ENTITY__SUPER_TYPE, oldSuperType, superType)); } } return superType; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Entity basicGetSuperType() { return superType; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setSuperType(Entity newSuperType) { Entity oldSuperType = superType; superType = newSuperType; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, EntitiesPackage.ENTITY__SUPER_TYPE, oldSuperType, superType)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<Attribute> getAttributes() { if (attributes == null) { attributes = new EObjectContainmentEList<Attribute>(Attribute.class, this, EntitiesPackage.ENTITY__ATTRIBUTES); } return attributes; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case EntitiesPackage.ENTITY__ATTRIBUTES: return ((InternalEList<?>)getAttributes()).basicRemove(otherEnd, 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 EntitiesPackage.ENTITY__NAME: return getName(); case EntitiesPackage.ENTITY__SUPER_TYPE: if (resolve) return getSuperType(); return basicGetSuperType(); case EntitiesPackage.ENTITY__ATTRIBUTES: return getAttributes(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case EntitiesPackage.ENTITY__NAME: setName((String)newValue); return; case EntitiesPackage.ENTITY__SUPER_TYPE: setSuperType((Entity)newValue); return; case EntitiesPackage.ENTITY__ATTRIBUTES: getAttributes().clear(); getAttributes().addAll((Collection<? extends Attribute>)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case EntitiesPackage.ENTITY__NAME: setName(NAME_EDEFAULT); return; case EntitiesPackage.ENTITY__SUPER_TYPE: setSuperType((Entity)null); return; case EntitiesPackage.ENTITY__ATTRIBUTES: getAttributes().clear(); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case EntitiesPackage.ENTITY__NAME: return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); case EntitiesPackage.ENTITY__SUPER_TYPE: return superType != null; case EntitiesPackage.ENTITY__ATTRIBUTES: return attributes != null && !attributes.isEmpty(); } 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(); } } //EntityImpl