/** * <copyright> * Copyright (c) 2013 Willink Transformations, University of York, and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * E.D.Willink - Initial API and implementation * Adolfo Sanchez-Barbudo (University of York) - Bug397429 * </copyright> */ package org.eclipse.qvto.examples.pivot.imperativeocl.impl; import java.util.Collection; 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.util.EObjectContainmentEList; import org.eclipse.emf.ecore.util.EObjectResolvingEList; import org.eclipse.emf.ecore.util.InternalEList; import org.eclipse.ocl.pivot.OCLExpression; import org.eclipse.ocl.pivot.Type; import org.eclipse.ocl.pivot.util.Visitor; import org.eclipse.qvto.examples.pivot.imperativeocl.CatchExp; import org.eclipse.qvto.examples.pivot.imperativeocl.ImperativeOCLPackage; import org.eclipse.qvto.examples.pivot.imperativeocl.util.ImperativeOCLVisitor; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Catch Exp</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * </p> * <ul> * <li>{@link org.eclipse.qvto.examples.pivot.imperativeocl.impl.CatchExpImpl#getBody <em>Body</em>}</li> * <li>{@link org.eclipse.qvto.examples.pivot.imperativeocl.impl.CatchExpImpl#getException <em>Exception</em>}</li> * </ul> * * @generated */ public class CatchExpImpl extends ImperativeExpressionImpl implements CatchExp { /** * The cached value of the '{@link #getBody() <em>Body</em>}' containment reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getBody() * @generated * @ordered */ protected EList<OCLExpression> body; /** * The cached value of the '{@link #getException() <em>Exception</em>}' reference list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getException() * @generated * @ordered */ protected EList<Type> exception; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected CatchExpImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return ImperativeOCLPackage.Literals.CATCH_EXP; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<OCLExpression> getBody() { if (body == null) { body = new EObjectContainmentEList<OCLExpression>(OCLExpression.class, this, ImperativeOCLPackage.CATCH_EXP__BODY); } return body; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<Type> getException() { if (exception == null) { exception = new EObjectResolvingEList<Type>(Type.class, this, ImperativeOCLPackage.CATCH_EXP__EXCEPTION); } return exception; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case ImperativeOCLPackage.CATCH_EXP__BODY: return ((InternalEList<?>)getBody()).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.CATCH_EXP__BODY: return getBody(); case ImperativeOCLPackage.CATCH_EXP__EXCEPTION: return getException(); } 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.CATCH_EXP__BODY: getBody().clear(); getBody().addAll((Collection<? extends OCLExpression>)newValue); return; case ImperativeOCLPackage.CATCH_EXP__EXCEPTION: getException().clear(); getException().addAll((Collection<? extends Type>)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case ImperativeOCLPackage.CATCH_EXP__BODY: getBody().clear(); return; case ImperativeOCLPackage.CATCH_EXP__EXCEPTION: getException().clear(); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case ImperativeOCLPackage.CATCH_EXP__BODY: return body != null && !body.isEmpty(); case ImperativeOCLPackage.CATCH_EXP__EXCEPTION: return exception != null && !exception.isEmpty(); } return super.eIsSet(featureID); } /** * {@inheritDoc} * @generated */ @SuppressWarnings("unchecked") @Override public <R> R accept(Visitor<R> visitor) { return (R) ((ImperativeOCLVisitor<?>)visitor).visitCatchExp(this); } } //CatchExpImpl