/** */ package org.example.xbase.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.eclipse.xtext.common.types.JvmParameterizedTypeReference; import org.example.xbase.entities.entities.Attribute; import org.example.xbase.entities.entities.EntitiesPackage; import org.example.xbase.entities.entities.Entity; import org.example.xbase.entities.entities.Operation; /** * <!-- 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.xbase.entities.entities.impl.EntityImpl#getName <em>Name</em>}</li> * <li>{@link org.example.xbase.entities.entities.impl.EntityImpl#getSuperType <em>Super Type</em>}</li> * <li>{@link org.example.xbase.entities.entities.impl.EntityImpl#getAttributes <em>Attributes</em>}</li> * <li>{@link org.example.xbase.entities.entities.impl.EntityImpl#getOperations <em>Operations</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>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getSuperType() * @generated * @ordered */ protected JvmParameterizedTypeReference 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; /** * The cached value of the '{@link #getOperations() <em>Operations</em>}' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getOperations() * @generated * @ordered */ protected EList<Operation> operations; /** * <!-- 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 JvmParameterizedTypeReference getSuperType() { return superType; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetSuperType(JvmParameterizedTypeReference newSuperType, NotificationChain msgs) { JvmParameterizedTypeReference oldSuperType = superType; superType = newSuperType; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EntitiesPackage.ENTITY__SUPER_TYPE, oldSuperType, newSuperType); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setSuperType(JvmParameterizedTypeReference newSuperType) { if (newSuperType != superType) { NotificationChain msgs = null; if (superType != null) msgs = ((InternalEObject)superType).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EntitiesPackage.ENTITY__SUPER_TYPE, null, msgs); if (newSuperType != null) msgs = ((InternalEObject)newSuperType).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EntitiesPackage.ENTITY__SUPER_TYPE, null, msgs); msgs = basicSetSuperType(newSuperType, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, EntitiesPackage.ENTITY__SUPER_TYPE, newSuperType, newSuperType)); } /** * <!-- 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 */ public EList<Operation> getOperations() { if (operations == null) { operations = new EObjectContainmentEList<Operation>(Operation.class, this, EntitiesPackage.ENTITY__OPERATIONS); } return operations; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case EntitiesPackage.ENTITY__SUPER_TYPE: return basicSetSuperType(null, msgs); case EntitiesPackage.ENTITY__ATTRIBUTES: return ((InternalEList<?>)getAttributes()).basicRemove(otherEnd, msgs); case EntitiesPackage.ENTITY__OPERATIONS: return ((InternalEList<?>)getOperations()).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: return getSuperType(); case EntitiesPackage.ENTITY__ATTRIBUTES: return getAttributes(); case EntitiesPackage.ENTITY__OPERATIONS: return getOperations(); } 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((JvmParameterizedTypeReference)newValue); return; case EntitiesPackage.ENTITY__ATTRIBUTES: getAttributes().clear(); getAttributes().addAll((Collection<? extends Attribute>)newValue); return; case EntitiesPackage.ENTITY__OPERATIONS: getOperations().clear(); getOperations().addAll((Collection<? extends Operation>)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((JvmParameterizedTypeReference)null); return; case EntitiesPackage.ENTITY__ATTRIBUTES: getAttributes().clear(); return; case EntitiesPackage.ENTITY__OPERATIONS: getOperations().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(); case EntitiesPackage.ENTITY__OPERATIONS: return operations != null && !operations.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