/**
*/
package org.yakindu.base.types.impl;
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.EObjectImpl;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.yakindu.base.types.Type;
import org.yakindu.base.types.TypeSpecifier;
import org.yakindu.base.types.TypesPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Type Specifier</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.yakindu.base.types.impl.TypeSpecifierImpl#getType <em>Type</em>}</li>
* <li>{@link org.yakindu.base.types.impl.TypeSpecifierImpl#getTypeArguments <em>Type Arguments</em>}</li>
* </ul>
*
* @generated
*/
public class TypeSpecifierImpl extends EObjectImpl implements TypeSpecifier {
/**
* The cached value of the '{@link #getType() <em>Type</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getType()
* @generated
* @ordered
*/
protected Type type;
/**
* The cached value of the '{@link #getTypeArguments() <em>Type Arguments</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTypeArguments()
* @generated
* @ordered
*/
protected EList<TypeSpecifier> typeArguments;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected TypeSpecifierImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return TypesPackage.Literals.TYPE_SPECIFIER;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Type getType() {
if (type != null && type.eIsProxy()) {
InternalEObject oldType = (InternalEObject)type;
type = (Type)eResolveProxy(oldType);
if (type != oldType) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, TypesPackage.TYPE_SPECIFIER__TYPE, oldType, type));
}
}
return type;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Type basicGetType() {
return type;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setType(Type newType) {
Type oldType = type;
type = newType;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TypesPackage.TYPE_SPECIFIER__TYPE, oldType, type));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<TypeSpecifier> getTypeArguments() {
if (typeArguments == null) {
typeArguments = new EObjectContainmentEList<TypeSpecifier>(TypeSpecifier.class, this, TypesPackage.TYPE_SPECIFIER__TYPE_ARGUMENTS);
}
return typeArguments;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case TypesPackage.TYPE_SPECIFIER__TYPE_ARGUMENTS:
return ((InternalEList<?>)getTypeArguments()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case TypesPackage.TYPE_SPECIFIER__TYPE:
if (resolve) return getType();
return basicGetType();
case TypesPackage.TYPE_SPECIFIER__TYPE_ARGUMENTS:
return getTypeArguments();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case TypesPackage.TYPE_SPECIFIER__TYPE:
setType((Type)newValue);
return;
case TypesPackage.TYPE_SPECIFIER__TYPE_ARGUMENTS:
getTypeArguments().clear();
getTypeArguments().addAll((Collection<? extends TypeSpecifier>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case TypesPackage.TYPE_SPECIFIER__TYPE:
setType((Type)null);
return;
case TypesPackage.TYPE_SPECIFIER__TYPE_ARGUMENTS:
getTypeArguments().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case TypesPackage.TYPE_SPECIFIER__TYPE:
return type != null;
case TypesPackage.TYPE_SPECIFIER__TYPE_ARGUMENTS:
return typeArguments != null && !typeArguments.isEmpty();
}
return super.eIsSet(featureID);
}
} //TypeSpecifierImpl