blob: d995821131b365af3190f48dd3e5089ea2ea0317 [file] [log] [blame]
/**
* Copyright (c) 2011 NumberFour AG
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* NumberFour AG - initial API and Implementation (Alex Panchenko)
*/
package org.eclipse.dltk.javascript.typeinfo.model.impl;
import java.util.Collection;
import org.eclipse.dltk.javascript.typeinfo.model.GenericType;
import org.eclipse.dltk.javascript.typeinfo.model.TypeInfoModelPackage;
import org.eclipse.dltk.javascript.typeinfo.model.TypeVariable;
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.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Generic Type</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.dltk.javascript.typeinfo.model.impl.GenericTypeImpl#getTypeParameters <em>Type Parameters</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class GenericTypeImpl extends TypeImpl implements GenericType {
/**
* The cached value of the '{@link #getTypeParameters() <em>Type Parameters</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTypeParameters()
* @generated
* @ordered
*/
protected EList<TypeVariable> typeParameters;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected GenericTypeImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return TypeInfoModelPackage.Literals.GENERIC_TYPE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<TypeVariable> getTypeParameters() {
if (typeParameters == null) {
typeParameters = new EObjectContainmentEList<TypeVariable>(TypeVariable.class, this, TypeInfoModelPackage.GENERIC_TYPE__TYPE_PARAMETERS);
}
return typeParameters;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case TypeInfoModelPackage.GENERIC_TYPE__TYPE_PARAMETERS:
return ((InternalEList<?>)getTypeParameters()).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 TypeInfoModelPackage.GENERIC_TYPE__TYPE_PARAMETERS:
return getTypeParameters();
}
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 TypeInfoModelPackage.GENERIC_TYPE__TYPE_PARAMETERS:
getTypeParameters().clear();
getTypeParameters().addAll((Collection<? extends TypeVariable>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case TypeInfoModelPackage.GENERIC_TYPE__TYPE_PARAMETERS:
getTypeParameters().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case TypeInfoModelPackage.GENERIC_TYPE__TYPE_PARAMETERS:
return typeParameters != null && !typeParameters.isEmpty();
}
return super.eIsSet(featureID);
}
} //GenericTypeImpl