/******************************************************************************* * Copyright (c) 2010 Martin Schnabel <mb0@mb0.org>. * 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 ******************************************************************************/ package org.axdt.as3.model.impl; import org.axdt.as3.As3EPackage; import org.axdt.as3.model.As3Block; import org.axdt.as3.model.As3CatchClause; import org.axdt.avm.model.AvmParameter; 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.emf.ecore.impl.MinimalEObjectImpl; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>As3 Catch Clause</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.axdt.as3.model.impl.As3CatchClauseImpl#getError <em>Error</em>}</li> * <li>{@link org.axdt.as3.model.impl.As3CatchClauseImpl#getBlock <em>Block</em>}</li> * </ul> * </p> * * @generated */ public class As3CatchClauseImpl extends MinimalEObjectImpl.Container implements As3CatchClause { /** * A set of bit flags representing the values of boolean attributes and whether unsettable features have been set. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ protected int flags = 0; /** * The cached value of the '{@link #getError() <em>Error</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getError() * @generated * @ordered */ protected AvmParameter error; /** * The cached value of the '{@link #getBlock() <em>Block</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getBlock() * @generated * @ordered */ protected As3Block block; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected As3CatchClauseImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return As3EPackage.Literals.AS3_CATCH_CLAUSE; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public AvmParameter getError() { return error; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetError(AvmParameter newError, NotificationChain msgs) { AvmParameter oldError = error; error = newError; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, As3EPackage.AS3_CATCH_CLAUSE__ERROR, oldError, newError); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setError(AvmParameter newError) { if (newError != error) { NotificationChain msgs = null; if (error != null) msgs = ((InternalEObject)error).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - As3EPackage.AS3_CATCH_CLAUSE__ERROR, null, msgs); if (newError != null) msgs = ((InternalEObject)newError).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - As3EPackage.AS3_CATCH_CLAUSE__ERROR, null, msgs); msgs = basicSetError(newError, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, As3EPackage.AS3_CATCH_CLAUSE__ERROR, newError, newError)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public As3Block getBlock() { return block; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetBlock(As3Block newBlock, NotificationChain msgs) { As3Block oldBlock = block; block = newBlock; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, As3EPackage.AS3_CATCH_CLAUSE__BLOCK, oldBlock, newBlock); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setBlock(As3Block newBlock) { if (newBlock != block) { NotificationChain msgs = null; if (block != null) msgs = ((InternalEObject)block).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - As3EPackage.AS3_CATCH_CLAUSE__BLOCK, null, msgs); if (newBlock != null) msgs = ((InternalEObject)newBlock).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - As3EPackage.AS3_CATCH_CLAUSE__BLOCK, null, msgs); msgs = basicSetBlock(newBlock, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, As3EPackage.AS3_CATCH_CLAUSE__BLOCK, newBlock, newBlock)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case As3EPackage.AS3_CATCH_CLAUSE__ERROR: return basicSetError(null, msgs); case As3EPackage.AS3_CATCH_CLAUSE__BLOCK: return basicSetBlock(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 As3EPackage.AS3_CATCH_CLAUSE__ERROR: return getError(); case As3EPackage.AS3_CATCH_CLAUSE__BLOCK: return getBlock(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case As3EPackage.AS3_CATCH_CLAUSE__ERROR: setError((AvmParameter)newValue); return; case As3EPackage.AS3_CATCH_CLAUSE__BLOCK: setBlock((As3Block)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case As3EPackage.AS3_CATCH_CLAUSE__ERROR: setError((AvmParameter)null); return; case As3EPackage.AS3_CATCH_CLAUSE__BLOCK: setBlock((As3Block)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case As3EPackage.AS3_CATCH_CLAUSE__ERROR: return error != null; case As3EPackage.AS3_CATCH_CLAUSE__BLOCK: return block != null; } return super.eIsSet(featureID); } } //As3CatchClauseImpl