/** * <copyright> * </copyright> * * $Id$ */ package net.sf.orcc.ir.impl; import net.sf.orcc.ir.ExprUnary; import net.sf.orcc.ir.Expression; import net.sf.orcc.ir.IrPackage; import net.sf.orcc.ir.OpUnary; import net.sf.orcc.ir.Type; 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>Expr Unary</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link net.sf.orcc.ir.impl.ExprUnaryImpl#getExpr <em>Expr</em>}</li> * <li>{@link net.sf.orcc.ir.impl.ExprUnaryImpl#getOp <em>Op</em>}</li> * <li>{@link net.sf.orcc.ir.impl.ExprUnaryImpl#getType <em>Type</em>}</li> * </ul> * </p> * * @generated */ public class ExprUnaryImpl extends ExpressionImpl implements ExprUnary { /** * The cached value of the '{@link #getExpr() <em>Expr</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getExpr() * @generated * @ordered */ protected Expression expr; /** * The default value of the '{@link #getOp() <em>Op</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getOp() * @generated * @ordered */ protected static final OpUnary OP_EDEFAULT = OpUnary.BITNOT; /** * The cached value of the '{@link #getOp() <em>Op</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getOp() * @generated * @ordered */ protected OpUnary op = OP_EDEFAULT; /** * @generated */ protected Type type; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected ExprUnaryImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetExpr(Expression newExpr, NotificationChain msgs) { Expression oldExpr = expr; expr = newExpr; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, IrPackage.EXPR_UNARY__EXPR, oldExpr, newExpr); 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.EXPR_UNARY__EXPR: return getExpr(); case IrPackage.EXPR_UNARY__OP: return getOp(); case IrPackage.EXPR_UNARY__TYPE: return getType(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case IrPackage.EXPR_UNARY__EXPR: return basicSetExpr(null, msgs); case IrPackage.EXPR_UNARY__TYPE: return basicSetType(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.EXPR_UNARY__EXPR: return expr != null; case IrPackage.EXPR_UNARY__OP: return op != OP_EDEFAULT; case IrPackage.EXPR_UNARY__TYPE: return type != null; } return super.eIsSet(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case IrPackage.EXPR_UNARY__EXPR: setExpr((Expression) newValue); return; case IrPackage.EXPR_UNARY__OP: setOp((OpUnary) newValue); return; case IrPackage.EXPR_UNARY__TYPE: setType((Type) newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return IrPackage.Literals.EXPR_UNARY; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case IrPackage.EXPR_UNARY__EXPR: setExpr((Expression) null); return; case IrPackage.EXPR_UNARY__OP: setOp(OP_EDEFAULT); return; case IrPackage.EXPR_UNARY__TYPE: setType((Type) null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Expression getExpr() { return expr; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public OpUnary getOp() { return op; } @Override public Type getType() { return type; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetType(Type newType, NotificationChain msgs) { Type oldType = type; type = newType; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, IrPackage.EXPR_UNARY__TYPE, oldType, newType); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } @Override public boolean isExprUnary() { return true; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setExpr(Expression newExpr) { if (newExpr != expr) { NotificationChain msgs = null; if (expr != null) msgs = ((InternalEObject) expr).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - IrPackage.EXPR_UNARY__EXPR, null, msgs); if (newExpr != null) msgs = ((InternalEObject) newExpr).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - IrPackage.EXPR_UNARY__EXPR, null, msgs); msgs = basicSetExpr(newExpr, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, IrPackage.EXPR_UNARY__EXPR, newExpr, newExpr)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setOp(OpUnary newOp) { OpUnary oldOp = op; op = newOp == null ? OP_EDEFAULT : newOp; if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, IrPackage.EXPR_UNARY__OP, oldOp, op)); } @Override public void setType(Type type) { this.type = type; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); result.append(" (op: "); result.append(op); result.append(')'); return result.toString(); } } //ExprUnaryImpl