/**
*/
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.Connection;
import hu.bme.mit.inf.dslreasoner.faulttree.model.cft.Input;
import hu.bme.mit.inf.dslreasoner.faulttree.model.cft.InputEvent;
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.EcoreUtil;
import org.eclipse.emf.ecore.util.InternalEList;
/**
*
* An implementation of the model object 'Input'.
*
*
* The following features are implemented:
*
*
* - {@link hu.bme.mit.inf.dslreasoner.faulttree.model.cft.impl.InputImpl#getInputEvent Input Event}
* - {@link hu.bme.mit.inf.dslreasoner.faulttree.model.cft.impl.InputImpl#getComponent Component}
* - {@link hu.bme.mit.inf.dslreasoner.faulttree.model.cft.impl.InputImpl#getIncomingConnections Incoming Connections}
*
*
* @generated
*/
public class InputImpl extends MinimalEObjectImpl.Container implements Input {
/**
* The cached value of the '{@link #getInputEvent() Input Event}' reference.
*
*
* @see #getInputEvent()
* @generated
* @ordered
*/
protected InputEvent inputEvent;
/**
* The cached value of the '{@link #getIncomingConnections() Incoming Connections}' containment reference list.
*
*
* @see #getIncomingConnections()
* @generated
* @ordered
*/
protected EList incomingConnections;
/**
*
*
* @generated
*/
protected InputImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return CftPackage.Literals.INPUT;
}
/**
*
*
* @generated
*/
@Override
public InputEvent getInputEvent() {
if (inputEvent != null && inputEvent.eIsProxy()) {
InternalEObject oldInputEvent = (InternalEObject)inputEvent;
inputEvent = (InputEvent)eResolveProxy(oldInputEvent);
if (inputEvent != oldInputEvent) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, CftPackage.INPUT__INPUT_EVENT, oldInputEvent, inputEvent));
}
}
return inputEvent;
}
/**
*
*
* @generated
*/
public InputEvent basicGetInputEvent() {
return inputEvent;
}
/**
*
*
* @generated
*/
@Override
public void setInputEvent(InputEvent newInputEvent) {
InputEvent oldInputEvent = inputEvent;
inputEvent = newInputEvent;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, CftPackage.INPUT__INPUT_EVENT, oldInputEvent, inputEvent));
}
/**
*
*
* @generated
*/
@Override
public Component getComponent() {
if (eContainerFeatureID() != CftPackage.INPUT__COMPONENT) return null;
return (Component)eInternalContainer();
}
/**
*
*
* @generated
*/
public NotificationChain basicSetComponent(Component newComponent, NotificationChain msgs) {
msgs = eBasicSetContainer((InternalEObject)newComponent, CftPackage.INPUT__COMPONENT, msgs);
return msgs;
}
/**
*
*
* @generated
*/
@Override
public void setComponent(Component newComponent) {
if (newComponent != eInternalContainer() || (eContainerFeatureID() != CftPackage.INPUT__COMPONENT && newComponent != null)) {
if (EcoreUtil.isAncestor(this, newComponent))
throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
NotificationChain msgs = null;
if (eInternalContainer() != null)
msgs = eBasicRemoveFromContainer(msgs);
if (newComponent != null)
msgs = ((InternalEObject)newComponent).eInverseAdd(this, CftPackage.COMPONENT__INPUTS, Component.class, msgs);
msgs = basicSetComponent(newComponent, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, CftPackage.INPUT__COMPONENT, newComponent, newComponent));
}
/**
*
*
* @generated
*/
@Override
public EList getIncomingConnections() {
if (incomingConnections == null) {
incomingConnections = new EObjectContainmentWithInverseEList(Connection.class, this, CftPackage.INPUT__INCOMING_CONNECTIONS, CftPackage.CONNECTION__INPUT);
}
return incomingConnections;
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case CftPackage.INPUT__COMPONENT:
if (eInternalContainer() != null)
msgs = eBasicRemoveFromContainer(msgs);
return basicSetComponent((Component)otherEnd, msgs);
case CftPackage.INPUT__INCOMING_CONNECTIONS:
return ((InternalEList)(InternalEList>)getIncomingConnections()).basicAdd(otherEnd, msgs);
}
return super.eInverseAdd(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case CftPackage.INPUT__COMPONENT:
return basicSetComponent(null, msgs);
case CftPackage.INPUT__INCOMING_CONNECTIONS:
return ((InternalEList>)getIncomingConnections()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) {
switch (eContainerFeatureID()) {
case CftPackage.INPUT__COMPONENT:
return eInternalContainer().eInverseRemove(this, CftPackage.COMPONENT__INPUTS, Component.class, msgs);
}
return super.eBasicRemoveFromContainerFeature(msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case CftPackage.INPUT__INPUT_EVENT:
if (resolve) return getInputEvent();
return basicGetInputEvent();
case CftPackage.INPUT__COMPONENT:
return getComponent();
case CftPackage.INPUT__INCOMING_CONNECTIONS:
return getIncomingConnections();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case CftPackage.INPUT__INPUT_EVENT:
setInputEvent((InputEvent)newValue);
return;
case CftPackage.INPUT__COMPONENT:
setComponent((Component)newValue);
return;
case CftPackage.INPUT__INCOMING_CONNECTIONS:
getIncomingConnections().clear();
getIncomingConnections().addAll((Collection extends Connection>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case CftPackage.INPUT__INPUT_EVENT:
setInputEvent((InputEvent)null);
return;
case CftPackage.INPUT__COMPONENT:
setComponent((Component)null);
return;
case CftPackage.INPUT__INCOMING_CONNECTIONS:
getIncomingConnections().clear();
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case CftPackage.INPUT__INPUT_EVENT:
return inputEvent != null;
case CftPackage.INPUT__COMPONENT:
return getComponent() != null;
case CftPackage.INPUT__INCOMING_CONNECTIONS:
return incomingConnections != null && !incomingConnections.isEmpty();
}
return super.eIsSet(featureID);
}
} //InputImpl