/******************************************************************************* * Copyright (c) 2001, 2009 IBM Corporation and others. * 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: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.wst.dtd.core.internal.emf.impl; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.notify.NotificationChain; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENamedElementImpl; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.wst.dtd.core.internal.emf.DTDContent; import org.eclipse.wst.dtd.core.internal.emf.DTDFile; import org.eclipse.wst.dtd.core.internal.emf.DTDPackage; public class DTDContentImpl extends ENamedElementImpl implements DTDContent, EObject { /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ protected DTDContentImpl() { super(); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ protected EClass eStaticClass() { return DTDPackage.Literals.DTD_CONTENT; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public DTDFile getDTDFile() { if (eContainerFeatureID() != DTDPackage.DTD_CONTENT__DTD_FILE) return null; return (DTDFile)eContainer(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetDTDFile(DTDFile newDTDFile, NotificationChain msgs) { msgs = eBasicSetContainer((InternalEObject)newDTDFile, DTDPackage.DTD_CONTENT__DTD_FILE, msgs); return msgs; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public void setDTDFile(DTDFile newDTDFile) { if (newDTDFile != eInternalContainer() || (eContainerFeatureID() != DTDPackage.DTD_CONTENT__DTD_FILE && newDTDFile != null)) { if (EcoreUtil.isAncestor(this, newDTDFile)) throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); NotificationChain msgs = null; if (eInternalContainer() != null) msgs = eBasicRemoveFromContainer(msgs); if (newDTDFile != null) msgs = ((InternalEObject)newDTDFile).eInverseAdd(this, DTDPackage.DTD_FILE__DTD_CONTENT, DTDFile.class, msgs); msgs = basicSetDTDFile(newDTDFile, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, DTDPackage.DTD_CONTENT__DTD_FILE, newDTDFile, newDTDFile)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case DTDPackage.DTD_CONTENT__DTD_FILE: if (eInternalContainer() != null) msgs = eBasicRemoveFromContainer(msgs); return basicSetDTDFile((DTDFile)otherEnd, msgs); } return super.eInverseAdd(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case DTDPackage.DTD_CONTENT__DTD_FILE: return basicSetDTDFile(null, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { switch (eContainerFeatureID()) { case DTDPackage.DTD_CONTENT__DTD_FILE: return eInternalContainer().eInverseRemove(this, DTDPackage.DTD_FILE__DTD_CONTENT, DTDFile.class, msgs); } return super.eBasicRemoveFromContainerFeature(msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case DTDPackage.DTD_CONTENT__DTD_FILE: return getDTDFile(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void eSet(int featureID, Object newValue) { switch (featureID) { case DTDPackage.DTD_CONTENT__DTD_FILE: setDTDFile((DTDFile)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void eUnset(int featureID) { switch (featureID) { case DTDPackage.DTD_CONTENT__DTD_FILE: setDTDFile((DTDFile)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean eIsSet(int featureID) { switch (featureID) { case DTDPackage.DTD_CONTENT__DTD_FILE: return getDTDFile() != null; } return super.eIsSet(featureID); } } // DTDContentImpl