/**
*/
package org.eclipse.xtext.xdoc.xdoc.impl;
import java.util.Collection;
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.EObject;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.xtext.xdoc.xdoc.CodeBlock;
import org.eclipse.xtext.xdoc.xdoc.LangDef;
import org.eclipse.xtext.xdoc.xdoc.XdocPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Code Block</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.xtext.xdoc.xdoc.impl.CodeBlockImpl#getContents <em>Contents</em>}</li>
* <li>{@link org.eclipse.xtext.xdoc.xdoc.impl.CodeBlockImpl#getLanguage <em>Language</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class CodeBlockImpl extends MarkUpImpl implements CodeBlock
{
/**
* The cached value of the '{@link #getContents() <em>Contents</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getContents()
* @generated
* @ordered
*/
protected EList<EObject> contents;
/**
* The cached value of the '{@link #getLanguage() <em>Language</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLanguage()
* @generated
* @ordered
*/
protected LangDef language;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected CodeBlockImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return XdocPackage.Literals.CODE_BLOCK;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<EObject> getContents()
{
if (contents == null)
{
contents = new EObjectContainmentEList<EObject>(EObject.class, this, XdocPackage.CODE_BLOCK__CONTENTS);
}
return contents;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public LangDef getLanguage()
{
if (language != null && language.eIsProxy())
{
InternalEObject oldLanguage = (InternalEObject)language;
language = (LangDef)eResolveProxy(oldLanguage);
if (language != oldLanguage)
{
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, XdocPackage.CODE_BLOCK__LANGUAGE, oldLanguage, language));
}
}
return language;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public LangDef basicGetLanguage()
{
return language;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setLanguage(LangDef newLanguage)
{
LangDef oldLanguage = language;
language = newLanguage;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, XdocPackage.CODE_BLOCK__LANGUAGE, oldLanguage, language));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case XdocPackage.CODE_BLOCK__CONTENTS:
return ((InternalEList<?>)getContents()).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 XdocPackage.CODE_BLOCK__CONTENTS:
return getContents();
case XdocPackage.CODE_BLOCK__LANGUAGE:
if (resolve) return getLanguage();
return basicGetLanguage();
}
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 XdocPackage.CODE_BLOCK__CONTENTS:
getContents().clear();
getContents().addAll((Collection<? extends EObject>)newValue);
return;
case XdocPackage.CODE_BLOCK__LANGUAGE:
setLanguage((LangDef)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case XdocPackage.CODE_BLOCK__CONTENTS:
getContents().clear();
return;
case XdocPackage.CODE_BLOCK__LANGUAGE:
setLanguage((LangDef)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case XdocPackage.CODE_BLOCK__CONTENTS:
return contents != null && !contents.isEmpty();
case XdocPackage.CODE_BLOCK__LANGUAGE:
return language != null;
}
return super.eIsSet(featureID);
}
} //CodeBlockImpl