| /* |
| * Copyright (c) 2003, 2004 IBM Corporation and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Common Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/cpl-v10.html |
| * |
| * Contributors: |
| * IBM - Initial API and implementation |
| * |
| * $Id: MessageEndImpl.java,v 1.4 2004/06/18 04:34:32 khussey Exp $ |
| */ |
| package org.eclipse.uml2.impl; |
| |
| import java.util.Collection; |
| |
| 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.EStructuralFeature; |
| import org.eclipse.emf.ecore.InternalEObject; |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| import org.eclipse.emf.ecore.util.InternalEList; |
| import org.eclipse.uml2.Message; |
| import org.eclipse.uml2.MessageEnd; |
| import org.eclipse.uml2.StringExpression; |
| import org.eclipse.uml2.TemplateSignature; |
| import org.eclipse.uml2.UML2Package; |
| import org.eclipse.uml2.VisibilityKind; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Message End</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.uml2.impl.MessageEndImpl#getReceiveMessage <em>Receive Message</em>}</li> |
| * <li>{@link org.eclipse.uml2.impl.MessageEndImpl#getSendMessage <em>Send Message</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public abstract class MessageEndImpl extends NamedElementImpl implements MessageEnd { |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public static final String copyright = "Copyright (c) 2003, 2004 IBM Corporation and others."; //$NON-NLS-1$ |
| |
| /** |
| * The cached value of the '{@link #getReceiveMessage() <em>Receive Message</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getReceiveMessage() |
| * @generated |
| * @ordered |
| */ |
| protected Message receiveMessage = null; |
| |
| /** |
| * The cached value of the '{@link #getSendMessage() <em>Send Message</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getSendMessage() |
| * @generated |
| * @ordered |
| */ |
| protected Message sendMessage = null; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected MessageEndImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected EClass eStaticClass() { |
| return UML2Package.eINSTANCE.getMessageEnd(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Message getReceiveMessage() { |
| if (receiveMessage != null && receiveMessage.eIsProxy()) { |
| Message oldReceiveMessage = receiveMessage; |
| receiveMessage = (Message)eResolveProxy((InternalEObject)receiveMessage); |
| if (receiveMessage != oldReceiveMessage) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, UML2Package.MESSAGE_END__RECEIVE_MESSAGE, oldReceiveMessage, receiveMessage)); |
| } |
| } |
| return receiveMessage; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Message basicGetReceiveMessage() { |
| return receiveMessage; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetReceiveMessage(Message newReceiveMessage, NotificationChain msgs) { |
| Message oldReceiveMessage = receiveMessage; |
| receiveMessage = newReceiveMessage; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, UML2Package.MESSAGE_END__RECEIVE_MESSAGE, oldReceiveMessage, newReceiveMessage); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setReceiveMessage(Message newReceiveMessage) { |
| if (newReceiveMessage != receiveMessage) { |
| NotificationChain msgs = null; |
| if (receiveMessage != null) |
| msgs = ((InternalEObject)receiveMessage).eInverseRemove(this, UML2Package.MESSAGE__RECEIVE_EVENT, Message.class, msgs); |
| if (newReceiveMessage != null) |
| msgs = ((InternalEObject)newReceiveMessage).eInverseAdd(this, UML2Package.MESSAGE__RECEIVE_EVENT, Message.class, msgs); |
| msgs = basicSetReceiveMessage(newReceiveMessage, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, UML2Package.MESSAGE_END__RECEIVE_MESSAGE, newReceiveMessage, newReceiveMessage)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Message getSendMessage() { |
| if (sendMessage != null && sendMessage.eIsProxy()) { |
| Message oldSendMessage = sendMessage; |
| sendMessage = (Message)eResolveProxy((InternalEObject)sendMessage); |
| if (sendMessage != oldSendMessage) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, UML2Package.MESSAGE_END__SEND_MESSAGE, oldSendMessage, sendMessage)); |
| } |
| } |
| return sendMessage; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Message basicGetSendMessage() { |
| return sendMessage; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetSendMessage(Message newSendMessage, NotificationChain msgs) { |
| Message oldSendMessage = sendMessage; |
| sendMessage = newSendMessage; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, UML2Package.MESSAGE_END__SEND_MESSAGE, oldSendMessage, newSendMessage); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setSendMessage(Message newSendMessage) { |
| if (newSendMessage != sendMessage) { |
| NotificationChain msgs = null; |
| if (sendMessage != null) |
| msgs = ((InternalEObject)sendMessage).eInverseRemove(this, UML2Package.MESSAGE__SEND_EVENT, Message.class, msgs); |
| if (newSendMessage != null) |
| msgs = ((InternalEObject)newSendMessage).eInverseAdd(this, UML2Package.MESSAGE__SEND_EVENT, Message.class, msgs); |
| msgs = basicSetSendMessage(newSendMessage, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, UML2Package.MESSAGE_END__SEND_MESSAGE, newSendMessage, newSendMessage)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) { |
| if (featureID >= 0) { |
| switch (eDerivedStructuralFeatureID(featureID, baseClass)) { |
| case UML2Package.MESSAGE_END__EANNOTATIONS: |
| return ((InternalEList)getEAnnotations()).basicAdd(otherEnd, msgs); |
| case UML2Package.MESSAGE_END__TEMPLATE_BINDING: |
| return ((InternalEList)getTemplateBindings()).basicAdd(otherEnd, msgs); |
| case UML2Package.MESSAGE_END__OWNED_TEMPLATE_SIGNATURE: |
| if (ownedTemplateSignature != null) |
| msgs = ((InternalEObject)ownedTemplateSignature).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - UML2Package.MESSAGE_END__OWNED_TEMPLATE_SIGNATURE, null, msgs); |
| return basicSetOwnedTemplateSignature((TemplateSignature)otherEnd, msgs); |
| case UML2Package.MESSAGE_END__CLIENT_DEPENDENCY: |
| return ((InternalEList)getClientDependencies()).basicAdd(otherEnd, msgs); |
| case UML2Package.MESSAGE_END__RECEIVE_MESSAGE: |
| if (receiveMessage != null) |
| msgs = ((InternalEObject)receiveMessage).eInverseRemove(this, UML2Package.MESSAGE__RECEIVE_EVENT, Message.class, msgs); |
| return basicSetReceiveMessage((Message)otherEnd, msgs); |
| case UML2Package.MESSAGE_END__SEND_MESSAGE: |
| if (sendMessage != null) |
| msgs = ((InternalEObject)sendMessage).eInverseRemove(this, UML2Package.MESSAGE__SEND_EVENT, Message.class, msgs); |
| return basicSetSendMessage((Message)otherEnd, msgs); |
| default: |
| return eDynamicInverseAdd(otherEnd, featureID, baseClass, msgs); |
| } |
| } |
| if (eContainer != null) |
| msgs = eBasicRemoveFromContainer(msgs); |
| return eBasicSetContainer(otherEnd, featureID, msgs); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) { |
| if (featureID >= 0) { |
| switch (eDerivedStructuralFeatureID(featureID, baseClass)) { |
| case UML2Package.MESSAGE_END__EANNOTATIONS: |
| return ((InternalEList)getEAnnotations()).basicRemove(otherEnd, msgs); |
| case UML2Package.MESSAGE_END__OWNED_COMMENT: |
| return ((InternalEList)getOwnedComments()).basicRemove(otherEnd, msgs); |
| case UML2Package.MESSAGE_END__TEMPLATE_BINDING: |
| return ((InternalEList)getTemplateBindings()).basicRemove(otherEnd, msgs); |
| case UML2Package.MESSAGE_END__OWNED_TEMPLATE_SIGNATURE: |
| return basicSetOwnedTemplateSignature(null, msgs); |
| case UML2Package.MESSAGE_END__CLIENT_DEPENDENCY: |
| return ((InternalEList)getClientDependencies()).basicRemove(otherEnd, msgs); |
| case UML2Package.MESSAGE_END__NAME_EXPRESSION: |
| return basicSetNameExpression(null, msgs); |
| case UML2Package.MESSAGE_END__RECEIVE_MESSAGE: |
| return basicSetReceiveMessage(null, msgs); |
| case UML2Package.MESSAGE_END__SEND_MESSAGE: |
| return basicSetSendMessage(null, msgs); |
| default: |
| return eDynamicInverseRemove(otherEnd, featureID, baseClass, msgs); |
| } |
| } |
| return eBasicSetContainer(null, featureID, msgs); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Object eGet(EStructuralFeature eFeature, boolean resolve) { |
| switch (eDerivedStructuralFeatureID(eFeature)) { |
| case UML2Package.MESSAGE_END__EANNOTATIONS: |
| return getEAnnotations(); |
| case UML2Package.MESSAGE_END__OWNED_ELEMENT: |
| return getOwnedElements(); |
| case UML2Package.MESSAGE_END__OWNER: |
| if (resolve) return getOwner(); |
| return basicGetOwner(); |
| case UML2Package.MESSAGE_END__OWNED_COMMENT: |
| return getOwnedComments(); |
| case UML2Package.MESSAGE_END__TEMPLATE_BINDING: |
| return getTemplateBindings(); |
| case UML2Package.MESSAGE_END__OWNED_TEMPLATE_SIGNATURE: |
| return getOwnedTemplateSignature(); |
| case UML2Package.MESSAGE_END__NAME: |
| return getName(); |
| case UML2Package.MESSAGE_END__QUALIFIED_NAME: |
| return getQualifiedName(); |
| case UML2Package.MESSAGE_END__VISIBILITY: |
| return getVisibility(); |
| case UML2Package.MESSAGE_END__CLIENT_DEPENDENCY: |
| return getClientDependencies(); |
| case UML2Package.MESSAGE_END__NAME_EXPRESSION: |
| return getNameExpression(); |
| case UML2Package.MESSAGE_END__RECEIVE_MESSAGE: |
| if (resolve) return getReceiveMessage(); |
| return basicGetReceiveMessage(); |
| case UML2Package.MESSAGE_END__SEND_MESSAGE: |
| if (resolve) return getSendMessage(); |
| return basicGetSendMessage(); |
| } |
| return eDynamicGet(eFeature, resolve); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void eSet(EStructuralFeature eFeature, Object newValue) { |
| switch (eDerivedStructuralFeatureID(eFeature)) { |
| case UML2Package.MESSAGE_END__EANNOTATIONS: |
| getEAnnotations().clear(); |
| getEAnnotations().addAll((Collection)newValue); |
| return; |
| case UML2Package.MESSAGE_END__OWNED_COMMENT: |
| getOwnedComments().clear(); |
| getOwnedComments().addAll((Collection)newValue); |
| return; |
| case UML2Package.MESSAGE_END__TEMPLATE_BINDING: |
| getTemplateBindings().clear(); |
| getTemplateBindings().addAll((Collection)newValue); |
| return; |
| case UML2Package.MESSAGE_END__OWNED_TEMPLATE_SIGNATURE: |
| setOwnedTemplateSignature((TemplateSignature)newValue); |
| return; |
| case UML2Package.MESSAGE_END__NAME: |
| setName((String)newValue); |
| return; |
| case UML2Package.MESSAGE_END__VISIBILITY: |
| setVisibility((VisibilityKind)newValue); |
| return; |
| case UML2Package.MESSAGE_END__CLIENT_DEPENDENCY: |
| getClientDependencies().clear(); |
| getClientDependencies().addAll((Collection)newValue); |
| return; |
| case UML2Package.MESSAGE_END__NAME_EXPRESSION: |
| setNameExpression((StringExpression)newValue); |
| return; |
| case UML2Package.MESSAGE_END__RECEIVE_MESSAGE: |
| setReceiveMessage((Message)newValue); |
| return; |
| case UML2Package.MESSAGE_END__SEND_MESSAGE: |
| setSendMessage((Message)newValue); |
| return; |
| } |
| eDynamicSet(eFeature, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void eUnset(EStructuralFeature eFeature) { |
| switch (eDerivedStructuralFeatureID(eFeature)) { |
| case UML2Package.MESSAGE_END__EANNOTATIONS: |
| getEAnnotations().clear(); |
| return; |
| case UML2Package.MESSAGE_END__OWNED_COMMENT: |
| getOwnedComments().clear(); |
| return; |
| case UML2Package.MESSAGE_END__TEMPLATE_BINDING: |
| getTemplateBindings().clear(); |
| return; |
| case UML2Package.MESSAGE_END__OWNED_TEMPLATE_SIGNATURE: |
| setOwnedTemplateSignature((TemplateSignature)null); |
| return; |
| case UML2Package.MESSAGE_END__NAME: |
| setName(NAME_EDEFAULT); |
| return; |
| case UML2Package.MESSAGE_END__VISIBILITY: |
| setVisibility(VISIBILITY_EDEFAULT); |
| return; |
| case UML2Package.MESSAGE_END__CLIENT_DEPENDENCY: |
| getClientDependencies().clear(); |
| return; |
| case UML2Package.MESSAGE_END__NAME_EXPRESSION: |
| setNameExpression((StringExpression)null); |
| return; |
| case UML2Package.MESSAGE_END__RECEIVE_MESSAGE: |
| setReceiveMessage((Message)null); |
| return; |
| case UML2Package.MESSAGE_END__SEND_MESSAGE: |
| setSendMessage((Message)null); |
| return; |
| } |
| eDynamicUnset(eFeature); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public boolean eIsSet(EStructuralFeature eFeature) { |
| switch (eDerivedStructuralFeatureID(eFeature)) { |
| case UML2Package.MESSAGE_END__EANNOTATIONS: |
| return eAnnotations != null && !eAnnotations.isEmpty(); |
| case UML2Package.MESSAGE_END__OWNED_ELEMENT: |
| return !getOwnedElements().isEmpty(); |
| case UML2Package.MESSAGE_END__OWNER: |
| return basicGetOwner() != null; |
| case UML2Package.MESSAGE_END__OWNED_COMMENT: |
| return ownedComment != null && !ownedComment.isEmpty(); |
| case UML2Package.MESSAGE_END__TEMPLATE_BINDING: |
| return templateBinding != null && !templateBinding.isEmpty(); |
| case UML2Package.MESSAGE_END__OWNED_TEMPLATE_SIGNATURE: |
| return ownedTemplateSignature != null; |
| case UML2Package.MESSAGE_END__NAME: |
| return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); |
| case UML2Package.MESSAGE_END__QUALIFIED_NAME: |
| return QUALIFIED_NAME_EDEFAULT == null ? getQualifiedName() != null : !QUALIFIED_NAME_EDEFAULT.equals(getQualifiedName()); |
| case UML2Package.MESSAGE_END__VISIBILITY: |
| return visibility != VISIBILITY_EDEFAULT; |
| case UML2Package.MESSAGE_END__CLIENT_DEPENDENCY: |
| return clientDependency != null && !clientDependency.isEmpty(); |
| case UML2Package.MESSAGE_END__NAME_EXPRESSION: |
| return nameExpression != null; |
| case UML2Package.MESSAGE_END__RECEIVE_MESSAGE: |
| return receiveMessage != null; |
| case UML2Package.MESSAGE_END__SEND_MESSAGE: |
| return sendMessage != null; |
| } |
| return eDynamicIsSet(eFeature); |
| } |
| |
| } //MessageEndImpl |