blob: b3c0d2040ad9d3699e05dc49a900b0011a5fc73f [file] [log] [blame]
/**
*/
package org.eclipse.qvto.examples.xtext.qvtoperationalcs.impl;
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;
import org.eclipse.ocl.xtext.basecs.impl.ParameterCSImpl;
import org.eclipse.ocl.xtext.basecs.util.BaseCSVisitor;
import org.eclipse.qvto.examples.xtext.qvtoperationalcs.DirectionKindCS;
import org.eclipse.qvto.examples.xtext.qvtoperationalcs.InitPartCS;
import org.eclipse.qvto.examples.xtext.qvtoperationalcs.ParameterDeclarationCS;
import org.eclipse.qvto.examples.xtext.qvtoperationalcs.QVTOperationalCSPackage;
import org.eclipse.qvto.examples.xtext.qvtoperationalcs.util.QVTOperationalCSVisitor;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Parameter Declaration CS</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.qvto.examples.xtext.qvtoperationalcs.impl.ParameterDeclarationCSImpl#getDirection <em>Direction</em>}</li>
* <li>{@link org.eclipse.qvto.examples.xtext.qvtoperationalcs.impl.ParameterDeclarationCSImpl#getOwnedInitPart <em>Owned Init Part</em>}</li>
* </ul>
*
* @generated
*/
public class ParameterDeclarationCSImpl extends ParameterCSImpl implements ParameterDeclarationCS {
/**
* The default value of the '{@link #getDirection() <em>Direction</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDirection()
* @generated
* @ordered
*/
protected static final DirectionKindCS DIRECTION_EDEFAULT = DirectionKindCS.IN;
/**
* The cached value of the '{@link #getDirection() <em>Direction</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDirection()
* @generated
* @ordered
*/
protected DirectionKindCS direction = DIRECTION_EDEFAULT;
/**
* This is true if the Direction attribute has been set.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
protected boolean directionESet;
/**
* The cached value of the '{@link #getOwnedInitPart() <em>Owned Init Part</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOwnedInitPart()
* @generated
* @ordered
*/
protected InitPartCS ownedInitPart;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ParameterDeclarationCSImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return QVTOperationalCSPackage.Literals.PARAMETER_DECLARATION_CS;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public DirectionKindCS getDirection() {
return direction;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setDirection(DirectionKindCS newDirection) {
DirectionKindCS oldDirection = direction;
direction = newDirection == null ? DIRECTION_EDEFAULT : newDirection;
boolean oldDirectionESet = directionESet;
directionESet = true;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, QVTOperationalCSPackage.PARAMETER_DECLARATION_CS__DIRECTION, oldDirection, direction, !oldDirectionESet));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void unsetDirection() {
DirectionKindCS oldDirection = direction;
boolean oldDirectionESet = directionESet;
direction = DIRECTION_EDEFAULT;
directionESet = false;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.UNSET, QVTOperationalCSPackage.PARAMETER_DECLARATION_CS__DIRECTION, oldDirection, DIRECTION_EDEFAULT, oldDirectionESet));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isSetDirection() {
return directionESet;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public InitPartCS getOwnedInitPart() {
return ownedInitPart;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetOwnedInitPart(InitPartCS newOwnedInitPart, NotificationChain msgs) {
InitPartCS oldOwnedInitPart = ownedInitPart;
ownedInitPart = newOwnedInitPart;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, QVTOperationalCSPackage.PARAMETER_DECLARATION_CS__OWNED_INIT_PART, oldOwnedInitPart, newOwnedInitPart);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setOwnedInitPart(InitPartCS newOwnedInitPart) {
if (newOwnedInitPart != ownedInitPart) {
NotificationChain msgs = null;
if (ownedInitPart != null)
msgs = ((InternalEObject)ownedInitPart).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - QVTOperationalCSPackage.PARAMETER_DECLARATION_CS__OWNED_INIT_PART, null, msgs);
if (newOwnedInitPart != null)
msgs = ((InternalEObject)newOwnedInitPart).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - QVTOperationalCSPackage.PARAMETER_DECLARATION_CS__OWNED_INIT_PART, null, msgs);
msgs = basicSetOwnedInitPart(newOwnedInitPart, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, QVTOperationalCSPackage.PARAMETER_DECLARATION_CS__OWNED_INIT_PART, newOwnedInitPart, newOwnedInitPart));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String toString() {
return super.toString();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case QVTOperationalCSPackage.PARAMETER_DECLARATION_CS__OWNED_INIT_PART:
return basicSetOwnedInitPart(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 QVTOperationalCSPackage.PARAMETER_DECLARATION_CS__DIRECTION:
return getDirection();
case QVTOperationalCSPackage.PARAMETER_DECLARATION_CS__OWNED_INIT_PART:
return getOwnedInitPart();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case QVTOperationalCSPackage.PARAMETER_DECLARATION_CS__DIRECTION:
setDirection((DirectionKindCS)newValue);
return;
case QVTOperationalCSPackage.PARAMETER_DECLARATION_CS__OWNED_INIT_PART:
setOwnedInitPart((InitPartCS)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case QVTOperationalCSPackage.PARAMETER_DECLARATION_CS__DIRECTION:
unsetDirection();
return;
case QVTOperationalCSPackage.PARAMETER_DECLARATION_CS__OWNED_INIT_PART:
setOwnedInitPart((InitPartCS)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case QVTOperationalCSPackage.PARAMETER_DECLARATION_CS__DIRECTION:
return isSetDirection();
case QVTOperationalCSPackage.PARAMETER_DECLARATION_CS__OWNED_INIT_PART:
return ownedInitPart != null;
}
return super.eIsSet(featureID);
}
/**
* {@inheritDoc}
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public <R> R accept(BaseCSVisitor<R> visitor) {
return (R) ((QVTOperationalCSVisitor<?>)visitor).visitParameterDeclarationCS(this);
}
} //ParameterDeclarationCSImpl