/** */ package hu.bme.mit.inf.dslreasoner.faulttree.model.cft.impl; import hu.bme.mit.inf.dslreasoner.faulttree.model.cft.CftPackage; import hu.bme.mit.inf.dslreasoner.faulttree.model.cft.Component; import hu.bme.mit.inf.dslreasoner.faulttree.model.cft.ComponentDefinition; import hu.bme.mit.inf.dslreasoner.faulttree.model.cft.Input; import hu.bme.mit.inf.dslreasoner.faulttree.model.cft.Modality; import hu.bme.mit.inf.dslreasoner.faulttree.model.cft.Output; 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.EObjectContainmentWithInverseEList; import org.eclipse.emf.ecore.util.InternalEList; /** * * An implementation of the model object 'Component'. * *

* The following features are implemented: *

* * * @generated */ public class ComponentImpl extends MinimalEObjectImpl.Container implements Component { /** * The default value of the '{@link #getExists() Exists}' attribute. * * * @see #getExists() * @generated * @ordered */ protected static final Modality EXISTS_EDEFAULT = Modality.MUST; /** * The cached value of the '{@link #getExists() Exists}' attribute. * * * @see #getExists() * @generated * @ordered */ protected Modality exists = EXISTS_EDEFAULT; /** * The cached value of the '{@link #getInputs() Inputs}' containment reference list. * * * @see #getInputs() * @generated * @ordered */ protected EList inputs; /** * The cached value of the '{@link #getOutputs() Outputs}' containment reference list. * * * @see #getOutputs() * @generated * @ordered */ protected EList outputs; /** * The cached value of the '{@link #getComponentDefinition() Component Definition}' reference. * * * @see #getComponentDefinition() * @generated * @ordered */ protected ComponentDefinition componentDefinition; /** * The default value of the '{@link #getName() Name}' attribute. * * * @see #getName() * @generated * @ordered */ protected static final String NAME_EDEFAULT = null; /** * The cached value of the '{@link #getName() Name}' attribute. * * * @see #getName() * @generated * @ordered */ protected String name = NAME_EDEFAULT; /** * The default value of the '{@link #isMultipleAllowed() Multiple Allowed}' attribute. * * * @see #isMultipleAllowed() * @generated * @ordered */ protected static final boolean MULTIPLE_ALLOWED_EDEFAULT = false; /** * The cached value of the '{@link #isMultipleAllowed() Multiple Allowed}' attribute. * * * @see #isMultipleAllowed() * @generated * @ordered */ protected boolean multipleAllowed = MULTIPLE_ALLOWED_EDEFAULT; /** * * * @generated */ protected ComponentImpl() { super(); } /** * * * @generated */ @Override protected EClass eStaticClass() { return CftPackage.Literals.COMPONENT; } /** * * * @generated */ @Override public EList getInputs() { if (inputs == null) { inputs = new EObjectContainmentWithInverseEList(Input.class, this, CftPackage.COMPONENT__INPUTS, CftPackage.INPUT__COMPONENT); } return inputs; } /** * * * @generated */ @Override public EList getOutputs() { if (outputs == null) { outputs = new EObjectContainmentWithInverseEList(Output.class, this, CftPackage.COMPONENT__OUTPUTS, CftPackage.OUTPUT__COMPONENT); } return outputs; } /** * * * @generated */ @Override public ComponentDefinition getComponentDefinition() { if (componentDefinition != null && componentDefinition.eIsProxy()) { InternalEObject oldComponentDefinition = (InternalEObject)componentDefinition; componentDefinition = (ComponentDefinition)eResolveProxy(oldComponentDefinition); if (componentDefinition != oldComponentDefinition) { if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, CftPackage.COMPONENT__COMPONENT_DEFINITION, oldComponentDefinition, componentDefinition)); } } return componentDefinition; } /** * * * @generated */ public ComponentDefinition basicGetComponentDefinition() { return componentDefinition; } /** * * * @generated */ @Override public void setComponentDefinition(ComponentDefinition newComponentDefinition) { ComponentDefinition oldComponentDefinition = componentDefinition; componentDefinition = newComponentDefinition; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, CftPackage.COMPONENT__COMPONENT_DEFINITION, oldComponentDefinition, componentDefinition)); } /** * * * @generated */ @Override public String getName() { return name; } /** * * * @generated */ @Override public void setName(String newName) { String oldName = name; name = newName; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, CftPackage.COMPONENT__NAME, oldName, name)); } /** * * * @generated */ @Override public Modality getExists() { return exists; } /** * * * @generated */ @Override public void setExists(Modality newExists) { Modality oldExists = exists; exists = newExists == null ? EXISTS_EDEFAULT : newExists; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, CftPackage.COMPONENT__EXISTS, oldExists, exists)); } /** * * * @generated */ @Override public boolean isMultipleAllowed() { return multipleAllowed; } /** * * * @generated */ @Override public void setMultipleAllowed(boolean newMultipleAllowed) { boolean oldMultipleAllowed = multipleAllowed; multipleAllowed = newMultipleAllowed; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, CftPackage.COMPONENT__MULTIPLE_ALLOWED, oldMultipleAllowed, multipleAllowed)); } /** * * * @generated */ @SuppressWarnings("unchecked") @Override public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case CftPackage.COMPONENT__INPUTS: return ((InternalEList)(InternalEList)getInputs()).basicAdd(otherEnd, msgs); case CftPackage.COMPONENT__OUTPUTS: return ((InternalEList)(InternalEList)getOutputs()).basicAdd(otherEnd, msgs); } return super.eInverseAdd(otherEnd, featureID, msgs); } /** * * * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case CftPackage.COMPONENT__INPUTS: return ((InternalEList)getInputs()).basicRemove(otherEnd, msgs); case CftPackage.COMPONENT__OUTPUTS: return ((InternalEList)getOutputs()).basicRemove(otherEnd, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * * * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case CftPackage.COMPONENT__EXISTS: return getExists(); case CftPackage.COMPONENT__INPUTS: return getInputs(); case CftPackage.COMPONENT__OUTPUTS: return getOutputs(); case CftPackage.COMPONENT__COMPONENT_DEFINITION: if (resolve) return getComponentDefinition(); return basicGetComponentDefinition(); case CftPackage.COMPONENT__NAME: return getName(); case CftPackage.COMPONENT__MULTIPLE_ALLOWED: return isMultipleAllowed(); } return super.eGet(featureID, resolve, coreType); } /** * * * @generated */ @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case CftPackage.COMPONENT__EXISTS: setExists((Modality)newValue); return; case CftPackage.COMPONENT__INPUTS: getInputs().clear(); getInputs().addAll((Collection)newValue); return; case CftPackage.COMPONENT__OUTPUTS: getOutputs().clear(); getOutputs().addAll((Collection)newValue); return; case CftPackage.COMPONENT__COMPONENT_DEFINITION: setComponentDefinition((ComponentDefinition)newValue); return; case CftPackage.COMPONENT__NAME: setName((String)newValue); return; case CftPackage.COMPONENT__MULTIPLE_ALLOWED: setMultipleAllowed((Boolean)newValue); return; } super.eSet(featureID, newValue); } /** * * * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case CftPackage.COMPONENT__EXISTS: setExists(EXISTS_EDEFAULT); return; case CftPackage.COMPONENT__INPUTS: getInputs().clear(); return; case CftPackage.COMPONENT__OUTPUTS: getOutputs().clear(); return; case CftPackage.COMPONENT__COMPONENT_DEFINITION: setComponentDefinition((ComponentDefinition)null); return; case CftPackage.COMPONENT__NAME: setName(NAME_EDEFAULT); return; case CftPackage.COMPONENT__MULTIPLE_ALLOWED: setMultipleAllowed(MULTIPLE_ALLOWED_EDEFAULT); return; } super.eUnset(featureID); } /** * * * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case CftPackage.COMPONENT__EXISTS: return exists != EXISTS_EDEFAULT; case CftPackage.COMPONENT__INPUTS: return inputs != null && !inputs.isEmpty(); case CftPackage.COMPONENT__OUTPUTS: return outputs != null && !outputs.isEmpty(); case CftPackage.COMPONENT__COMPONENT_DEFINITION: return componentDefinition != null; case CftPackage.COMPONENT__NAME: return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); case CftPackage.COMPONENT__MULTIPLE_ALLOWED: return multipleAllowed != MULTIPLE_ALLOWED_EDEFAULT; } return super.eIsSet(featureID); } /** * * * @generated */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuilder result = new StringBuilder(super.toString()); result.append(" (exists: "); result.append(exists); result.append(", name: "); result.append(name); result.append(", multipleAllowed: "); result.append(multipleAllowed); result.append(')'); return result.toString(); } } //ComponentImpl