/** * <copyright> * </copyright> * * $Id$ */ package org.eclipse.buckminster.cspecxml.impl; import org.eclipse.buckminster.cspecxml.ICSpecExtension; import org.eclipse.buckminster.cspecxml.ICSpecXMLPackage; import org.eclipse.buckminster.cspecxml.IComponentSpec; import org.eclipse.buckminster.cspecxml.IDocumentRoot; import org.eclipse.emf.common.notify.NotificationChain; import org.eclipse.emf.common.util.EMap; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.ecore.EcorePackage; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.EObjectImpl; import org.eclipse.emf.ecore.impl.EStringToStringMapEntryImpl; import org.eclipse.emf.ecore.util.BasicFeatureMap; import org.eclipse.emf.ecore.util.EcoreEMap; import org.eclipse.emf.ecore.util.FeatureMap; import org.eclipse.emf.ecore.util.InternalEList; /** * <!-- begin-user-doc --> An implementation of the model object ' * <em><b>Document Root</b></em>'. <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.eclipse.buckminster.cspecxml.impl.DocumentRootImpl#getMixed * <em>Mixed</em>}</li> * <li> * {@link org.eclipse.buckminster.cspecxml.impl.DocumentRootImpl#getXMLNSPrefixMap * <em>XMLNS Prefix Map</em>}</li> * <li> * {@link org.eclipse.buckminster.cspecxml.impl.DocumentRootImpl#getXSISchemaLocation * <em>XSI Schema Location</em>}</li> * <li>{@link org.eclipse.buckminster.cspecxml.impl.DocumentRootImpl#getCspec * <em>Cspec</em>}</li> * <li> * {@link org.eclipse.buckminster.cspecxml.impl.DocumentRootImpl#getCspecExtension * <em>Cspec Extension</em>}</li> * </ul> * </p> * * @generated */ public class DocumentRootImpl extends EObjectImpl implements IDocumentRoot { /** * The cached value of the '{@link #getMixed() <em>Mixed</em>}' attribute * list. <!-- begin-user-doc --> <!-- end-user-doc --> * * @see #getMixed() * @generated * @ordered */ protected FeatureMap mixed; /** * The cached value of the '{@link #getXMLNSPrefixMap() * <em>XMLNS Prefix Map</em>}' map. <!-- begin-user-doc --> <!-- * end-user-doc --> * * @see #getXMLNSPrefixMap() * @generated * @ordered */ protected EMap<String, String> xMLNSPrefixMap; /** * The cached value of the '{@link #getXSISchemaLocation() * <em>XSI Schema Location</em>}' map. <!-- begin-user-doc --> <!-- * end-user-doc --> * * @see #getXSISchemaLocation() * @generated * @ordered */ protected EMap<String, String> xSISchemaLocation; /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ protected DocumentRootImpl() { super(); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ public NotificationChain basicSetCspec(IComponentSpec newCspec, NotificationChain msgs) { return ((FeatureMap.Internal) getMixed()).basicAdd(ICSpecXMLPackage.Literals.DOCUMENT_ROOT__CSPEC, newCspec, msgs); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ public NotificationChain basicSetCspecExtension(ICSpecExtension newCspecExtension, NotificationChain msgs) { return ((FeatureMap.Internal) getMixed()).basicAdd(ICSpecXMLPackage.Literals.DOCUMENT_ROOT__CSPEC_EXTENSION, newCspecExtension, msgs); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case ICSpecXMLPackage.DOCUMENT_ROOT__MIXED: if (coreType) return getMixed(); return ((FeatureMap.Internal) getMixed()).getWrapper(); case ICSpecXMLPackage.DOCUMENT_ROOT__XMLNS_PREFIX_MAP: if (coreType) return getXMLNSPrefixMap(); else return getXMLNSPrefixMap().map(); case ICSpecXMLPackage.DOCUMENT_ROOT__XSI_SCHEMA_LOCATION: if (coreType) return getXSISchemaLocation(); else return getXSISchemaLocation().map(); case ICSpecXMLPackage.DOCUMENT_ROOT__CSPEC: return getCspec(); case ICSpecXMLPackage.DOCUMENT_ROOT__CSPEC_EXTENSION: return getCspecExtension(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case ICSpecXMLPackage.DOCUMENT_ROOT__MIXED: return ((InternalEList<?>) getMixed()).basicRemove(otherEnd, msgs); case ICSpecXMLPackage.DOCUMENT_ROOT__XMLNS_PREFIX_MAP: return ((InternalEList<?>) getXMLNSPrefixMap()).basicRemove(otherEnd, msgs); case ICSpecXMLPackage.DOCUMENT_ROOT__XSI_SCHEMA_LOCATION: return ((InternalEList<?>) getXSISchemaLocation()).basicRemove(otherEnd, msgs); case ICSpecXMLPackage.DOCUMENT_ROOT__CSPEC: return basicSetCspec(null, msgs); case ICSpecXMLPackage.DOCUMENT_ROOT__CSPEC_EXTENSION: return basicSetCspecExtension(null, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case ICSpecXMLPackage.DOCUMENT_ROOT__MIXED: return mixed != null && !mixed.isEmpty(); case ICSpecXMLPackage.DOCUMENT_ROOT__XMLNS_PREFIX_MAP: return xMLNSPrefixMap != null && !xMLNSPrefixMap.isEmpty(); case ICSpecXMLPackage.DOCUMENT_ROOT__XSI_SCHEMA_LOCATION: return xSISchemaLocation != null && !xSISchemaLocation.isEmpty(); case ICSpecXMLPackage.DOCUMENT_ROOT__CSPEC: return getCspec() != null; case ICSpecXMLPackage.DOCUMENT_ROOT__CSPEC_EXTENSION: return getCspecExtension() != null; } return super.eIsSet(featureID); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case ICSpecXMLPackage.DOCUMENT_ROOT__MIXED: ((FeatureMap.Internal) getMixed()).set(newValue); return; case ICSpecXMLPackage.DOCUMENT_ROOT__XMLNS_PREFIX_MAP: ((EStructuralFeature.Setting) getXMLNSPrefixMap()).set(newValue); return; case ICSpecXMLPackage.DOCUMENT_ROOT__XSI_SCHEMA_LOCATION: ((EStructuralFeature.Setting) getXSISchemaLocation()).set(newValue); return; case ICSpecXMLPackage.DOCUMENT_ROOT__CSPEC: setCspec((IComponentSpec) newValue); return; case ICSpecXMLPackage.DOCUMENT_ROOT__CSPEC_EXTENSION: setCspecExtension((ICSpecExtension) newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case ICSpecXMLPackage.DOCUMENT_ROOT__MIXED: getMixed().clear(); return; case ICSpecXMLPackage.DOCUMENT_ROOT__XMLNS_PREFIX_MAP: getXMLNSPrefixMap().clear(); return; case ICSpecXMLPackage.DOCUMENT_ROOT__XSI_SCHEMA_LOCATION: getXSISchemaLocation().clear(); return; case ICSpecXMLPackage.DOCUMENT_ROOT__CSPEC: setCspec((IComponentSpec) null); return; case ICSpecXMLPackage.DOCUMENT_ROOT__CSPEC_EXTENSION: setCspecExtension((ICSpecExtension) null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override public IComponentSpec getCspec() { return (IComponentSpec) getMixed().get(ICSpecXMLPackage.Literals.DOCUMENT_ROOT__CSPEC, true); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override public ICSpecExtension getCspecExtension() { return (ICSpecExtension) getMixed().get(ICSpecXMLPackage.Literals.DOCUMENT_ROOT__CSPEC_EXTENSION, true); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override public FeatureMap getMixed() { if (mixed == null) { mixed = new BasicFeatureMap(this, ICSpecXMLPackage.DOCUMENT_ROOT__MIXED); } return mixed; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override public EMap<String, String> getXMLNSPrefixMap() { if (xMLNSPrefixMap == null) { xMLNSPrefixMap = new EcoreEMap<String, String>(EcorePackage.Literals.ESTRING_TO_STRING_MAP_ENTRY, EStringToStringMapEntryImpl.class, this, ICSpecXMLPackage.DOCUMENT_ROOT__XMLNS_PREFIX_MAP); } return xMLNSPrefixMap; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override public EMap<String, String> getXSISchemaLocation() { if (xSISchemaLocation == null) { xSISchemaLocation = new EcoreEMap<String, String>(EcorePackage.Literals.ESTRING_TO_STRING_MAP_ENTRY, EStringToStringMapEntryImpl.class, this, ICSpecXMLPackage.DOCUMENT_ROOT__XSI_SCHEMA_LOCATION); } return xSISchemaLocation; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override public void setCspec(IComponentSpec newCspec) { ((FeatureMap.Internal) getMixed()).set(ICSpecXMLPackage.Literals.DOCUMENT_ROOT__CSPEC, newCspec); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override public void setCspecExtension(ICSpecExtension newCspecExtension) { ((FeatureMap.Internal) getMixed()).set(ICSpecXMLPackage.Literals.DOCUMENT_ROOT__CSPEC_EXTENSION, newCspecExtension); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); result.append(" (mixed: "); result.append(mixed); result.append(')'); return result.toString(); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */ @Override protected EClass eStaticClass() { return ICSpecXMLPackage.Literals.DOCUMENT_ROOT; } } // DocumentRootImpl