/**
*/
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.ComponentFaultTree;
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.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
/**
*
* An implementation of the model object 'Component Fault Tree'.
*
*
* The following features are implemented:
*
*
* - {@link hu.bme.mit.inf.dslreasoner.faulttree.model.cft.impl.ComponentFaultTreeImpl#getComponents Components}
* - {@link hu.bme.mit.inf.dslreasoner.faulttree.model.cft.impl.ComponentFaultTreeImpl#getTopEvent Top Event}
*
*
* @generated
*/
public class ComponentFaultTreeImpl extends MinimalEObjectImpl.Container implements ComponentFaultTree {
/**
* The cached value of the '{@link #getComponents() Components}' containment reference list.
*
*
* @see #getComponents()
* @generated
* @ordered
*/
protected EList components;
/**
* The cached value of the '{@link #getTopEvent() Top Event}' reference.
*
*
* @see #getTopEvent()
* @generated
* @ordered
*/
protected Output topEvent;
/**
*
*
* @generated
*/
protected ComponentFaultTreeImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return CftPackage.Literals.COMPONENT_FAULT_TREE;
}
/**
*
*
* @generated
*/
@Override
public EList getComponents() {
if (components == null) {
components = new EObjectContainmentEList(Component.class, this, CftPackage.COMPONENT_FAULT_TREE__COMPONENTS);
}
return components;
}
/**
*
*
* @generated
*/
@Override
public Output getTopEvent() {
if (topEvent != null && topEvent.eIsProxy()) {
InternalEObject oldTopEvent = (InternalEObject)topEvent;
topEvent = (Output)eResolveProxy(oldTopEvent);
if (topEvent != oldTopEvent) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, CftPackage.COMPONENT_FAULT_TREE__TOP_EVENT, oldTopEvent, topEvent));
}
}
return topEvent;
}
/**
*
*
* @generated
*/
public Output basicGetTopEvent() {
return topEvent;
}
/**
*
*
* @generated
*/
@Override
public void setTopEvent(Output newTopEvent) {
Output oldTopEvent = topEvent;
topEvent = newTopEvent;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, CftPackage.COMPONENT_FAULT_TREE__TOP_EVENT, oldTopEvent, topEvent));
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case CftPackage.COMPONENT_FAULT_TREE__COMPONENTS:
return ((InternalEList>)getComponents()).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_FAULT_TREE__COMPONENTS:
return getComponents();
case CftPackage.COMPONENT_FAULT_TREE__TOP_EVENT:
if (resolve) return getTopEvent();
return basicGetTopEvent();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case CftPackage.COMPONENT_FAULT_TREE__COMPONENTS:
getComponents().clear();
getComponents().addAll((Collection extends Component>)newValue);
return;
case CftPackage.COMPONENT_FAULT_TREE__TOP_EVENT:
setTopEvent((Output)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case CftPackage.COMPONENT_FAULT_TREE__COMPONENTS:
getComponents().clear();
return;
case CftPackage.COMPONENT_FAULT_TREE__TOP_EVENT:
setTopEvent((Output)null);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case CftPackage.COMPONENT_FAULT_TREE__COMPONENTS:
return components != null && !components.isEmpty();
case CftPackage.COMPONENT_FAULT_TREE__TOP_EVENT:
return topEvent != null;
}
return super.eIsSet(featureID);
}
} //ComponentFaultTreeImpl