/** * generated by Xtext 2.14.0 */ package com.minres.rdl.rdl.impl; import com.minres.rdl.rdl.ComponentDefinition; import com.minres.rdl.rdl.ComponentInstance; import com.minres.rdl.rdl.EnumInstanceType; import com.minres.rdl.rdl.Instantiation; import com.minres.rdl.rdl.RdlPackage; 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; /** * * An implementation of the model object 'Instantiation'. * *

* The following features are implemented: *

* * * @generated */ public class InstantiationImpl extends MinimalEObjectImpl.Container implements Instantiation { /** * The cached value of the '{@link #getInstanceType() Instance Type}' containment reference. * * * @see #getInstanceType() * @generated * @ordered */ protected EnumInstanceType instanceType; /** * The default value of the '{@link #getAlias() Alias}' attribute. * * * @see #getAlias() * @generated * @ordered */ protected static final String ALIAS_EDEFAULT = null; /** * The cached value of the '{@link #getAlias() Alias}' attribute. * * * @see #getAlias() * @generated * @ordered */ protected String alias = ALIAS_EDEFAULT; /** * The cached value of the '{@link #getComponentRef() Component Ref}' reference. * * * @see #getComponentRef() * @generated * @ordered */ protected ComponentDefinition componentRef; /** * The cached value of the '{@link #getComponent() Component}' containment reference. * * * @see #getComponent() * @generated * @ordered */ protected ComponentDefinition component; /** * The cached value of the '{@link #getComponentInstances() Component Instances}' containment reference list. * * * @see #getComponentInstances() * @generated * @ordered */ protected EList componentInstances; /** * * * @generated */ protected InstantiationImpl() { super(); } /** * * * @generated */ @Override protected EClass eStaticClass() { return RdlPackage.Literals.INSTANTIATION; } /** * * * @generated */ public EnumInstanceType getInstanceType() { return instanceType; } /** * * * @generated */ public NotificationChain basicSetInstanceType(EnumInstanceType newInstanceType, NotificationChain msgs) { EnumInstanceType oldInstanceType = instanceType; instanceType = newInstanceType; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, RdlPackage.INSTANTIATION__INSTANCE_TYPE, oldInstanceType, newInstanceType); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * * * @generated */ public void setInstanceType(EnumInstanceType newInstanceType) { if (newInstanceType != instanceType) { NotificationChain msgs = null; if (instanceType != null) msgs = ((InternalEObject)instanceType).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - RdlPackage.INSTANTIATION__INSTANCE_TYPE, null, msgs); if (newInstanceType != null) msgs = ((InternalEObject)newInstanceType).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - RdlPackage.INSTANTIATION__INSTANCE_TYPE, null, msgs); msgs = basicSetInstanceType(newInstanceType, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, RdlPackage.INSTANTIATION__INSTANCE_TYPE, newInstanceType, newInstanceType)); } /** * * * @generated */ public String getAlias() { return alias; } /** * * * @generated */ public void setAlias(String newAlias) { String oldAlias = alias; alias = newAlias; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, RdlPackage.INSTANTIATION__ALIAS, oldAlias, alias)); } /** * * * @generated */ public ComponentDefinition getComponentRef() { if (componentRef != null && componentRef.eIsProxy()) { InternalEObject oldComponentRef = (InternalEObject)componentRef; componentRef = (ComponentDefinition)eResolveProxy(oldComponentRef); if (componentRef != oldComponentRef) { if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, RdlPackage.INSTANTIATION__COMPONENT_REF, oldComponentRef, componentRef)); } } return componentRef; } /** * * * @generated */ public ComponentDefinition basicGetComponentRef() { return componentRef; } /** * * * @generated */ public void setComponentRef(ComponentDefinition newComponentRef) { ComponentDefinition oldComponentRef = componentRef; componentRef = newComponentRef; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, RdlPackage.INSTANTIATION__COMPONENT_REF, oldComponentRef, componentRef)); } /** * * * @generated */ public ComponentDefinition getComponent() { return component; } /** * * * @generated */ public NotificationChain basicSetComponent(ComponentDefinition newComponent, NotificationChain msgs) { ComponentDefinition oldComponent = component; component = newComponent; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, RdlPackage.INSTANTIATION__COMPONENT, oldComponent, newComponent); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * * * @generated */ public void setComponent(ComponentDefinition newComponent) { if (newComponent != component) { NotificationChain msgs = null; if (component != null) msgs = ((InternalEObject)component).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - RdlPackage.INSTANTIATION__COMPONENT, null, msgs); if (newComponent != null) msgs = ((InternalEObject)newComponent).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - RdlPackage.INSTANTIATION__COMPONENT, null, msgs); msgs = basicSetComponent(newComponent, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, RdlPackage.INSTANTIATION__COMPONENT, newComponent, newComponent)); } /** * * * @generated */ public EList getComponentInstances() { if (componentInstances == null) { componentInstances = new EObjectContainmentEList(ComponentInstance.class, this, RdlPackage.INSTANTIATION__COMPONENT_INSTANCES); } return componentInstances; } /** * * * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case RdlPackage.INSTANTIATION__INSTANCE_TYPE: return basicSetInstanceType(null, msgs); case RdlPackage.INSTANTIATION__COMPONENT: return basicSetComponent(null, msgs); case RdlPackage.INSTANTIATION__COMPONENT_INSTANCES: return ((InternalEList)getComponentInstances()).basicRemove(otherEnd, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * * * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case RdlPackage.INSTANTIATION__INSTANCE_TYPE: return getInstanceType(); case RdlPackage.INSTANTIATION__ALIAS: return getAlias(); case RdlPackage.INSTANTIATION__COMPONENT_REF: if (resolve) return getComponentRef(); return basicGetComponentRef(); case RdlPackage.INSTANTIATION__COMPONENT: return getComponent(); case RdlPackage.INSTANTIATION__COMPONENT_INSTANCES: return getComponentInstances(); } return super.eGet(featureID, resolve, coreType); } /** * * * @generated */ @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case RdlPackage.INSTANTIATION__INSTANCE_TYPE: setInstanceType((EnumInstanceType)newValue); return; case RdlPackage.INSTANTIATION__ALIAS: setAlias((String)newValue); return; case RdlPackage.INSTANTIATION__COMPONENT_REF: setComponentRef((ComponentDefinition)newValue); return; case RdlPackage.INSTANTIATION__COMPONENT: setComponent((ComponentDefinition)newValue); return; case RdlPackage.INSTANTIATION__COMPONENT_INSTANCES: getComponentInstances().clear(); getComponentInstances().addAll((Collection)newValue); return; } super.eSet(featureID, newValue); } /** * * * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case RdlPackage.INSTANTIATION__INSTANCE_TYPE: setInstanceType((EnumInstanceType)null); return; case RdlPackage.INSTANTIATION__ALIAS: setAlias(ALIAS_EDEFAULT); return; case RdlPackage.INSTANTIATION__COMPONENT_REF: setComponentRef((ComponentDefinition)null); return; case RdlPackage.INSTANTIATION__COMPONENT: setComponent((ComponentDefinition)null); return; case RdlPackage.INSTANTIATION__COMPONENT_INSTANCES: getComponentInstances().clear(); return; } super.eUnset(featureID); } /** * * * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case RdlPackage.INSTANTIATION__INSTANCE_TYPE: return instanceType != null; case RdlPackage.INSTANTIATION__ALIAS: return ALIAS_EDEFAULT == null ? alias != null : !ALIAS_EDEFAULT.equals(alias); case RdlPackage.INSTANTIATION__COMPONENT_REF: return componentRef != null; case RdlPackage.INSTANTIATION__COMPONENT: return component != null; case RdlPackage.INSTANTIATION__COMPONENT_INSTANCES: return componentInstances != null && !componentInstances.isEmpty(); } return super.eIsSet(featureID); } /** * * * @generated */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); result.append(" (alias: "); result.append(alias); result.append(')'); return result.toString(); } } //InstantiationImpl