/**
* <copyright>
* </copyright>
*
* $Id$
*/
package orgomg.cwm.resource.xml.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.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import orgomg.cwm.resource.xml.MixedContent;
import orgomg.cwm.resource.xml.Text;
import orgomg.cwm.resource.xml.XmlPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Mixed Content</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link orgomg.cwm.resource.xml.impl.MixedContentImpl#getText <em>Text</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class MixedContentImpl extends ContentImpl implements MixedContent {
/**
* The cached value of the '{@link #getText() <em>Text</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getText()
* @generated
* @ordered
*/
protected Text text;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected MixedContentImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return XmlPackage.Literals.MIXED_CONTENT;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Text getText() {
return text;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetText(Text newText, NotificationChain msgs) {
Text oldText = text;
text = newText;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, XmlPackage.MIXED_CONTENT__TEXT, oldText, newText);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setText(Text newText) {
if (newText != text) {
NotificationChain msgs = null;
if (text != null)
msgs = ((InternalEObject)text).eInverseRemove(this, XmlPackage.TEXT__OWNER_CONTENT, Text.class, msgs);
if (newText != null)
msgs = ((InternalEObject)newText).eInverseAdd(this, XmlPackage.TEXT__OWNER_CONTENT, Text.class, msgs);
msgs = basicSetText(newText, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, XmlPackage.MIXED_CONTENT__TEXT, newText, newText));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case XmlPackage.MIXED_CONTENT__TEXT:
if (text != null)
msgs = ((InternalEObject)text).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XmlPackage.MIXED_CONTENT__TEXT, null, msgs);
return basicSetText((Text)otherEnd, msgs);
}
return super.eInverseAdd(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case XmlPackage.MIXED_CONTENT__TEXT:
return basicSetText(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 XmlPackage.MIXED_CONTENT__TEXT:
return getText();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case XmlPackage.MIXED_CONTENT__TEXT:
setText((Text)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case XmlPackage.MIXED_CONTENT__TEXT:
setText((Text)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case XmlPackage.MIXED_CONTENT__TEXT:
return text != null;
}
return super.eIsSet(featureID);
}
} //MixedContentImpl