/*******************************************************************************
* Copyright (c) 2006-2012
* Software Technology Group, Dresden University of Technology
* DevBoost GmbH, Berlin, Amtsgericht Charlottenburg, HRB 140026
*
* 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:
* Software Technology Group - TU Dresden, Germany;
* DevBoost GmbH - Berlin, Germany
* - initial API and implementation
******************************************************************************/
/**
* <copyright>
* </copyright>
*
* $Id$
*/
package org.w3.xforms.impl;
import org.eclipse.emf.common.notify.Notification;
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.ENotificationImpl;
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;
import org.oasisopen.names.tc.opendocument.xmlns.text.AnyAttListOrElements;
import org.w3.xforms.DocumentRoot;
import org.w3.xforms.XFormsPackage;
/**
* <!-- 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.w3.xforms.impl.DocumentRootImpl#getMixed <em>Mixed</em>}</li>
* <li>{@link org.w3.xforms.impl.DocumentRootImpl#getXMLNSPrefixMap <em>XMLNS Prefix Map</em>}</li>
* <li>{@link org.w3.xforms.impl.DocumentRootImpl#getXSISchemaLocation <em>XSI Schema Location</em>}</li>
* <li>{@link org.w3.xforms.impl.DocumentRootImpl#getModel <em>Model</em>}</li>
* <li>{@link org.w3.xforms.impl.DocumentRootImpl#getBind <em>Bind</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class DocumentRootImpl extends EObjectImpl implements DocumentRoot {
/**
* 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;
/**
* The default value of the '{@link #getBind() <em>Bind</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getBind()
* @generated
* @ordered
*/
protected static final String BIND_EDEFAULT = null;
/**
* The cached value of the '{@link #getBind() <em>Bind</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getBind()
* @generated
* @ordered
*/
protected String bind = BIND_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected DocumentRootImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return XFormsPackage.Literals.DOCUMENT_ROOT;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public FeatureMap getMixed() {
if (mixed == null) {
mixed = new BasicFeatureMap(this, XFormsPackage.DOCUMENT_ROOT__MIXED);
}
return mixed;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EMap<String, String> getXMLNSPrefixMap() {
if (xMLNSPrefixMap == null) {
xMLNSPrefixMap = new EcoreEMap<String,String>(EcorePackage.Literals.ESTRING_TO_STRING_MAP_ENTRY, EStringToStringMapEntryImpl.class, this, XFormsPackage.DOCUMENT_ROOT__XMLNS_PREFIX_MAP);
}
return xMLNSPrefixMap;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EMap<String, String> getXSISchemaLocation() {
if (xSISchemaLocation == null) {
xSISchemaLocation = new EcoreEMap<String,String>(EcorePackage.Literals.ESTRING_TO_STRING_MAP_ENTRY, EStringToStringMapEntryImpl.class, this, XFormsPackage.DOCUMENT_ROOT__XSI_SCHEMA_LOCATION);
}
return xSISchemaLocation;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public AnyAttListOrElements getModel() {
return (AnyAttListOrElements)getMixed().get(XFormsPackage.Literals.DOCUMENT_ROOT__MODEL, true);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetModel(AnyAttListOrElements newModel, NotificationChain msgs) {
return ((FeatureMap.Internal)getMixed()).basicAdd(XFormsPackage.Literals.DOCUMENT_ROOT__MODEL, newModel, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setModel(AnyAttListOrElements newModel) {
((FeatureMap.Internal)getMixed()).set(XFormsPackage.Literals.DOCUMENT_ROOT__MODEL, newModel);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getBind() {
return bind;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setBind(String newBind) {
String oldBind = bind;
bind = newBind;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, XFormsPackage.DOCUMENT_ROOT__BIND, oldBind, bind));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case XFormsPackage.DOCUMENT_ROOT__MIXED:
return ((InternalEList<?>)getMixed()).basicRemove(otherEnd, msgs);
case XFormsPackage.DOCUMENT_ROOT__XMLNS_PREFIX_MAP:
return ((InternalEList<?>)getXMLNSPrefixMap()).basicRemove(otherEnd, msgs);
case XFormsPackage.DOCUMENT_ROOT__XSI_SCHEMA_LOCATION:
return ((InternalEList<?>)getXSISchemaLocation()).basicRemove(otherEnd, msgs);
case XFormsPackage.DOCUMENT_ROOT__MODEL:
return basicSetModel(null, 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 XFormsPackage.DOCUMENT_ROOT__MIXED:
if (coreType) return getMixed();
return ((FeatureMap.Internal)getMixed()).getWrapper();
case XFormsPackage.DOCUMENT_ROOT__XMLNS_PREFIX_MAP:
if (coreType) return getXMLNSPrefixMap();
else return getXMLNSPrefixMap().map();
case XFormsPackage.DOCUMENT_ROOT__XSI_SCHEMA_LOCATION:
if (coreType) return getXSISchemaLocation();
else return getXSISchemaLocation().map();
case XFormsPackage.DOCUMENT_ROOT__MODEL:
return getModel();
case XFormsPackage.DOCUMENT_ROOT__BIND:
return getBind();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case XFormsPackage.DOCUMENT_ROOT__MIXED:
((FeatureMap.Internal)getMixed()).set(newValue);
return;
case XFormsPackage.DOCUMENT_ROOT__XMLNS_PREFIX_MAP:
((EStructuralFeature.Setting)getXMLNSPrefixMap()).set(newValue);
return;
case XFormsPackage.DOCUMENT_ROOT__XSI_SCHEMA_LOCATION:
((EStructuralFeature.Setting)getXSISchemaLocation()).set(newValue);
return;
case XFormsPackage.DOCUMENT_ROOT__MODEL:
setModel((AnyAttListOrElements)newValue);
return;
case XFormsPackage.DOCUMENT_ROOT__BIND:
setBind((String)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case XFormsPackage.DOCUMENT_ROOT__MIXED:
getMixed().clear();
return;
case XFormsPackage.DOCUMENT_ROOT__XMLNS_PREFIX_MAP:
getXMLNSPrefixMap().clear();
return;
case XFormsPackage.DOCUMENT_ROOT__XSI_SCHEMA_LOCATION:
getXSISchemaLocation().clear();
return;
case XFormsPackage.DOCUMENT_ROOT__MODEL:
setModel((AnyAttListOrElements)null);
return;
case XFormsPackage.DOCUMENT_ROOT__BIND:
setBind(BIND_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case XFormsPackage.DOCUMENT_ROOT__MIXED:
return mixed != null && !mixed.isEmpty();
case XFormsPackage.DOCUMENT_ROOT__XMLNS_PREFIX_MAP:
return xMLNSPrefixMap != null && !xMLNSPrefixMap.isEmpty();
case XFormsPackage.DOCUMENT_ROOT__XSI_SCHEMA_LOCATION:
return xSISchemaLocation != null && !xSISchemaLocation.isEmpty();
case XFormsPackage.DOCUMENT_ROOT__MODEL:
return getModel() != null;
case XFormsPackage.DOCUMENT_ROOT__BIND:
return BIND_EDEFAULT == null ? bind != null : !BIND_EDEFAULT.equals(bind);
}
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(" (mixed: ");
result.append(mixed);
result.append(", bind: ");
result.append(bind);
result.append(')');
return result.toString();
}
} //DocumentRootImpl