| /** |
| */ |
| package org.eclipse.qvto.examples.xtext.imperativeoclcs.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.ocl.xtext.basecs.TypedRefCS; |
| import org.eclipse.ocl.xtext.basecs.util.BaseCSVisitor; |
| import org.eclipse.qvto.examples.xtext.imperativeoclcs.CatchExpCS; |
| import org.eclipse.qvto.examples.xtext.imperativeoclcs.ImperativeOCLCSPackage; |
| import org.eclipse.qvto.examples.xtext.imperativeoclcs.util.ImperativeOCLCSVisitor; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Catch Exp CS</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.qvto.examples.xtext.imperativeoclcs.impl.CatchExpCSImpl#getOwnedExceptionRefs <em>Owned Exception Refs</em>}</li> |
| * <li>{@link org.eclipse.qvto.examples.xtext.imperativeoclcs.impl.CatchExpCSImpl#getVarName <em>Var Name</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class CatchExpCSImpl extends ExpressionBlockCSImpl implements CatchExpCS { |
| /** |
| * The cached value of the '{@link #getOwnedExceptionRefs() <em>Owned Exception Refs</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getOwnedExceptionRefs() |
| * @generated |
| * @ordered |
| */ |
| protected EList<TypedRefCS> ownedExceptionRefs; |
| |
| /** |
| * The default value of the '{@link #getVarName() <em>Var Name</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getVarName() |
| * @generated |
| * @ordered |
| */ |
| protected static final String VAR_NAME_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getVarName() <em>Var Name</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getVarName() |
| * @generated |
| * @ordered |
| */ |
| protected String varName = VAR_NAME_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected CatchExpCSImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return ImperativeOCLCSPackage.Literals.CATCH_EXP_CS; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<TypedRefCS> getOwnedExceptionRefs() { |
| if (ownedExceptionRefs == null) { |
| ownedExceptionRefs = new EObjectContainmentEList<TypedRefCS>(TypedRefCS.class, this, ImperativeOCLCSPackage.CATCH_EXP_CS__OWNED_EXCEPTION_REFS); |
| } |
| return ownedExceptionRefs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getVarName() { |
| return varName; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setVarName(String newVarName) { |
| String oldVarName = varName; |
| varName = newVarName; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ImperativeOCLCSPackage.CATCH_EXP_CS__VAR_NAME, oldVarName, varName)); |
| } |
| |
| /** |
| * <!-- 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 ImperativeOCLCSPackage.CATCH_EXP_CS__OWNED_EXCEPTION_REFS: |
| return ((InternalEList<?>)getOwnedExceptionRefs()).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 ImperativeOCLCSPackage.CATCH_EXP_CS__OWNED_EXCEPTION_REFS: |
| return getOwnedExceptionRefs(); |
| case ImperativeOCLCSPackage.CATCH_EXP_CS__VAR_NAME: |
| return getVarName(); |
| } |
| 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 ImperativeOCLCSPackage.CATCH_EXP_CS__OWNED_EXCEPTION_REFS: |
| getOwnedExceptionRefs().clear(); |
| getOwnedExceptionRefs().addAll((Collection<? extends TypedRefCS>)newValue); |
| return; |
| case ImperativeOCLCSPackage.CATCH_EXP_CS__VAR_NAME: |
| setVarName((String)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case ImperativeOCLCSPackage.CATCH_EXP_CS__OWNED_EXCEPTION_REFS: |
| getOwnedExceptionRefs().clear(); |
| return; |
| case ImperativeOCLCSPackage.CATCH_EXP_CS__VAR_NAME: |
| setVarName(VAR_NAME_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case ImperativeOCLCSPackage.CATCH_EXP_CS__OWNED_EXCEPTION_REFS: |
| return ownedExceptionRefs != null && !ownedExceptionRefs.isEmpty(); |
| case ImperativeOCLCSPackage.CATCH_EXP_CS__VAR_NAME: |
| return VAR_NAME_EDEFAULT == null ? varName != null : !VAR_NAME_EDEFAULT.equals(varName); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * {@inheritDoc} |
| * @generated |
| */ |
| @SuppressWarnings("unchecked") |
| @Override |
| public <R> R accept(BaseCSVisitor<R> visitor) { |
| return (R) ((ImperativeOCLCSVisitor<?>)visitor).visitCatchExpCS(this); |
| } |
| |
| } //CatchExpCSImpl |