/**
*/
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.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
import org.eclipse.emf.ecore.util.EDataTypeUniqueEList;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.xtext.xdoc.xdoc.GlossaryEntry;
import org.eclipse.xtext.xdoc.xdoc.TextOrMarkup;
import org.eclipse.xtext.xdoc.xdoc.XdocPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Glossary Entry</b></em>'.
* <!-- end-user-doc -->
* <p>
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.xtext.xdoc.xdoc.impl.GlossaryEntryImpl#getName <em>Name</em>}</li>
* <li>{@link org.eclipse.xtext.xdoc.xdoc.impl.GlossaryEntryImpl#getAlias <em>Alias</em>}</li>
* <li>{@link org.eclipse.xtext.xdoc.xdoc.impl.GlossaryEntryImpl#getDescription <em>Description</em>}</li>
* </ul>
*
* @generated
*/
public class GlossaryEntryImpl extends MinimalEObjectImpl.Container implements GlossaryEntry
{
/**
* The default value of the '{@link #getName() <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getName()
* @generated
* @ordered
*/
protected static final String NAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getName() <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getName()
* @generated
* @ordered
*/
protected String name = NAME_EDEFAULT;
/**
* The cached value of the '{@link #getAlias() <em>Alias</em>}' attribute list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAlias()
* @generated
* @ordered
*/
protected EList<String> alias;
/**
* The cached value of the '{@link #getDescription() <em>Description</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDescription()
* @generated
* @ordered
*/
protected EList<TextOrMarkup> description;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected GlossaryEntryImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return XdocPackage.Literals.GLOSSARY_ENTRY;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getName()
{
return name;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setName(String newName)
{
String oldName = name;
name = newName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, XdocPackage.GLOSSARY_ENTRY__NAME, oldName, name));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<String> getAlias()
{
if (alias == null)
{
alias = new EDataTypeUniqueEList<String>(String.class, this, XdocPackage.GLOSSARY_ENTRY__ALIAS);
}
return alias;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<TextOrMarkup> getDescription()
{
if (description == null)
{
description = new EObjectContainmentEList<TextOrMarkup>(TextOrMarkup.class, this, XdocPackage.GLOSSARY_ENTRY__DESCRIPTION);
}
return description;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case XdocPackage.GLOSSARY_ENTRY__DESCRIPTION:
return ((InternalEList<?>)getDescription()).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.GLOSSARY_ENTRY__NAME:
return getName();
case XdocPackage.GLOSSARY_ENTRY__ALIAS:
return getAlias();
case XdocPackage.GLOSSARY_ENTRY__DESCRIPTION:
return getDescription();
}
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.GLOSSARY_ENTRY__NAME:
setName((String)newValue);
return;
case XdocPackage.GLOSSARY_ENTRY__ALIAS:
getAlias().clear();
getAlias().addAll((Collection<? extends String>)newValue);
return;
case XdocPackage.GLOSSARY_ENTRY__DESCRIPTION:
getDescription().clear();
getDescription().addAll((Collection<? extends TextOrMarkup>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case XdocPackage.GLOSSARY_ENTRY__NAME:
setName(NAME_EDEFAULT);
return;
case XdocPackage.GLOSSARY_ENTRY__ALIAS:
getAlias().clear();
return;
case XdocPackage.GLOSSARY_ENTRY__DESCRIPTION:
getDescription().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case XdocPackage.GLOSSARY_ENTRY__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case XdocPackage.GLOSSARY_ENTRY__ALIAS:
return alias != null && !alias.isEmpty();
case XdocPackage.GLOSSARY_ENTRY__DESCRIPTION:
return description != null && !description.isEmpty();
}
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(" (name: ");
result.append(name);
result.append(", alias: ");
result.append(alias);
result.append(')');
return result.toString();
}
} //GlossaryEntryImpl