/**
*/
package de.ugoe.cs.swe.bnftools.ebnf.impl;
import de.ugoe.cs.swe.bnftools.ebnf.BnfEntry;
import de.ugoe.cs.swe.bnftools.ebnf.DeltaEntry;
import de.ugoe.cs.swe.bnftools.ebnf.EbnfPackage;
import de.ugoe.cs.swe.bnftools.ebnf.EtsiBnf;
import de.ugoe.cs.swe.bnftools.ebnf.ImportSection;
import de.ugoe.cs.swe.bnftools.ebnf.MergeEntry;
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.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
/**
*
* An implementation of the model object 'Etsi Bnf'.
*
*
* The following features are implemented:
*
* - {@link de.ugoe.cs.swe.bnftools.ebnf.impl.EtsiBnfImpl#getName Name}
* - {@link de.ugoe.cs.swe.bnftools.ebnf.impl.EtsiBnfImpl#getType Type}
* - {@link de.ugoe.cs.swe.bnftools.ebnf.impl.EtsiBnfImpl#getImportSection Import Section}
* - {@link de.ugoe.cs.swe.bnftools.ebnf.impl.EtsiBnfImpl#getBnfEntry Bnf Entry}
* - {@link de.ugoe.cs.swe.bnftools.ebnf.impl.EtsiBnfImpl#getDeltaEntry Delta Entry}
* - {@link de.ugoe.cs.swe.bnftools.ebnf.impl.EtsiBnfImpl#getMergeEntry Merge Entry}
*
*
*
* @generated
*/
public class EtsiBnfImpl extends MinimalEObjectImpl.Container implements EtsiBnf
{
/**
* The default value of the '{@link #getName() Name}' attribute.
*
*
* @see #getName()
* @generated
* @ordered
*/
protected static final String NAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getName() Name}' attribute.
*
*
* @see #getName()
* @generated
* @ordered
*/
protected String name = NAME_EDEFAULT;
/**
* The default value of the '{@link #getType() Type}' attribute.
*
*
* @see #getType()
* @generated
* @ordered
*/
protected static final String TYPE_EDEFAULT = null;
/**
* The cached value of the '{@link #getType() Type}' attribute.
*
*
* @see #getType()
* @generated
* @ordered
*/
protected String type = TYPE_EDEFAULT;
/**
* The cached value of the '{@link #getImportSection() Import Section}' containment reference.
*
*
* @see #getImportSection()
* @generated
* @ordered
*/
protected ImportSection importSection;
/**
* The cached value of the '{@link #getBnfEntry() Bnf Entry}' containment reference list.
*
*
* @see #getBnfEntry()
* @generated
* @ordered
*/
protected EList bnfEntry;
/**
* The cached value of the '{@link #getDeltaEntry() Delta Entry}' containment reference list.
*
*
* @see #getDeltaEntry()
* @generated
* @ordered
*/
protected EList deltaEntry;
/**
* The cached value of the '{@link #getMergeEntry() Merge Entry}' containment reference list.
*
*
* @see #getMergeEntry()
* @generated
* @ordered
*/
protected EList mergeEntry;
/**
*
*
* @generated
*/
protected EtsiBnfImpl()
{
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass()
{
return EbnfPackage.Literals.ETSI_BNF;
}
/**
*
*
* @generated
*/
public String getName()
{
return name;
}
/**
*
*
* @generated
*/
public void setName(String newName)
{
String oldName = name;
name = newName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, EbnfPackage.ETSI_BNF__NAME, oldName, name));
}
/**
*
*
* @generated
*/
public String getType()
{
return type;
}
/**
*
*
* @generated
*/
public void setType(String newType)
{
String oldType = type;
type = newType;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, EbnfPackage.ETSI_BNF__TYPE, oldType, type));
}
/**
*
*
* @generated
*/
public ImportSection getImportSection()
{
return importSection;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetImportSection(ImportSection newImportSection, NotificationChain msgs)
{
ImportSection oldImportSection = importSection;
importSection = newImportSection;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EbnfPackage.ETSI_BNF__IMPORT_SECTION, oldImportSection, newImportSection);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
public void setImportSection(ImportSection newImportSection)
{
if (newImportSection != importSection)
{
NotificationChain msgs = null;
if (importSection != null)
msgs = ((InternalEObject)importSection).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - EbnfPackage.ETSI_BNF__IMPORT_SECTION, null, msgs);
if (newImportSection != null)
msgs = ((InternalEObject)newImportSection).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - EbnfPackage.ETSI_BNF__IMPORT_SECTION, null, msgs);
msgs = basicSetImportSection(newImportSection, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, EbnfPackage.ETSI_BNF__IMPORT_SECTION, newImportSection, newImportSection));
}
/**
*
*
* @generated
*/
public EList getBnfEntry()
{
if (bnfEntry == null)
{
bnfEntry = new EObjectContainmentEList(BnfEntry.class, this, EbnfPackage.ETSI_BNF__BNF_ENTRY);
}
return bnfEntry;
}
/**
*
*
* @generated
*/
public EList getDeltaEntry()
{
if (deltaEntry == null)
{
deltaEntry = new EObjectContainmentEList(DeltaEntry.class, this, EbnfPackage.ETSI_BNF__DELTA_ENTRY);
}
return deltaEntry;
}
/**
*
*
* @generated
*/
public EList getMergeEntry()
{
if (mergeEntry == null)
{
mergeEntry = new EObjectContainmentEList(MergeEntry.class, this, EbnfPackage.ETSI_BNF__MERGE_ENTRY);
}
return mergeEntry;
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case EbnfPackage.ETSI_BNF__IMPORT_SECTION:
return basicSetImportSection(null, msgs);
case EbnfPackage.ETSI_BNF__BNF_ENTRY:
return ((InternalEList>)getBnfEntry()).basicRemove(otherEnd, msgs);
case EbnfPackage.ETSI_BNF__DELTA_ENTRY:
return ((InternalEList>)getDeltaEntry()).basicRemove(otherEnd, msgs);
case EbnfPackage.ETSI_BNF__MERGE_ENTRY:
return ((InternalEList>)getMergeEntry()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case EbnfPackage.ETSI_BNF__NAME:
return getName();
case EbnfPackage.ETSI_BNF__TYPE:
return getType();
case EbnfPackage.ETSI_BNF__IMPORT_SECTION:
return getImportSection();
case EbnfPackage.ETSI_BNF__BNF_ENTRY:
return getBnfEntry();
case EbnfPackage.ETSI_BNF__DELTA_ENTRY:
return getDeltaEntry();
case EbnfPackage.ETSI_BNF__MERGE_ENTRY:
return getMergeEntry();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case EbnfPackage.ETSI_BNF__NAME:
setName((String)newValue);
return;
case EbnfPackage.ETSI_BNF__TYPE:
setType((String)newValue);
return;
case EbnfPackage.ETSI_BNF__IMPORT_SECTION:
setImportSection((ImportSection)newValue);
return;
case EbnfPackage.ETSI_BNF__BNF_ENTRY:
getBnfEntry().clear();
getBnfEntry().addAll((Collection extends BnfEntry>)newValue);
return;
case EbnfPackage.ETSI_BNF__DELTA_ENTRY:
getDeltaEntry().clear();
getDeltaEntry().addAll((Collection extends DeltaEntry>)newValue);
return;
case EbnfPackage.ETSI_BNF__MERGE_ENTRY:
getMergeEntry().clear();
getMergeEntry().addAll((Collection extends MergeEntry>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case EbnfPackage.ETSI_BNF__NAME:
setName(NAME_EDEFAULT);
return;
case EbnfPackage.ETSI_BNF__TYPE:
setType(TYPE_EDEFAULT);
return;
case EbnfPackage.ETSI_BNF__IMPORT_SECTION:
setImportSection((ImportSection)null);
return;
case EbnfPackage.ETSI_BNF__BNF_ENTRY:
getBnfEntry().clear();
return;
case EbnfPackage.ETSI_BNF__DELTA_ENTRY:
getDeltaEntry().clear();
return;
case EbnfPackage.ETSI_BNF__MERGE_ENTRY:
getMergeEntry().clear();
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case EbnfPackage.ETSI_BNF__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
case EbnfPackage.ETSI_BNF__TYPE:
return TYPE_EDEFAULT == null ? type != null : !TYPE_EDEFAULT.equals(type);
case EbnfPackage.ETSI_BNF__IMPORT_SECTION:
return importSection != null;
case EbnfPackage.ETSI_BNF__BNF_ENTRY:
return bnfEntry != null && !bnfEntry.isEmpty();
case EbnfPackage.ETSI_BNF__DELTA_ENTRY:
return deltaEntry != null && !deltaEntry.isEmpty();
case EbnfPackage.ETSI_BNF__MERGE_ENTRY:
return mergeEntry != null && !mergeEntry.isEmpty();
}
return super.eIsSet(featureID);
}
/**
*
*
* @generated
*/
@Override
public String toString()
{
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (name: ");
result.append(name);
result.append(", type: ");
result.append(type);
result.append(')');
return result.toString();
}
} //EtsiBnfImpl