blob: 53285ba2dcf6ea44d3723cac3c6799420b196009 [file] [log] [blame]
/**
* <copyright>
* </copyright>
*
* $Id: AssignExpImpl.java,v 1.2 2009/01/25 23:11:18 radvorak Exp $
*/
package org.eclipse.m2m.qvt.oml.emof.ImperativeOCL.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.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.m2m.qvt.oml.emof.ImperativeOCL.AssignExp;
import org.eclipse.m2m.qvt.oml.emof.ImperativeOCL.ImperativeOCLPackage;
import org.eclipse.qvt.declarative.emof.EssentialOCL.OclExpression;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Assign Exp</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.m2m.qvt.oml.emof.ImperativeOCL.impl.AssignExpImpl#getDefaultValue <em>Default Value</em>}</li>
* <li>{@link org.eclipse.m2m.qvt.oml.emof.ImperativeOCL.impl.AssignExpImpl#getIsReset <em>Is Reset</em>}</li>
* <li>{@link org.eclipse.m2m.qvt.oml.emof.ImperativeOCL.impl.AssignExpImpl#getLeft <em>Left</em>}</li>
* <li>{@link org.eclipse.m2m.qvt.oml.emof.ImperativeOCL.impl.AssignExpImpl#getValue <em>Value</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class AssignExpImpl extends ImperativeExpressionImpl implements AssignExp {
/**
* The cached value of the '{@link #getDefaultValue() <em>Default Value</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDefaultValue()
* @generated
* @ordered
*/
protected OclExpression defaultValue;
/**
* The default value of the '{@link #getIsReset() <em>Is Reset</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getIsReset()
* @generated
* @ordered
*/
protected static final Boolean IS_RESET_EDEFAULT = null;
/**
* The cached value of the '{@link #getIsReset() <em>Is Reset</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getIsReset()
* @generated
* @ordered
*/
protected Boolean isReset = IS_RESET_EDEFAULT;
/**
* The cached value of the '{@link #getLeft() <em>Left</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLeft()
* @generated
* @ordered
*/
protected OclExpression left;
/**
* The cached value of the '{@link #getValue() <em>Value</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getValue()
* @generated
* @ordered
*/
protected EList<OclExpression> value;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected AssignExpImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return ImperativeOCLPackage.Literals.ASSIGN_EXP;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public OclExpression getDefaultValue() {
return defaultValue;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetDefaultValue(OclExpression newDefaultValue, NotificationChain msgs) {
OclExpression oldDefaultValue = defaultValue;
defaultValue = newDefaultValue;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ImperativeOCLPackage.ASSIGN_EXP__DEFAULT_VALUE, oldDefaultValue, newDefaultValue);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setDefaultValue(OclExpression newDefaultValue) {
if (newDefaultValue != defaultValue) {
NotificationChain msgs = null;
if (defaultValue != null)
msgs = ((InternalEObject)defaultValue).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ImperativeOCLPackage.ASSIGN_EXP__DEFAULT_VALUE, null, msgs);
if (newDefaultValue != null)
msgs = ((InternalEObject)newDefaultValue).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ImperativeOCLPackage.ASSIGN_EXP__DEFAULT_VALUE, null, msgs);
msgs = basicSetDefaultValue(newDefaultValue, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ImperativeOCLPackage.ASSIGN_EXP__DEFAULT_VALUE, newDefaultValue, newDefaultValue));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Boolean getIsReset() {
return isReset;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setIsReset(Boolean newIsReset) {
Boolean oldIsReset = isReset;
isReset = newIsReset;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ImperativeOCLPackage.ASSIGN_EXP__IS_RESET, oldIsReset, isReset));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public OclExpression getLeft() {
return left;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetLeft(OclExpression newLeft, NotificationChain msgs) {
OclExpression oldLeft = left;
left = newLeft;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ImperativeOCLPackage.ASSIGN_EXP__LEFT, oldLeft, newLeft);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setLeft(OclExpression newLeft) {
if (newLeft != left) {
NotificationChain msgs = null;
if (left != null)
msgs = ((InternalEObject)left).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ImperativeOCLPackage.ASSIGN_EXP__LEFT, null, msgs);
if (newLeft != null)
msgs = ((InternalEObject)newLeft).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ImperativeOCLPackage.ASSIGN_EXP__LEFT, null, msgs);
msgs = basicSetLeft(newLeft, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ImperativeOCLPackage.ASSIGN_EXP__LEFT, newLeft, newLeft));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<OclExpression> getValue() {
if (value == null) {
value = new EObjectContainmentEList<OclExpression>(OclExpression.class, this, ImperativeOCLPackage.ASSIGN_EXP__VALUE);
}
return value;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case ImperativeOCLPackage.ASSIGN_EXP__DEFAULT_VALUE:
return basicSetDefaultValue(null, msgs);
case ImperativeOCLPackage.ASSIGN_EXP__LEFT:
return basicSetLeft(null, msgs);
case ImperativeOCLPackage.ASSIGN_EXP__VALUE:
return ((InternalEList<?>)getValue()).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 ImperativeOCLPackage.ASSIGN_EXP__DEFAULT_VALUE:
return getDefaultValue();
case ImperativeOCLPackage.ASSIGN_EXP__IS_RESET:
return getIsReset();
case ImperativeOCLPackage.ASSIGN_EXP__LEFT:
return getLeft();
case ImperativeOCLPackage.ASSIGN_EXP__VALUE:
return getValue();
}
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 ImperativeOCLPackage.ASSIGN_EXP__DEFAULT_VALUE:
setDefaultValue((OclExpression)newValue);
return;
case ImperativeOCLPackage.ASSIGN_EXP__IS_RESET:
setIsReset((Boolean)newValue);
return;
case ImperativeOCLPackage.ASSIGN_EXP__LEFT:
setLeft((OclExpression)newValue);
return;
case ImperativeOCLPackage.ASSIGN_EXP__VALUE:
getValue().clear();
getValue().addAll((Collection<? extends OclExpression>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case ImperativeOCLPackage.ASSIGN_EXP__DEFAULT_VALUE:
setDefaultValue((OclExpression)null);
return;
case ImperativeOCLPackage.ASSIGN_EXP__IS_RESET:
setIsReset(IS_RESET_EDEFAULT);
return;
case ImperativeOCLPackage.ASSIGN_EXP__LEFT:
setLeft((OclExpression)null);
return;
case ImperativeOCLPackage.ASSIGN_EXP__VALUE:
getValue().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case ImperativeOCLPackage.ASSIGN_EXP__DEFAULT_VALUE:
return defaultValue != null;
case ImperativeOCLPackage.ASSIGN_EXP__IS_RESET:
return IS_RESET_EDEFAULT == null ? isReset != null : !IS_RESET_EDEFAULT.equals(isReset);
case ImperativeOCLPackage.ASSIGN_EXP__LEFT:
return left != null;
case ImperativeOCLPackage.ASSIGN_EXP__VALUE:
return value != null && !value.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(" (isReset: ");
result.append(isReset);
result.append(')');
return result.toString();
}
} //AssignExpImpl