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

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 context) { return MessageExpOperations.checkOperationArguments(this, diagnostics, context); } /** * * * @generated */ public boolean checkSignalArguments(DiagnosticChain diagnostics, Map context) { return MessageExpOperations.checkSignalArguments(this, diagnostics, context); } /** * * * @generated */ public boolean checkTargetDefinesOperation(DiagnosticChain diagnostics, Map context) { return MessageExpOperations.checkTargetDefinesOperation(this, diagnostics, context); } /** * * * @generated */ public boolean checkHasOperationOrSignal(DiagnosticChain diagnostics, Map context) { return MessageExpOperations.checkHasOperationOrSignal(this, diagnostics, context); } /** * * * @generated */ public boolean checkTargetNotCollection(DiagnosticChain diagnostics, Map context) { return MessageExpOperations.checkTargetNotCollection(this, diagnostics, context); } /** * * * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case ExpressionsPackage.MESSAGE_EXP__TARGET : return basicSetTarget(null, msgs); case ExpressionsPackage.MESSAGE_EXP__ARGUMENT : return ((InternalEList) getArgument()).basicRemove(otherEnd, msgs); case ExpressionsPackage.MESSAGE_EXP__CALLED_OPERATION : return basicSetCalledOperation(null, msgs); case ExpressionsPackage.MESSAGE_EXP__SENT_SIGNAL : return basicSetSentSignal(null, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * * * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case ExpressionsPackage.MESSAGE_EXP__PROPERTY_START_POSITION : return getPropertyStartPosition(); case ExpressionsPackage.MESSAGE_EXP__PROPERTY_END_POSITION : return getPropertyEndPosition(); case ExpressionsPackage.MESSAGE_EXP__TARGET : return getTarget(); case ExpressionsPackage.MESSAGE_EXP__ARGUMENT : return getArgument(); case ExpressionsPackage.MESSAGE_EXP__CALLED_OPERATION : return getCalledOperation(); case ExpressionsPackage.MESSAGE_EXP__SENT_SIGNAL : return getSentSignal(); } return super.eGet(featureID, resolve, coreType); } /** * * * @generated */ @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case ExpressionsPackage.MESSAGE_EXP__PROPERTY_START_POSITION : setPropertyStartPosition((Integer) newValue); return; case ExpressionsPackage.MESSAGE_EXP__PROPERTY_END_POSITION : setPropertyEndPosition((Integer) newValue); return; case ExpressionsPackage.MESSAGE_EXP__TARGET : setTarget((OCLExpression) newValue); return; case ExpressionsPackage.MESSAGE_EXP__ARGUMENT : getArgument().clear(); getArgument().addAll( (Collection>) newValue); return; case ExpressionsPackage.MESSAGE_EXP__CALLED_OPERATION : setCalledOperation((COA) newValue); return; case ExpressionsPackage.MESSAGE_EXP__SENT_SIGNAL : setSentSignal((SSA) newValue); return; } super.eSet(featureID, newValue); } /** * * * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case ExpressionsPackage.MESSAGE_EXP__PROPERTY_START_POSITION : setPropertyStartPosition(PROPERTY_START_POSITION_EDEFAULT); return; case ExpressionsPackage.MESSAGE_EXP__PROPERTY_END_POSITION : setPropertyEndPosition(PROPERTY_END_POSITION_EDEFAULT); return; case ExpressionsPackage.MESSAGE_EXP__TARGET : setTarget((OCLExpression) null); return; case ExpressionsPackage.MESSAGE_EXP__ARGUMENT : getArgument().clear(); return; case ExpressionsPackage.MESSAGE_EXP__CALLED_OPERATION : setCalledOperation((COA) null); return; case ExpressionsPackage.MESSAGE_EXP__SENT_SIGNAL : setSentSignal((SSA) null); return; } super.eUnset(featureID); } /** * * * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case ExpressionsPackage.MESSAGE_EXP__PROPERTY_START_POSITION : return propertyStartPosition != PROPERTY_START_POSITION_EDEFAULT; case ExpressionsPackage.MESSAGE_EXP__PROPERTY_END_POSITION : return propertyEndPosition != PROPERTY_END_POSITION_EDEFAULT; case ExpressionsPackage.MESSAGE_EXP__TARGET : return target != null; case ExpressionsPackage.MESSAGE_EXP__ARGUMENT : return argument != null && !argument.isEmpty(); case ExpressionsPackage.MESSAGE_EXP__CALLED_OPERATION : return calledOperation != null; case ExpressionsPackage.MESSAGE_EXP__SENT_SIGNAL : return sentSignal != null; } return super.eIsSet(featureID); } /** * * * @generated */ @Override public int eBaseStructuralFeatureID(int derivedFeatureID, Class baseClass) { if (baseClass == CallingASTNode.class) { switch (derivedFeatureID) { case ExpressionsPackage.MESSAGE_EXP__PROPERTY_START_POSITION : return UtilitiesPackage.CALLING_AST_NODE__PROPERTY_START_POSITION; case ExpressionsPackage.MESSAGE_EXP__PROPERTY_END_POSITION : return UtilitiesPackage.CALLING_AST_NODE__PROPERTY_END_POSITION; default : return -1; } } return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass); } /** * * * @generated */ @Override public int eDerivedStructuralFeatureID(int baseFeatureID, Class baseClass) { if (baseClass == CallingASTNode.class) { switch (baseFeatureID) { case UtilitiesPackage.CALLING_AST_NODE__PROPERTY_START_POSITION : return ExpressionsPackage.MESSAGE_EXP__PROPERTY_START_POSITION; case UtilitiesPackage.CALLING_AST_NODE__PROPERTY_END_POSITION : return ExpressionsPackage.MESSAGE_EXP__PROPERTY_END_POSITION; default : return -1; } } return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass); } /** * * * @generated NOT */ @Override public String toString() { return super.toString(); } /** * @generated NOT */ @Override @SuppressWarnings("unchecked") public > T accept(U v) { return ((Visitor) v) .visitMessageExp(this); } } //MessageExpImpl




© 2015 - 2024 Weber Informatics LLC | Privacy Policy