/** * <copyright> * Copyright (c) 2009-2012, IETR/INSA of Rennes * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * Neither the name of the IETR/INSA of Rennes nor the names of its * contributors may be used to endorse or promote products derived from this * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * </copyright> */ package net.sf.orcc.ir.impl; import net.sf.orcc.graph.impl.VertexImpl; import net.sf.orcc.ir.CfgNode; import net.sf.orcc.ir.IrPackage; import net.sf.orcc.ir.Block; 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; /** * <!-- begin-user-doc --> An implementation of the model object ' * <em><b>Cfg Node</b></em>'. <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link net.sf.orcc.ir.impl.CfgNodeImpl#getNode <em>Node</em>}</li> * </ul> * </p> * * @generated */ public class CfgNodeImpl extends VertexImpl implements CfgNode { /** * The cached value of the '{@link #getNode() <em>Node</em>}' reference. * <!-- begin-user-doc --> <!-- end-user-doc --> * @see #getNode() * @generated * @ordered */ protected Block node; /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ protected CfgNodeImpl() { super(); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public Block basicGetNode() { return node; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetNode(Block newNode, NotificationChain msgs) { Block oldNode = node; node = newNode; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, IrPackage.CFG_NODE__NODE, oldNode, newNode); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case IrPackage.CFG_NODE__NODE: if (resolve) return getNode(); return basicGetNode(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case IrPackage.CFG_NODE__NODE: if (node != null) msgs = ((InternalEObject) node).eInverseRemove(this, IrPackage.BLOCK__CFG_NODE, Block.class, msgs); return basicSetNode((Block) otherEnd, msgs); } return super.eInverseAdd(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case IrPackage.CFG_NODE__NODE: return basicSetNode(null, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case IrPackage.CFG_NODE__NODE: return node != null; } return super.eIsSet(featureID); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case IrPackage.CFG_NODE__NODE: setNode((Block) newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return IrPackage.Literals.CFG_NODE; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case IrPackage.CFG_NODE__NODE: setNode((Block) null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public Block getNode() { if (node != null && node.eIsProxy()) { InternalEObject oldNode = (InternalEObject) node; node = (Block) eResolveProxy(oldNode); if (node != oldNode) { if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, IrPackage.CFG_NODE__NODE, oldNode, node)); } } return node; } /** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public void setNode(Block newNode) { if (newNode != node) { NotificationChain msgs = null; if (node != null) msgs = ((InternalEObject) node).eInverseRemove(this, IrPackage.BLOCK__CFG_NODE, Block.class, msgs); if (newNode != null) msgs = ((InternalEObject) newNode).eInverseAdd(this, IrPackage.BLOCK__CFG_NODE, Block.class, msgs); msgs = basicSetNode(newNode, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, IrPackage.CFG_NODE__NODE, newNode, newNode)); } } // CfgNodeImpl