/**
* <copyright>
* </copyright>
*
* $Id$
*/
package orgomg.cwm.analysis.businessnomenclature.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.util.EObjectWithInverseResolvingEList;
import org.eclipse.emf.ecore.util.InternalEList;
import orgomg.cwm.analysis.businessnomenclature.BusinessnomenclaturePackage;
import orgomg.cwm.analysis.businessnomenclature.Glossary;
import orgomg.cwm.analysis.businessnomenclature.Taxonomy;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Glossary</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link orgomg.cwm.analysis.businessnomenclature.impl.GlossaryImpl#getLanguage <em>Language</em>}</li>
* <li>{@link orgomg.cwm.analysis.businessnomenclature.impl.GlossaryImpl#getTaxonomy <em>Taxonomy</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class GlossaryImpl extends NomenclatureImpl implements Glossary {
/**
* The default value of the '{@link #getLanguage() <em>Language</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLanguage()
* @generated
* @ordered
*/
protected static final String LANGUAGE_EDEFAULT = null;
/**
* The cached value of the '{@link #getLanguage() <em>Language</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLanguage()
* @generated
* @ordered
*/
protected String language = LANGUAGE_EDEFAULT;
/**
* The cached value of the '{@link #getTaxonomy() <em>Taxonomy</em>}' reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTaxonomy()
* @generated
* @ordered
*/
protected EList<Taxonomy> taxonomy;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected GlossaryImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return BusinessnomenclaturePackage.Literals.GLOSSARY;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getLanguage() {
return language;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setLanguage(String newLanguage) {
String oldLanguage = language;
language = newLanguage;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, BusinessnomenclaturePackage.GLOSSARY__LANGUAGE, oldLanguage, language));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Taxonomy> getTaxonomy() {
if (taxonomy == null) {
taxonomy = new EObjectWithInverseResolvingEList.ManyInverse<Taxonomy>(Taxonomy.class, this, BusinessnomenclaturePackage.GLOSSARY__TAXONOMY, BusinessnomenclaturePackage.TAXONOMY__GLOSSARY);
}
return taxonomy;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case BusinessnomenclaturePackage.GLOSSARY__TAXONOMY:
return ((InternalEList<InternalEObject>)(InternalEList<?>)getTaxonomy()).basicAdd(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 BusinessnomenclaturePackage.GLOSSARY__TAXONOMY:
return ((InternalEList<?>)getTaxonomy()).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 BusinessnomenclaturePackage.GLOSSARY__LANGUAGE:
return getLanguage();
case BusinessnomenclaturePackage.GLOSSARY__TAXONOMY:
return getTaxonomy();
}
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 BusinessnomenclaturePackage.GLOSSARY__LANGUAGE:
setLanguage((String)newValue);
return;
case BusinessnomenclaturePackage.GLOSSARY__TAXONOMY:
getTaxonomy().clear();
getTaxonomy().addAll((Collection<? extends Taxonomy>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case BusinessnomenclaturePackage.GLOSSARY__LANGUAGE:
setLanguage(LANGUAGE_EDEFAULT);
return;
case BusinessnomenclaturePackage.GLOSSARY__TAXONOMY:
getTaxonomy().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case BusinessnomenclaturePackage.GLOSSARY__LANGUAGE:
return LANGUAGE_EDEFAULT == null ? language != null : !LANGUAGE_EDEFAULT.equals(language);
case BusinessnomenclaturePackage.GLOSSARY__TAXONOMY:
return taxonomy != null && !taxonomy.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(" (language: ");
result.append(language);
result.append(')');
return result.toString();
}
} //GlossaryImpl