blob: 18c84cef183521058acd0363e2b58f26bf1c95dd [file] [log] [blame]
/**
* Copyright (c) 2007, 2018 Borland Software Corporation and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
*
* Contributors:
* Borland Software Corporation - initial API and implementation
*
* $Id: ResolveExpImpl.java,v 1.8 2009/03/15 11:44:40 radvorak Exp $
*/
package org.eclipse.m2m.internal.qvt.oml.expressions.impl;
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.m2m.internal.qvt.oml.expressions.ExpressionsPackage;
import org.eclipse.m2m.internal.qvt.oml.expressions.ResolveExp;
import org.eclipse.ocl.ecore.OCLExpression;
import org.eclipse.ocl.ecore.Variable;
import org.eclipse.ocl.ecore.impl.CallExpImpl;
import org.eclipse.ocl.utilities.Visitor;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Resolve Exp</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.m2m.internal.qvt.oml.expressions.impl.ResolveExpImpl#getCondition <em>Condition</em>}</li>
* <li>{@link org.eclipse.m2m.internal.qvt.oml.expressions.impl.ResolveExpImpl#isIsDeferred <em>Is Deferred</em>}</li>
* <li>{@link org.eclipse.m2m.internal.qvt.oml.expressions.impl.ResolveExpImpl#isIsInverse <em>Is Inverse</em>}</li>
* <li>{@link org.eclipse.m2m.internal.qvt.oml.expressions.impl.ResolveExpImpl#isOne <em>One</em>}</li>
* <li>{@link org.eclipse.m2m.internal.qvt.oml.expressions.impl.ResolveExpImpl#getTarget <em>Target</em>}</li>
* </ul>
*
* @generated
*/
public class ResolveExpImpl extends CallExpImpl implements ResolveExp {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static final String copyright = "Copyright (c) 2007 Borland Software Corporation\r\n\r\nAll rights reserved. This program and the accompanying materials\r\nare made available under the terms of the Eclipse Public License v2.0\r\nwhich accompanies this distribution, and is available at\r\nhttp://www.eclipse.org/legal/epl-v20.html\r\n \r\nContributors:\r\n Borland Software Corporation - initial API and implementation"; //$NON-NLS-1$
/**
* The cached value of the '{@link #getCondition() <em>Condition</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getCondition()
* @generated
* @ordered
*/
protected OCLExpression condition;
/**
* The default value of the '{@link #isIsDeferred() <em>Is Deferred</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isIsDeferred()
* @generated
* @ordered
*/
protected static final boolean IS_DEFERRED_EDEFAULT = false;
/**
* The flag representing the value of the '{@link #isIsDeferred() <em>Is Deferred</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isIsDeferred()
* @generated
* @ordered
*/
protected static final int IS_DEFERRED_EFLAG = 1 << 10;
/**
* The default value of the '{@link #isIsInverse() <em>Is Inverse</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isIsInverse()
* @generated
* @ordered
*/
protected static final boolean IS_INVERSE_EDEFAULT = false;
/**
* The flag representing the value of the '{@link #isIsInverse() <em>Is Inverse</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isIsInverse()
* @generated
* @ordered
*/
protected static final int IS_INVERSE_EFLAG = 1 << 11;
/**
* The default value of the '{@link #isOne() <em>One</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isOne()
* @generated
* @ordered
*/
protected static final boolean ONE_EDEFAULT = false;
/**
* The flag representing the value of the '{@link #isOne() <em>One</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isOne()
* @generated
* @ordered
*/
protected static final int ONE_EFLAG = 1 << 12;
/**
* The cached value of the '{@link #getTarget() <em>Target</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTarget()
* @generated
* @ordered
*/
protected Variable target;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ResolveExpImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return ExpressionsPackage.Literals.RESOLVE_EXP;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isOne() {
return (eFlags & ONE_EFLAG) != 0;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setOne(boolean newOne) {
boolean oldOne = (eFlags & ONE_EFLAG) != 0;
if (newOne) eFlags |= ONE_EFLAG; else eFlags &= ~ONE_EFLAG;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ExpressionsPackage.RESOLVE_EXP__ONE, oldOne, newOne));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isIsInverse() {
return (eFlags & IS_INVERSE_EFLAG) != 0;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setIsInverse(boolean newIsInverse) {
boolean oldIsInverse = (eFlags & IS_INVERSE_EFLAG) != 0;
if (newIsInverse) eFlags |= IS_INVERSE_EFLAG; else eFlags &= ~IS_INVERSE_EFLAG;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ExpressionsPackage.RESOLVE_EXP__IS_INVERSE, oldIsInverse, newIsInverse));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public boolean isIsDeferred() {
return (eFlags & IS_DEFERRED_EFLAG) != 0;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setIsDeferred(boolean newIsDeferred) {
boolean oldIsDeferred = (eFlags & IS_DEFERRED_EFLAG) != 0;
if (newIsDeferred) eFlags |= IS_DEFERRED_EFLAG; else eFlags &= ~IS_DEFERRED_EFLAG;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ExpressionsPackage.RESOLVE_EXP__IS_DEFERRED, oldIsDeferred, newIsDeferred));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Variable getTarget() {
return target;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetTarget(Variable newTarget, NotificationChain msgs) {
Variable oldTarget = target;
target = newTarget;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ExpressionsPackage.RESOLVE_EXP__TARGET, oldTarget, newTarget);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setTarget(Variable newTarget) {
if (newTarget != target) {
NotificationChain msgs = null;
if (target != null)
msgs = ((InternalEObject)target).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ExpressionsPackage.RESOLVE_EXP__TARGET, null, msgs);
if (newTarget != null)
msgs = ((InternalEObject)newTarget).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ExpressionsPackage.RESOLVE_EXP__TARGET, null, msgs);
msgs = basicSetTarget(newTarget, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ExpressionsPackage.RESOLVE_EXP__TARGET, newTarget, newTarget));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public OCLExpression getCondition() {
return condition;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetCondition(OCLExpression newCondition, NotificationChain msgs) {
OCLExpression oldCondition = condition;
condition = newCondition;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ExpressionsPackage.RESOLVE_EXP__CONDITION, oldCondition, newCondition);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setCondition(OCLExpression newCondition) {
if (newCondition != condition) {
NotificationChain msgs = null;
if (condition != null)
msgs = ((InternalEObject)condition).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ExpressionsPackage.RESOLVE_EXP__CONDITION, null, msgs);
if (newCondition != null)
msgs = ((InternalEObject)newCondition).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ExpressionsPackage.RESOLVE_EXP__CONDITION, null, msgs);
msgs = basicSetCondition(newCondition, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ExpressionsPackage.RESOLVE_EXP__CONDITION, newCondition, newCondition));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public <T, U extends Visitor<T, ?, ?, ?, ?, ?, ?, ?, ?, ?>> T accept(final U v) {
if(v instanceof org.eclipse.m2m.internal.qvt.oml.expressions.util.QVTOperationalVisitor) {
@SuppressWarnings("unchecked")
org.eclipse.m2m.internal.qvt.oml.expressions.util.QVTOperationalVisitor<T> visitorExt = (org.eclipse.m2m.internal.qvt.oml.expressions.util.QVTOperationalVisitor) v;
return visitorExt.visitResolveExp(this);
}
return org.eclipse.m2m.internal.qvt.oml.expressions.util.ForeignVisitorDefaultValue.getDefaultValueForVisitor(v);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case ExpressionsPackage.RESOLVE_EXP__CONDITION:
return basicSetCondition(null, msgs);
case ExpressionsPackage.RESOLVE_EXP__TARGET:
return basicSetTarget(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 ExpressionsPackage.RESOLVE_EXP__CONDITION:
return getCondition();
case ExpressionsPackage.RESOLVE_EXP__IS_DEFERRED:
return isIsDeferred();
case ExpressionsPackage.RESOLVE_EXP__IS_INVERSE:
return isIsInverse();
case ExpressionsPackage.RESOLVE_EXP__ONE:
return isOne();
case ExpressionsPackage.RESOLVE_EXP__TARGET:
return getTarget();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case ExpressionsPackage.RESOLVE_EXP__CONDITION:
setCondition((OCLExpression)newValue);
return;
case ExpressionsPackage.RESOLVE_EXP__IS_DEFERRED:
setIsDeferred((Boolean)newValue);
return;
case ExpressionsPackage.RESOLVE_EXP__IS_INVERSE:
setIsInverse((Boolean)newValue);
return;
case ExpressionsPackage.RESOLVE_EXP__ONE:
setOne((Boolean)newValue);
return;
case ExpressionsPackage.RESOLVE_EXP__TARGET:
setTarget((Variable)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case ExpressionsPackage.RESOLVE_EXP__CONDITION:
setCondition((OCLExpression)null);
return;
case ExpressionsPackage.RESOLVE_EXP__IS_DEFERRED:
setIsDeferred(IS_DEFERRED_EDEFAULT);
return;
case ExpressionsPackage.RESOLVE_EXP__IS_INVERSE:
setIsInverse(IS_INVERSE_EDEFAULT);
return;
case ExpressionsPackage.RESOLVE_EXP__ONE:
setOne(ONE_EDEFAULT);
return;
case ExpressionsPackage.RESOLVE_EXP__TARGET:
setTarget((Variable)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case ExpressionsPackage.RESOLVE_EXP__CONDITION:
return condition != null;
case ExpressionsPackage.RESOLVE_EXP__IS_DEFERRED:
return ((eFlags & IS_DEFERRED_EFLAG) != 0) != IS_DEFERRED_EDEFAULT;
case ExpressionsPackage.RESOLVE_EXP__IS_INVERSE:
return ((eFlags & IS_INVERSE_EFLAG) != 0) != IS_INVERSE_EDEFAULT;
case ExpressionsPackage.RESOLVE_EXP__ONE:
return ((eFlags & ONE_EFLAG) != 0) != ONE_EDEFAULT;
case ExpressionsPackage.RESOLVE_EXP__TARGET:
return target != null;
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuilder result = new StringBuilder(super.toString());
result.append(" (isDeferred: "); //$NON-NLS-1$
result.append((eFlags & IS_DEFERRED_EFLAG) != 0);
result.append(", isInverse: "); //$NON-NLS-1$
result.append((eFlags & IS_INVERSE_EFLAG) != 0);
result.append(", one: "); //$NON-NLS-1$
result.append((eFlags & ONE_EFLAG) != 0);
result.append(')');
return result.toString();
}
} //ResolveExpImpl