/**
* <copyright>
* </copyright>
*
* $Id$
*/
package org.dresdenocl.language.ocl.impl;
import org.dresdenocl.language.ocl.CollectionRangeCS;
import org.dresdenocl.language.ocl.OclExpressionCS;
import org.dresdenocl.language.ocl.OclPackage;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Collection Range CS</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.dresdenocl.language.ocl.impl.CollectionRangeCSImpl#getFrom <em>From</em>}</li>
* <li>{@link org.dresdenocl.language.ocl.impl.CollectionRangeCSImpl#getTo <em>To</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class CollectionRangeCSImpl extends CollectionLiteralPartsCSImpl implements CollectionRangeCS {
/**
* The cached value of the '{@link #getFrom() <em>From</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getFrom()
* @generated
* @ordered
*/
protected OclExpressionCS from;
/**
* The cached value of the '{@link #getTo() <em>To</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTo()
* @generated
* @ordered
*/
protected OclExpressionCS to;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected CollectionRangeCSImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return OclPackage.Literals.COLLECTION_RANGE_CS;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public OclExpressionCS getFrom() {
return from;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetFrom(OclExpressionCS newFrom, NotificationChain msgs) {
OclExpressionCS oldFrom = from;
from = newFrom;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OclPackage.COLLECTION_RANGE_CS__FROM, oldFrom, newFrom);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setFrom(OclExpressionCS newFrom) {
if (newFrom != from) {
NotificationChain msgs = null;
if (from != null)
msgs = ((InternalEObject)from).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OclPackage.COLLECTION_RANGE_CS__FROM, null, msgs);
if (newFrom != null)
msgs = ((InternalEObject)newFrom).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OclPackage.COLLECTION_RANGE_CS__FROM, null, msgs);
msgs = basicSetFrom(newFrom, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, OclPackage.COLLECTION_RANGE_CS__FROM, newFrom, newFrom));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public OclExpressionCS getTo() {
return to;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetTo(OclExpressionCS newTo, NotificationChain msgs) {
OclExpressionCS oldTo = to;
to = newTo;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OclPackage.COLLECTION_RANGE_CS__TO, oldTo, newTo);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setTo(OclExpressionCS newTo) {
if (newTo != to) {
NotificationChain msgs = null;
if (to != null)
msgs = ((InternalEObject)to).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OclPackage.COLLECTION_RANGE_CS__TO, null, msgs);
if (newTo != null)
msgs = ((InternalEObject)newTo).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OclPackage.COLLECTION_RANGE_CS__TO, null, msgs);
msgs = basicSetTo(newTo, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, OclPackage.COLLECTION_RANGE_CS__TO, newTo, newTo));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case OclPackage.COLLECTION_RANGE_CS__FROM:
return basicSetFrom(null, msgs);
case OclPackage.COLLECTION_RANGE_CS__TO:
return basicSetTo(null, 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 OclPackage.COLLECTION_RANGE_CS__FROM:
return getFrom();
case OclPackage.COLLECTION_RANGE_CS__TO:
return getTo();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case OclPackage.COLLECTION_RANGE_CS__FROM:
setFrom((OclExpressionCS)newValue);
return;
case OclPackage.COLLECTION_RANGE_CS__TO:
setTo((OclExpressionCS)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case OclPackage.COLLECTION_RANGE_CS__FROM:
setFrom((OclExpressionCS)null);
return;
case OclPackage.COLLECTION_RANGE_CS__TO:
setTo((OclExpressionCS)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case OclPackage.COLLECTION_RANGE_CS__FROM:
return from != null;
case OclPackage.COLLECTION_RANGE_CS__TO:
return to != null;
}
return super.eIsSet(featureID);
}
} //CollectionRangeCSImpl