/** */ package edu.ksu.cis.projects.mdcf.devicemodel.deviceModelingLanguage.impl; import edu.ksu.cis.projects.mdcf.devicemodel.deviceModelingLanguage.ConstraintExp; import edu.ksu.cis.projects.mdcf.devicemodel.deviceModelingLanguage.Device; import edu.ksu.cis.projects.mdcf.devicemodel.deviceModelingLanguage.DeviceModelingLanguagePackage; import edu.ksu.cis.projects.mdcf.devicemodel.deviceModelingLanguage.FeatureDecl; 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.EObjectResolvingEList; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Device</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link edu.ksu.cis.projects.mdcf.devicemodel.deviceModelingLanguage.impl.DeviceImpl#getComponents <em>Components</em>}</li> * <li>{@link edu.ksu.cis.projects.mdcf.devicemodel.deviceModelingLanguage.impl.DeviceImpl#getConstraint <em>Constraint</em>}</li> * </ul> * </p> * * @generated */ public class DeviceImpl extends FeatureDeclImpl implements Device { /** * The cached value of the '{@link #getComponents() <em>Components</em>}' reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getComponents() * @generated * @ordered */ protected EList<FeatureDecl> components; /** * The cached value of the '{@link #getConstraint() <em>Constraint</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getConstraint() * @generated * @ordered */ protected ConstraintExp constraint; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected DeviceImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return DeviceModelingLanguagePackage.Literals.DEVICE; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<FeatureDecl> getComponents() { if (components == null) { components = new EObjectResolvingEList<FeatureDecl>(FeatureDecl.class, this, DeviceModelingLanguagePackage.DEVICE__COMPONENTS); } return components; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public ConstraintExp getConstraint() { return constraint; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetConstraint(ConstraintExp newConstraint, NotificationChain msgs) { ConstraintExp oldConstraint = constraint; constraint = newConstraint; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DeviceModelingLanguagePackage.DEVICE__CONSTRAINT, oldConstraint, newConstraint); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setConstraint(ConstraintExp newConstraint) { if (newConstraint != constraint) { NotificationChain msgs = null; if (constraint != null) msgs = ((InternalEObject)constraint).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DeviceModelingLanguagePackage.DEVICE__CONSTRAINT, null, msgs); if (newConstraint != null) msgs = ((InternalEObject)newConstraint).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DeviceModelingLanguagePackage.DEVICE__CONSTRAINT, null, msgs); msgs = basicSetConstraint(newConstraint, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, DeviceModelingLanguagePackage.DEVICE__CONSTRAINT, newConstraint, newConstraint)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case DeviceModelingLanguagePackage.DEVICE__CONSTRAINT: return basicSetConstraint(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 DeviceModelingLanguagePackage.DEVICE__COMPONENTS: return getComponents(); case DeviceModelingLanguagePackage.DEVICE__CONSTRAINT: return getConstraint(); } 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 DeviceModelingLanguagePackage.DEVICE__COMPONENTS: getComponents().clear(); getComponents().addAll((Collection<? extends FeatureDecl>)newValue); return; case DeviceModelingLanguagePackage.DEVICE__CONSTRAINT: setConstraint((ConstraintExp)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case DeviceModelingLanguagePackage.DEVICE__COMPONENTS: getComponents().clear(); return; case DeviceModelingLanguagePackage.DEVICE__CONSTRAINT: setConstraint((ConstraintExp)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case DeviceModelingLanguagePackage.DEVICE__COMPONENTS: return components != null && !components.isEmpty(); case DeviceModelingLanguagePackage.DEVICE__CONSTRAINT: return constraint != null; } return super.eIsSet(featureID); } } //DeviceImpl