org.eclipse.ocl.expressions.impl.MessageExpImpl 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: MessageExpImpl.java,v 1.8 2009/01/23 17:16:04 cdamus Exp $
*/
package org.eclipse.ocl.expressions.impl;
import java.util.Collection;
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.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.ocl.expressions.ExpressionsPackage;
import org.eclipse.ocl.expressions.MessageExp;
import org.eclipse.ocl.expressions.OCLExpression;
import org.eclipse.ocl.expressions.operations.MessageExpOperations;
import org.eclipse.ocl.utilities.CallingASTNode;
import org.eclipse.ocl.utilities.UtilitiesPackage;
import org.eclipse.ocl.utilities.Visitor;
/**
*
* An implementation of the model object 'Message Exp'.
*
*
* The following features are implemented:
*
* - {@link org.eclipse.ocl.expressions.impl.MessageExpImpl#getPropertyStartPosition Property Start Position}
* - {@link org.eclipse.ocl.expressions.impl.MessageExpImpl#getPropertyEndPosition Property End Position}
* - {@link org.eclipse.ocl.expressions.impl.MessageExpImpl#getTarget Target}
* - {@link org.eclipse.ocl.expressions.impl.MessageExpImpl#getArgument Argument}
* - {@link org.eclipse.ocl.expressions.impl.MessageExpImpl#getCalledOperation Called Operation}
* - {@link org.eclipse.ocl.expressions.impl.MessageExpImpl#getSentSignal Sent Signal}
*
*
*
* @generated
*/
public class MessageExpImpl
extends OCLExpressionImpl
implements MessageExp {
/**
* The default value of the '{@link #getPropertyStartPosition() Property Start Position}' attribute.
*
*
* @see #getPropertyStartPosition()
* @generated
* @ordered
*/
protected static final int PROPERTY_START_POSITION_EDEFAULT = -1;
/**
* The cached value of the '{@link #getPropertyStartPosition() Property Start Position}' attribute.
*
*
* @see #getPropertyStartPosition()
* @generated
* @ordered
*/
protected int propertyStartPosition = PROPERTY_START_POSITION_EDEFAULT;
/**
* The default value of the '{@link #getPropertyEndPosition() Property End Position}' attribute.
*
*
* @see #getPropertyEndPosition()
* @generated
* @ordered
*/
protected static final int PROPERTY_END_POSITION_EDEFAULT = -1;
/**
* The cached value of the '{@link #getPropertyEndPosition() Property End Position}' attribute.
*
*
* @see #getPropertyEndPosition()
* @generated
* @ordered
*/
protected int propertyEndPosition = PROPERTY_END_POSITION_EDEFAULT;
/**
* The cached value of the '{@link #getTarget() Target}' containment reference.
*
*
* @see #getTarget()
* @generated
* @ordered
*/
protected OCLExpression target;
/**
* The cached value of the '{@link #getArgument() Argument}' containment reference list.
*
*
* @see #getArgument()
* @generated
* @ordered
*/
protected EList> argument;
/**
* The cached value of the '{@link #getCalledOperation() Called Operation}' containment reference.
*
*
* @see #getCalledOperation()
* @generated
* @ordered
*/
protected COA calledOperation;
/**
* The cached value of the '{@link #getSentSignal() Sent Signal}' containment reference.
*
*
* @see #getSentSignal()
* @generated
* @ordered
*/
protected SSA sentSignal;
/**
*
*
* @generated
*/
protected MessageExpImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return ExpressionsPackage.Literals.MESSAGE_EXP;
}
/**
*
*
* @generated
*/
public int getPropertyStartPosition() {
return propertyStartPosition;
}
/**
*
*
* @generated
*/
public void setPropertyStartPosition(int newPropertyStartPosition) {
int oldPropertyStartPosition = propertyStartPosition;
propertyStartPosition = newPropertyStartPosition;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET,
ExpressionsPackage.MESSAGE_EXP__PROPERTY_START_POSITION,
oldPropertyStartPosition, propertyStartPosition));
}
/**
*
*
* @generated
*/
public int getPropertyEndPosition() {
return propertyEndPosition;
}
/**
*
*
* @generated
*/
public void setPropertyEndPosition(int newPropertyEndPosition) {
int oldPropertyEndPosition = propertyEndPosition;
propertyEndPosition = newPropertyEndPosition;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET,
ExpressionsPackage.MESSAGE_EXP__PROPERTY_END_POSITION,
oldPropertyEndPosition, propertyEndPosition));
}
/**
*
*
* @generated
*/
public OCLExpression getTarget() {
return target;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetTarget(OCLExpression newTarget,
NotificationChain msgs) {
OCLExpression oldTarget = target;
target = newTarget;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this,
Notification.SET, ExpressionsPackage.MESSAGE_EXP__TARGET,
oldTarget, newTarget);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
public void setTarget(OCLExpression newTarget) {
if (newTarget != target) {
NotificationChain msgs = null;
if (target != null)
msgs = ((InternalEObject) target).eInverseRemove(this,
EOPPOSITE_FEATURE_BASE
- ExpressionsPackage.MESSAGE_EXP__TARGET, null, msgs);
if (newTarget != null)
msgs = ((InternalEObject) newTarget).eInverseAdd(this,
EOPPOSITE_FEATURE_BASE
- ExpressionsPackage.MESSAGE_EXP__TARGET, null, msgs);
msgs = basicSetTarget(newTarget, msgs);
if (msgs != null)
msgs.dispatch();
} else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET,
ExpressionsPackage.MESSAGE_EXP__TARGET, newTarget, newTarget));
}
/**
*
*
* @generated
*/
public EList> getArgument() {
if (argument == null) {
argument = new EObjectContainmentEList>(
OCLExpression.class, this,
ExpressionsPackage.MESSAGE_EXP__ARGUMENT);
}
return argument;
}
/**
*
*
* @generated
*/
public COA getCalledOperation() {
return calledOperation;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetCalledOperation(COA newCalledOperation,
NotificationChain msgs) {
COA oldCalledOperation = calledOperation;
calledOperation = newCalledOperation;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this,
Notification.SET,
ExpressionsPackage.MESSAGE_EXP__CALLED_OPERATION,
oldCalledOperation, newCalledOperation);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
public void setCalledOperation(COA newCalledOperation) {
if (newCalledOperation != calledOperation) {
NotificationChain msgs = null;
if (calledOperation != null)
msgs = ((InternalEObject) calledOperation).eInverseRemove(this,
EOPPOSITE_FEATURE_BASE
- ExpressionsPackage.MESSAGE_EXP__CALLED_OPERATION,
null, msgs);
if (newCalledOperation != null)
msgs = ((InternalEObject) newCalledOperation).eInverseAdd(this,
EOPPOSITE_FEATURE_BASE
- ExpressionsPackage.MESSAGE_EXP__CALLED_OPERATION,
null, msgs);
msgs = basicSetCalledOperation(newCalledOperation, msgs);
if (msgs != null)
msgs.dispatch();
} else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET,
ExpressionsPackage.MESSAGE_EXP__CALLED_OPERATION,
newCalledOperation, newCalledOperation));
}
/**
*
*
* @generated
*/
public SSA getSentSignal() {
return sentSignal;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetSentSignal(SSA newSentSignal,
NotificationChain msgs) {
SSA oldSentSignal = sentSignal;
sentSignal = newSentSignal;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this,
Notification.SET, ExpressionsPackage.MESSAGE_EXP__SENT_SIGNAL,
oldSentSignal, newSentSignal);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
public void setSentSignal(SSA newSentSignal) {
if (newSentSignal != sentSignal) {
NotificationChain msgs = null;
if (sentSignal != null)
msgs = ((InternalEObject) sentSignal).eInverseRemove(this,
EOPPOSITE_FEATURE_BASE
- ExpressionsPackage.MESSAGE_EXP__SENT_SIGNAL, null,
msgs);
if (newSentSignal != null)
msgs = ((InternalEObject) newSentSignal).eInverseAdd(this,
EOPPOSITE_FEATURE_BASE
- ExpressionsPackage.MESSAGE_EXP__SENT_SIGNAL, null,
msgs);
msgs = basicSetSentSignal(newSentSignal, msgs);
if (msgs != null)
msgs.dispatch();
} else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET,
ExpressionsPackage.MESSAGE_EXP__SENT_SIGNAL, newSentSignal,
newSentSignal));
}
/**
*
*
* @generated
*/
public boolean checkOperationArguments(DiagnosticChain diagnostics,
Map