/**
*/
package functionalarchitecture.impl;
import functionalarchitecture.Function;
import functionalarchitecture.FunctionType;
import functionalarchitecture.FunctionalElement;
import functionalarchitecture.FunctionalarchitecturePackage;
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.EObjectContainmentWithInverseEList;
import org.eclipse.emf.ecore.util.InternalEList;
/**
*
* An implementation of the model object 'Function'.
*
*
* The following features are implemented:
*
*
* - {@link functionalarchitecture.impl.FunctionImpl#getSubElements Sub Elements}
* - {@link functionalarchitecture.impl.FunctionImpl#getType Type}
*
*
* @generated
*/
public class FunctionImpl extends FunctionalElementImpl implements Function {
/**
* The cached value of the '{@link #getSubElements() Sub Elements}' containment reference list.
*
*
* @see #getSubElements()
* @generated
* @ordered
*/
protected EList subElements;
/**
* The default value of the '{@link #getType() Type}' attribute.
*
*
* @see #getType()
* @generated
* @ordered
*/
protected static final FunctionType TYPE_EDEFAULT = FunctionType.ROOT;
/**
* The cached value of the '{@link #getType() Type}' attribute.
*
*
* @see #getType()
* @generated
* @ordered
*/
protected FunctionType type = TYPE_EDEFAULT;
/**
*
*
* @generated
*/
protected FunctionImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return FunctionalarchitecturePackage.Literals.FUNCTION;
}
/**
*
*
* @generated
*/
@Override
public EList getSubElements() {
if (subElements == null) {
subElements = new EObjectContainmentWithInverseEList(FunctionalElement.class, this, FunctionalarchitecturePackage.FUNCTION__SUB_ELEMENTS, FunctionalarchitecturePackage.FUNCTIONAL_ELEMENT__PARENT);
}
return subElements;
}
/**
*
*
* @generated
*/
@Override
public FunctionType getType() {
return type;
}
/**
*
*
* @generated
*/
@Override
public void setType(FunctionType newType) {
FunctionType oldType = type;
type = newType == null ? TYPE_EDEFAULT : newType;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FunctionalarchitecturePackage.FUNCTION__TYPE, oldType, type));
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case FunctionalarchitecturePackage.FUNCTION__SUB_ELEMENTS:
return ((InternalEList)(InternalEList>)getSubElements()).basicAdd(otherEnd, msgs);
}
return super.eInverseAdd(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case FunctionalarchitecturePackage.FUNCTION__SUB_ELEMENTS:
return ((InternalEList>)getSubElements()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case FunctionalarchitecturePackage.FUNCTION__SUB_ELEMENTS:
return getSubElements();
case FunctionalarchitecturePackage.FUNCTION__TYPE:
return getType();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case FunctionalarchitecturePackage.FUNCTION__SUB_ELEMENTS:
getSubElements().clear();
getSubElements().addAll((Collection extends FunctionalElement>)newValue);
return;
case FunctionalarchitecturePackage.FUNCTION__TYPE:
setType((FunctionType)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case FunctionalarchitecturePackage.FUNCTION__SUB_ELEMENTS:
getSubElements().clear();
return;
case FunctionalarchitecturePackage.FUNCTION__TYPE:
setType(TYPE_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case FunctionalarchitecturePackage.FUNCTION__SUB_ELEMENTS:
return subElements != null && !subElements.isEmpty();
case FunctionalarchitecturePackage.FUNCTION__TYPE:
return type != TYPE_EDEFAULT;
}
return super.eIsSet(featureID);
}
/**
*
*
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuilder result = new StringBuilder(super.toString());
result.append(" (type: ");
result.append(type);
result.append(')');
return result.toString();
}
} //FunctionImpl