All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.eclipse.ocl.expressions.impl.LetExpImpl Maven / Gradle / Ivy

/**
 * 
 * 
 * Copyright (c) 2006, 2009 IBM Corporation, Zeligsoft Inc., 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:
 *   IBM - Initial API and implementation
 *   Zeligsoft - Bug 207365
 * 
 * 
 *
 * $Id: LetExpImpl.java,v 1.8 2009/01/23 17:16:04 cdamus Exp $
 */
package org.eclipse.ocl.expressions.impl;

import java.util.Map;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.DiagnosticChain;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.ocl.expressions.ExpressionsPackage;
import org.eclipse.ocl.expressions.LetExp;
import org.eclipse.ocl.expressions.OCLExpression;
import org.eclipse.ocl.expressions.Variable;
import org.eclipse.ocl.expressions.operations.LetExpOperations;
import org.eclipse.ocl.utilities.Visitor;

/**
 * 
 * An implementation of the model object 'Let Exp'.
 * 
 * 

* The following features are implemented: *

    *
  • {@link org.eclipse.ocl.expressions.impl.LetExpImpl#getIn In}
  • *
  • {@link org.eclipse.ocl.expressions.impl.LetExpImpl#getVariable Variable}
  • *
*

* * @generated */ public class LetExpImpl extends OCLExpressionImpl implements LetExp { /** * The cached value of the '{@link #getIn() In}' containment reference. * * * @see #getIn() * @generated * @ordered */ protected OCLExpression in; /** * The cached value of the '{@link #getVariable() Variable}' containment reference. * * * @see #getVariable() * @generated * @ordered */ protected Variable variable; /** * * * @generated */ protected LetExpImpl() { super(); } /** * * * @generated */ @Override protected EClass eStaticClass() { return ExpressionsPackage.Literals.LET_EXP; } /** * * * @generated */ public OCLExpression getIn() { return in; } /** * * * @generated */ public NotificationChain basicSetIn(OCLExpression newIn, NotificationChain msgs) { OCLExpression oldIn = in; in = newIn; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ExpressionsPackage.LET_EXP__IN, oldIn, newIn); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * * * @generated */ public void setIn(OCLExpression newIn) { if (newIn != in) { NotificationChain msgs = null; if (in != null) msgs = ((InternalEObject) in).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ExpressionsPackage.LET_EXP__IN, null, msgs); if (newIn != null) msgs = ((InternalEObject) newIn).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ExpressionsPackage.LET_EXP__IN, null, msgs); msgs = basicSetIn(newIn, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, ExpressionsPackage.LET_EXP__IN, newIn, newIn)); } /** * * * @generated */ public Variable getVariable() { return variable; } /** * * * @generated */ public NotificationChain basicSetVariable(Variable newVariable, NotificationChain msgs) { Variable oldVariable = variable; variable = newVariable; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ExpressionsPackage.LET_EXP__VARIABLE, oldVariable, newVariable); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * * * @generated */ public void setVariable(Variable newVariable) { if (newVariable != variable) { NotificationChain msgs = null; if (variable != null) msgs = ((InternalEObject) variable).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ExpressionsPackage.LET_EXP__VARIABLE, null, msgs); if (newVariable != null) msgs = ((InternalEObject) newVariable).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ExpressionsPackage.LET_EXP__VARIABLE, null, msgs); msgs = basicSetVariable(newVariable, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, ExpressionsPackage.LET_EXP__VARIABLE, newVariable, newVariable)); } /** * * * @generated */ public boolean checkLetType(DiagnosticChain diagnostics, Map context) { return LetExpOperations.checkLetType(this, diagnostics, context); } /** * * * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case ExpressionsPackage.LET_EXP__IN : return basicSetIn(null, msgs); case ExpressionsPackage.LET_EXP__VARIABLE : return basicSetVariable(null, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * * * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case ExpressionsPackage.LET_EXP__IN : return getIn(); case ExpressionsPackage.LET_EXP__VARIABLE : return getVariable(); } return super.eGet(featureID, resolve, coreType); } /** * * * @generated */ @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case ExpressionsPackage.LET_EXP__IN : setIn((OCLExpression) newValue); return; case ExpressionsPackage.LET_EXP__VARIABLE : setVariable((Variable) newValue); return; } super.eSet(featureID, newValue); } /** * * * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case ExpressionsPackage.LET_EXP__IN : setIn((OCLExpression) null); return; case ExpressionsPackage.LET_EXP__VARIABLE : setVariable((Variable) null); return; } super.eUnset(featureID); } /** * * * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case ExpressionsPackage.LET_EXP__IN : return in != null; case ExpressionsPackage.LET_EXP__VARIABLE : return variable != null; } return super.eIsSet(featureID); } /** * @generated NOT */ @Override @SuppressWarnings("unchecked") public > T accept(U v) { return ((Visitor) v).visitLetExp(this); } } //LetExpImpl




© 2015 - 2024 Weber Informatics LLC | Privacy Policy