/** * <copyright> * </copyright> * * $Id$ */ package BusinessDomainDsl.impl; import BusinessDomainDsl.AbstractType; import BusinessDomainDsl.BusinessDomainDslPackage; import BusinessDomainDsl.BusinessDomainModel; import BusinessDomainDsl.Property; 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.util.EObjectContainmentWithInverseEList; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.emf.ecore.util.InternalEList; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Abstract Type</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link BusinessDomainDsl.impl.AbstractTypeImpl#getProperties <em>Properties</em>}</li> * <li>{@link BusinessDomainDsl.impl.AbstractTypeImpl#getModel <em>Model</em>}</li> * </ul> * </p> * * @generated */ public abstract class AbstractTypeImpl extends ModelElementImpl implements AbstractType { /** * The cached value of the '{@link #getProperties() <em>Properties</em>}' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getProperties() * @generated * @ordered */ protected EList<Property> properties; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected AbstractTypeImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return BusinessDomainDslPackage.Literals.ABSTRACT_TYPE; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<Property> getProperties() { if (properties == null) { properties = new EObjectContainmentWithInverseEList<Property>(Property.class, this, BusinessDomainDslPackage.ABSTRACT_TYPE__PROPERTIES, BusinessDomainDslPackage.PROPERTY__OWNING_TYPE); } return properties; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public BusinessDomainModel getModel() { if (eContainerFeatureID() != BusinessDomainDslPackage.ABSTRACT_TYPE__MODEL) return null; return (BusinessDomainModel)eContainer(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetModel(BusinessDomainModel newModel, NotificationChain msgs) { msgs = eBasicSetContainer((InternalEObject)newModel, BusinessDomainDslPackage.ABSTRACT_TYPE__MODEL, msgs); return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setModel(BusinessDomainModel newModel) { if (newModel != eInternalContainer() || (eContainerFeatureID() != BusinessDomainDslPackage.ABSTRACT_TYPE__MODEL && newModel != null)) { if (EcoreUtil.isAncestor(this, newModel)) throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); NotificationChain msgs = null; if (eInternalContainer() != null) msgs = eBasicRemoveFromContainer(msgs); if (newModel != null) msgs = ((InternalEObject)newModel).eInverseAdd(this, BusinessDomainDslPackage.BUSINESS_DOMAIN_MODEL__TYPES, BusinessDomainModel.class, msgs); msgs = basicSetModel(newModel, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, BusinessDomainDslPackage.ABSTRACT_TYPE__MODEL, newModel, newModel)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @SuppressWarnings("unchecked") @Override public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case BusinessDomainDslPackage.ABSTRACT_TYPE__PROPERTIES: return ((InternalEList<InternalEObject>)(InternalEList<?>)getProperties()).basicAdd(otherEnd, msgs); case BusinessDomainDslPackage.ABSTRACT_TYPE__MODEL: if (eInternalContainer() != null) msgs = eBasicRemoveFromContainer(msgs); return basicSetModel((BusinessDomainModel)otherEnd, msgs); } return super.eInverseAdd(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case BusinessDomainDslPackage.ABSTRACT_TYPE__PROPERTIES: return ((InternalEList<?>)getProperties()).basicRemove(otherEnd, msgs); case BusinessDomainDslPackage.ABSTRACT_TYPE__MODEL: return basicSetModel(null, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { switch (eContainerFeatureID()) { case BusinessDomainDslPackage.ABSTRACT_TYPE__MODEL: return eInternalContainer().eInverseRemove(this, BusinessDomainDslPackage.BUSINESS_DOMAIN_MODEL__TYPES, BusinessDomainModel.class, msgs); } return super.eBasicRemoveFromContainerFeature(msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case BusinessDomainDslPackage.ABSTRACT_TYPE__PROPERTIES: return getProperties(); case BusinessDomainDslPackage.ABSTRACT_TYPE__MODEL: return getModel(); } 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 BusinessDomainDslPackage.ABSTRACT_TYPE__PROPERTIES: getProperties().clear(); getProperties().addAll((Collection<? extends Property>)newValue); return; case BusinessDomainDslPackage.ABSTRACT_TYPE__MODEL: setModel((BusinessDomainModel)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case BusinessDomainDslPackage.ABSTRACT_TYPE__PROPERTIES: getProperties().clear(); return; case BusinessDomainDslPackage.ABSTRACT_TYPE__MODEL: setModel((BusinessDomainModel)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case BusinessDomainDslPackage.ABSTRACT_TYPE__PROPERTIES: return properties != null && !properties.isEmpty(); case BusinessDomainDslPackage.ABSTRACT_TYPE__MODEL: return getModel() != null; } return super.eIsSet(featureID); } } //AbstractTypeImpl