blob: 49df86680180f2096cfd89f14d60100e8c4a83e1 [file] [log] [blame]
/**
* Copyright (c) 2015, 2021 Obeo.
* 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:
* Obeo - initial API and implementation
*
*/
package org.eclipse.acceleo.query.ast.impl;
import java.util.Collection;
import org.eclipse.acceleo.query.ast.AstPackage;
import org.eclipse.acceleo.query.ast.TypeLiteral;
import org.eclipse.acceleo.query.ast.TypeSetLiteral;
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>Type Set Literal</b></em>'. <!--
* end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.acceleo.query.ast.impl.TypeSetLiteralImpl#getTypes <em>Types</em>}</li>
* </ul>
*
* @generated
*/
public class TypeSetLiteralImpl extends ClassTypeLiteralImpl implements TypeSetLiteral {
/**
* The cached value of the '{@link #getTypes() <em>Types</em>}' containment reference list. <!--
* begin-user-doc --> <!-- end-user-doc -->
*
* @see #getTypes()
* @generated
* @ordered
*/
protected EList<TypeLiteral> types;
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
protected TypeSetLiteralImpl() {
super();
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return AstPackage.Literals.TYPE_SET_LITERAL;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public EList<TypeLiteral> getTypes() {
if (types == null) {
types = new EObjectContainmentEList<TypeLiteral>(TypeLiteral.class, this,
AstPackage.TYPE_SET_LITERAL__TYPES);
}
return types;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case AstPackage.TYPE_SET_LITERAL__TYPES:
return ((InternalEList<?>)getTypes()).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 AstPackage.TYPE_SET_LITERAL__TYPES:
return getTypes();
}
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 AstPackage.TYPE_SET_LITERAL__TYPES:
getTypes().clear();
getTypes().addAll((Collection<? extends TypeLiteral>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case AstPackage.TYPE_SET_LITERAL__TYPES:
getTypes().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case AstPackage.TYPE_SET_LITERAL__TYPES:
return types != null && !types.isEmpty();
}
return super.eIsSet(featureID);
}
} // TypeSetLiteralImpl