/**
*/
package hu.bme.mit.inf.dslreasoner.smtLanguage.impl;
import hu.bme.mit.inf.dslreasoner.smtLanguage.SMTCardinalityConstraint;
import hu.bme.mit.inf.dslreasoner.smtLanguage.SMTSymbolicValue;
import hu.bme.mit.inf.dslreasoner.smtLanguage.SMTTypeReference;
import hu.bme.mit.inf.dslreasoner.smtLanguage.SmtLanguagePackage;
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 'SMT Cardinality Constraint'.
*
*
* The following features are implemented:
*
* - {@link hu.bme.mit.inf.dslreasoner.smtLanguage.impl.SMTCardinalityConstraintImpl#getType Type}
* - {@link hu.bme.mit.inf.dslreasoner.smtLanguage.impl.SMTCardinalityConstraintImpl#getElements Elements}
*
*
*
* @generated
*/
public class SMTCardinalityConstraintImpl extends MinimalEObjectImpl.Container implements SMTCardinalityConstraint
{
/**
* The cached value of the '{@link #getType() Type}' containment reference.
*
*
* @see #getType()
* @generated
* @ordered
*/
protected SMTTypeReference type;
/**
* The cached value of the '{@link #getElements() Elements}' containment reference list.
*
*
* @see #getElements()
* @generated
* @ordered
*/
protected EList elements;
/**
*
*
* @generated
*/
protected SMTCardinalityConstraintImpl()
{
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass()
{
return SmtLanguagePackage.Literals.SMT_CARDINALITY_CONSTRAINT;
}
/**
*
*
* @generated
*/
public SMTTypeReference getType()
{
return type;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetType(SMTTypeReference newType, NotificationChain msgs)
{
SMTTypeReference oldType = type;
type = newType;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SmtLanguagePackage.SMT_CARDINALITY_CONSTRAINT__TYPE, oldType, newType);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
public void setType(SMTTypeReference newType)
{
if (newType != type)
{
NotificationChain msgs = null;
if (type != null)
msgs = ((InternalEObject)type).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SmtLanguagePackage.SMT_CARDINALITY_CONSTRAINT__TYPE, null, msgs);
if (newType != null)
msgs = ((InternalEObject)newType).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SmtLanguagePackage.SMT_CARDINALITY_CONSTRAINT__TYPE, null, msgs);
msgs = basicSetType(newType, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SmtLanguagePackage.SMT_CARDINALITY_CONSTRAINT__TYPE, newType, newType));
}
/**
*
*
* @generated
*/
public EList getElements()
{
if (elements == null)
{
elements = new EObjectContainmentEList(SMTSymbolicValue.class, this, SmtLanguagePackage.SMT_CARDINALITY_CONSTRAINT__ELEMENTS);
}
return elements;
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case SmtLanguagePackage.SMT_CARDINALITY_CONSTRAINT__TYPE:
return basicSetType(null, msgs);
case SmtLanguagePackage.SMT_CARDINALITY_CONSTRAINT__ELEMENTS:
return ((InternalEList>)getElements()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case SmtLanguagePackage.SMT_CARDINALITY_CONSTRAINT__TYPE:
return getType();
case SmtLanguagePackage.SMT_CARDINALITY_CONSTRAINT__ELEMENTS:
return getElements();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case SmtLanguagePackage.SMT_CARDINALITY_CONSTRAINT__TYPE:
setType((SMTTypeReference)newValue);
return;
case SmtLanguagePackage.SMT_CARDINALITY_CONSTRAINT__ELEMENTS:
getElements().clear();
getElements().addAll((Collection extends SMTSymbolicValue>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case SmtLanguagePackage.SMT_CARDINALITY_CONSTRAINT__TYPE:
setType((SMTTypeReference)null);
return;
case SmtLanguagePackage.SMT_CARDINALITY_CONSTRAINT__ELEMENTS:
getElements().clear();
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case SmtLanguagePackage.SMT_CARDINALITY_CONSTRAINT__TYPE:
return type != null;
case SmtLanguagePackage.SMT_CARDINALITY_CONSTRAINT__ELEMENTS:
return elements != null && !elements.isEmpty();
}
return super.eIsSet(featureID);
}
} //SMTCardinalityConstraintImpl