/** * <copyright> * </copyright> * * $Id$ */ package org.csu.idl.idlmm.impl; import java.util.Collection; import org.csu.idl.idlmm.Contained; import org.csu.idl.idlmm.IdlmmPackage; import org.csu.idl.idlmm.Include; import org.csu.idl.idlmm.TranslationUnit; 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; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Translation Unit</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.csu.idl.idlmm.impl.TranslationUnitImpl#getContains <em>Contains</em>}</li> * <li>{@link org.csu.idl.idlmm.impl.TranslationUnitImpl#getIdentifier <em>Identifier</em>}</li> * <li>{@link org.csu.idl.idlmm.impl.TranslationUnitImpl#getIncludes <em>Includes</em>}</li> * </ul> * </p> * * @generated */ public class TranslationUnitImpl extends EObjectImpl implements TranslationUnit { /** * The cached value of the '{@link #getContains() <em>Contains</em>}' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getContains() * @generated * @ordered */ protected EList<Contained> contains; /** * The default value of the '{@link #getIdentifier() <em>Identifier</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getIdentifier() * @generated * @ordered */ protected static final String IDENTIFIER_EDEFAULT = null; /** * The cached value of the '{@link #getIdentifier() <em>Identifier</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getIdentifier() * @generated * @ordered */ protected String identifier = IDENTIFIER_EDEFAULT; /** * The cached value of the '{@link #getIncludes() <em>Includes</em>}' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getIncludes() * @generated * @ordered */ protected EList<Include> includes; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected TranslationUnitImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return IdlmmPackage.Literals.TRANSLATION_UNIT; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<Contained> getContains() { if (contains == null) { contains = new EObjectContainmentEList<Contained>(Contained.class, this, IdlmmPackage.TRANSLATION_UNIT__CONTAINS); } return contains; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public String getIdentifier() { return identifier; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setIdentifier(String newIdentifier) { String oldIdentifier = identifier; identifier = newIdentifier; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, IdlmmPackage.TRANSLATION_UNIT__IDENTIFIER, oldIdentifier, identifier)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<Include> getIncludes() { if (includes == null) { includes = new EObjectContainmentEList<Include>(Include.class, this, IdlmmPackage.TRANSLATION_UNIT__INCLUDES); } return includes; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case IdlmmPackage.TRANSLATION_UNIT__CONTAINS: return ((InternalEList<?>)getContains()).basicRemove(otherEnd, msgs); case IdlmmPackage.TRANSLATION_UNIT__INCLUDES: return ((InternalEList<?>)getIncludes()).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 IdlmmPackage.TRANSLATION_UNIT__CONTAINS: return getContains(); case IdlmmPackage.TRANSLATION_UNIT__IDENTIFIER: return getIdentifier(); case IdlmmPackage.TRANSLATION_UNIT__INCLUDES: return getIncludes(); } 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 IdlmmPackage.TRANSLATION_UNIT__CONTAINS: getContains().clear(); getContains().addAll((Collection<? extends Contained>)newValue); return; case IdlmmPackage.TRANSLATION_UNIT__IDENTIFIER: setIdentifier((String)newValue); return; case IdlmmPackage.TRANSLATION_UNIT__INCLUDES: getIncludes().clear(); getIncludes().addAll((Collection<? extends Include>)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case IdlmmPackage.TRANSLATION_UNIT__CONTAINS: getContains().clear(); return; case IdlmmPackage.TRANSLATION_UNIT__IDENTIFIER: setIdentifier(IDENTIFIER_EDEFAULT); return; case IdlmmPackage.TRANSLATION_UNIT__INCLUDES: getIncludes().clear(); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case IdlmmPackage.TRANSLATION_UNIT__CONTAINS: return contains != null && !contains.isEmpty(); case IdlmmPackage.TRANSLATION_UNIT__IDENTIFIER: return IDENTIFIER_EDEFAULT == null ? identifier != null : !IDENTIFIER_EDEFAULT.equals(identifier); case IdlmmPackage.TRANSLATION_UNIT__INCLUDES: return includes != null && !includes.isEmpty(); } return super.eIsSet(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); result.append(" (identifier: "); result.append(identifier); result.append(')'); return result.toString(); } } //TranslationUnitImpl