/**
*/
package de.ugoe.cs.swe.bnftools.ebnf.impl;
import de.ugoe.cs.swe.bnftools.ebnf.DefinitionList;
import de.ugoe.cs.swe.bnftools.ebnf.EbnfPackage;
import de.ugoe.cs.swe.bnftools.ebnf.RepeatedSequence;
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 'Repeated Sequence'.
*
*
* The following features are implemented:
*
* - {@link de.ugoe.cs.swe.bnftools.ebnf.impl.RepeatedSequenceImpl#getDefinitions Definitions}
* - {@link de.ugoe.cs.swe.bnftools.ebnf.impl.RepeatedSequenceImpl#isMorethanonce Morethanonce}
*
*
*
* @generated
*/
public class RepeatedSequenceImpl extends MinimalEObjectImpl.Container implements RepeatedSequence
{
/**
* The cached value of the '{@link #getDefinitions() Definitions}' containment reference list.
*
*
* @see #getDefinitions()
* @generated
* @ordered
*/
protected EList definitions;
/**
* The default value of the '{@link #isMorethanonce() Morethanonce}' attribute.
*
*
* @see #isMorethanonce()
* @generated
* @ordered
*/
protected static final boolean MORETHANONCE_EDEFAULT = false;
/**
* The cached value of the '{@link #isMorethanonce() Morethanonce}' attribute.
*
*
* @see #isMorethanonce()
* @generated
* @ordered
*/
protected boolean morethanonce = MORETHANONCE_EDEFAULT;
/**
*
*
* @generated
*/
protected RepeatedSequenceImpl()
{
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass()
{
return EbnfPackage.Literals.REPEATED_SEQUENCE;
}
/**
*
*
* @generated
*/
public EList getDefinitions()
{
if (definitions == null)
{
definitions = new EObjectContainmentEList(DefinitionList.class, this, EbnfPackage.REPEATED_SEQUENCE__DEFINITIONS);
}
return definitions;
}
/**
*
*
* @generated
*/
public boolean isMorethanonce()
{
return morethanonce;
}
/**
*
*
* @generated
*/
public void setMorethanonce(boolean newMorethanonce)
{
boolean oldMorethanonce = morethanonce;
morethanonce = newMorethanonce;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, EbnfPackage.REPEATED_SEQUENCE__MORETHANONCE, oldMorethanonce, morethanonce));
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case EbnfPackage.REPEATED_SEQUENCE__DEFINITIONS:
return ((InternalEList>)getDefinitions()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case EbnfPackage.REPEATED_SEQUENCE__DEFINITIONS:
return getDefinitions();
case EbnfPackage.REPEATED_SEQUENCE__MORETHANONCE:
return isMorethanonce();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case EbnfPackage.REPEATED_SEQUENCE__DEFINITIONS:
getDefinitions().clear();
getDefinitions().addAll((Collection extends DefinitionList>)newValue);
return;
case EbnfPackage.REPEATED_SEQUENCE__MORETHANONCE:
setMorethanonce((Boolean)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case EbnfPackage.REPEATED_SEQUENCE__DEFINITIONS:
getDefinitions().clear();
return;
case EbnfPackage.REPEATED_SEQUENCE__MORETHANONCE:
setMorethanonce(MORETHANONCE_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case EbnfPackage.REPEATED_SEQUENCE__DEFINITIONS:
return definitions != null && !definitions.isEmpty();
case EbnfPackage.REPEATED_SEQUENCE__MORETHANONCE:
return morethanonce != MORETHANONCE_EDEFAULT;
}
return super.eIsSet(featureID);
}
/**
*
*
* @generated
*/
@Override
public String toString()
{
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (morethanonce: ");
result.append(morethanonce);
result.append(')');
return result.toString();
}
} //RepeatedSequenceImpl