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

org.eclipse.uml2.uml.internal.impl.ConnectableElementTemplateParameterImpl Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (c) 2005, 2014 IBM Corporation, CEA, 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
 *   Kenn Hussey (CEA) - 212765, 418466
 *
 */
package org.eclipse.uml2.uml.internal.impl;

import java.util.Collection;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EAnnotation;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.resource.Resource;

import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.uml2.uml.Comment;
import org.eclipse.uml2.uml.ConnectableElement;
import org.eclipse.uml2.uml.ConnectableElementTemplateParameter;
import org.eclipse.uml2.uml.ParameterableElement;
import org.eclipse.uml2.uml.TemplateSignature;
import org.eclipse.uml2.uml.UMLPackage;

/**
 * 
 * An implementation of the model object 'Connectable Element Template Parameter'.
 * 
 * 

* The following features are implemented: *

    *
  • {@link org.eclipse.uml2.uml.internal.impl.ConnectableElementTemplateParameterImpl#getParameteredElement Parametered Element}
  • *
*

* * @generated */ public class ConnectableElementTemplateParameterImpl extends TemplateParameterImpl implements ConnectableElementTemplateParameter { /** * * * @generated */ protected ConnectableElementTemplateParameterImpl() { super(); } /** * * * @generated */ @Override protected EClass eStaticClass() { return UMLPackage.Literals.CONNECTABLE_ELEMENT_TEMPLATE_PARAMETER; } /** * * * @generated */ @Override public ParameterableElement getParameteredElement() { if (parameteredElement != null && parameteredElement.eIsProxy()) { InternalEObject oldParameteredElement = (InternalEObject) parameteredElement; parameteredElement = (ParameterableElement) eResolveProxy(oldParameteredElement); if (parameteredElement != oldParameteredElement) { if (eNotificationRequired()) eNotify(new ENotificationImpl( this, Notification.RESOLVE, UMLPackage.CONNECTABLE_ELEMENT_TEMPLATE_PARAMETER__PARAMETERED_ELEMENT, oldParameteredElement, parameteredElement)); } } return parameteredElement; } /** * * * @generated */ @Override public ParameterableElement basicGetParameteredElement() { return parameteredElement; } /** * * * @generated */ public NotificationChain basicSetParameteredElementGen( ParameterableElement newParameteredElement, NotificationChain msgs) { if (newParameteredElement != null && !(newParameteredElement instanceof ConnectableElement)) { throw new IllegalArgumentException( "newParameteredElement must be an instance of ConnectableElement"); //$NON-NLS-1$ } ParameterableElement oldParameteredElement = parameteredElement; parameteredElement = newParameteredElement; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl( this, Notification.SET, UMLPackage.CONNECTABLE_ELEMENT_TEMPLATE_PARAMETER__PARAMETERED_ELEMENT, oldParameteredElement, newParameteredElement); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } @Override public NotificationChain basicSetParameteredElement( ParameterableElement newParameteredElement, NotificationChain msgs) { msgs = basicSetParameteredElementGen(newParameteredElement, msgs); Resource.Internal eInternalResource = eInternalResource(); if (eInternalResource == null || !eInternalResource.isLoading()) { if (ownedParameteredElement != null && ownedParameteredElement != newParameteredElement) { setOwnedParameteredElement(null); } } return msgs; } /** * * * @generated */ @Override public void setParameteredElement(ParameterableElement newParameteredElement) { if (newParameteredElement != null && !(newParameteredElement instanceof ConnectableElement)) { throw new IllegalArgumentException( "newParameteredElement must be an instance of ConnectableElement"); //$NON-NLS-1$ } if (newParameteredElement != parameteredElement) { NotificationChain msgs = null; if (parameteredElement != null) msgs = ((InternalEObject) parameteredElement).eInverseRemove( this, UMLPackage.PARAMETERABLE_ELEMENT__TEMPLATE_PARAMETER, ParameterableElement.class, msgs); if (newParameteredElement != null) msgs = ((InternalEObject) newParameteredElement).eInverseAdd( this, UMLPackage.PARAMETERABLE_ELEMENT__TEMPLATE_PARAMETER, ParameterableElement.class, msgs); msgs = basicSetParameteredElement(newParameteredElement, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl( this, Notification.SET, UMLPackage.CONNECTABLE_ELEMENT_TEMPLATE_PARAMETER__PARAMETERED_ELEMENT, newParameteredElement, newParameteredElement)); } /** * * * @generated */ public boolean isSetParameteredElement() { return parameteredElement != null; } /** * * * @generated */ @SuppressWarnings("unchecked") @Override public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case UMLPackage.CONNECTABLE_ELEMENT_TEMPLATE_PARAMETER__EANNOTATIONS : return ((InternalEList) (InternalEList) getEAnnotations()) .basicAdd(otherEnd, msgs); case UMLPackage.CONNECTABLE_ELEMENT_TEMPLATE_PARAMETER__PARAMETERED_ELEMENT : if (parameteredElement != null) msgs = ((InternalEObject) parameteredElement) .eInverseRemove( this, UMLPackage.PARAMETERABLE_ELEMENT__TEMPLATE_PARAMETER, ParameterableElement.class, msgs); return basicSetParameteredElement( (ParameterableElement) otherEnd, msgs); case UMLPackage.CONNECTABLE_ELEMENT_TEMPLATE_PARAMETER__SIGNATURE : if (eInternalContainer() != null) msgs = eBasicRemoveFromContainer(msgs); return basicSetSignature((TemplateSignature) otherEnd, msgs); case UMLPackage.CONNECTABLE_ELEMENT_TEMPLATE_PARAMETER__OWNED_PARAMETERED_ELEMENT : if (ownedParameteredElement != null) msgs = ((InternalEObject) ownedParameteredElement) .eInverseRemove( this, EOPPOSITE_FEATURE_BASE - UMLPackage.CONNECTABLE_ELEMENT_TEMPLATE_PARAMETER__OWNED_PARAMETERED_ELEMENT, null, msgs); return basicSetOwnedParameteredElement( (ParameterableElement) otherEnd, msgs); } return eDynamicInverseAdd(otherEnd, featureID, msgs); } /** * * * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case UMLPackage.CONNECTABLE_ELEMENT_TEMPLATE_PARAMETER__EANNOTATIONS : return ((InternalEList) getEAnnotations()).basicRemove( otherEnd, msgs); case UMLPackage.CONNECTABLE_ELEMENT_TEMPLATE_PARAMETER__OWNED_COMMENT : return ((InternalEList) getOwnedComments()).basicRemove( otherEnd, msgs); case UMLPackage.CONNECTABLE_ELEMENT_TEMPLATE_PARAMETER__OWNED_DEFAULT : return basicSetOwnedDefault(null, msgs); case UMLPackage.CONNECTABLE_ELEMENT_TEMPLATE_PARAMETER__PARAMETERED_ELEMENT : return basicSetParameteredElement(null, msgs); case UMLPackage.CONNECTABLE_ELEMENT_TEMPLATE_PARAMETER__SIGNATURE : return basicSetSignature(null, msgs); case UMLPackage.CONNECTABLE_ELEMENT_TEMPLATE_PARAMETER__OWNED_PARAMETERED_ELEMENT : return basicSetOwnedParameteredElement(null, msgs); } return eDynamicInverseRemove(otherEnd, featureID, msgs); } /** * * * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case UMLPackage.CONNECTABLE_ELEMENT_TEMPLATE_PARAMETER__EANNOTATIONS : return getEAnnotations(); case UMLPackage.CONNECTABLE_ELEMENT_TEMPLATE_PARAMETER__OWNED_COMMENT : return getOwnedComments(); case UMLPackage.CONNECTABLE_ELEMENT_TEMPLATE_PARAMETER__OWNED_ELEMENT : return getOwnedElements(); case UMLPackage.CONNECTABLE_ELEMENT_TEMPLATE_PARAMETER__OWNER : if (resolve) return getOwner(); return basicGetOwner(); case UMLPackage.CONNECTABLE_ELEMENT_TEMPLATE_PARAMETER__DEFAULT : if (resolve) return getDefault(); return basicGetDefault(); case UMLPackage.CONNECTABLE_ELEMENT_TEMPLATE_PARAMETER__OWNED_DEFAULT : if (resolve) return getOwnedDefault(); return basicGetOwnedDefault(); case UMLPackage.CONNECTABLE_ELEMENT_TEMPLATE_PARAMETER__PARAMETERED_ELEMENT : if (resolve) return getParameteredElement(); return basicGetParameteredElement(); case UMLPackage.CONNECTABLE_ELEMENT_TEMPLATE_PARAMETER__SIGNATURE : if (resolve) return getSignature(); return basicGetSignature(); case UMLPackage.CONNECTABLE_ELEMENT_TEMPLATE_PARAMETER__OWNED_PARAMETERED_ELEMENT : if (resolve) return getOwnedParameteredElement(); return basicGetOwnedParameteredElement(); } return eDynamicGet(featureID, resolve, coreType); } /** * * * @generated */ @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case UMLPackage.CONNECTABLE_ELEMENT_TEMPLATE_PARAMETER__EANNOTATIONS : getEAnnotations().clear(); getEAnnotations().addAll( (Collection) newValue); return; case UMLPackage.CONNECTABLE_ELEMENT_TEMPLATE_PARAMETER__OWNED_COMMENT : getOwnedComments().clear(); getOwnedComments().addAll( (Collection) newValue); return; case UMLPackage.CONNECTABLE_ELEMENT_TEMPLATE_PARAMETER__DEFAULT : setDefault((ParameterableElement) newValue); return; case UMLPackage.CONNECTABLE_ELEMENT_TEMPLATE_PARAMETER__OWNED_DEFAULT : setOwnedDefault((ParameterableElement) newValue); return; case UMLPackage.CONNECTABLE_ELEMENT_TEMPLATE_PARAMETER__PARAMETERED_ELEMENT : setParameteredElement((ParameterableElement) newValue); return; case UMLPackage.CONNECTABLE_ELEMENT_TEMPLATE_PARAMETER__SIGNATURE : setSignature((TemplateSignature) newValue); return; case UMLPackage.CONNECTABLE_ELEMENT_TEMPLATE_PARAMETER__OWNED_PARAMETERED_ELEMENT : setOwnedParameteredElement((ParameterableElement) newValue); return; } eDynamicSet(featureID, newValue); } /** * * * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case UMLPackage.CONNECTABLE_ELEMENT_TEMPLATE_PARAMETER__EANNOTATIONS : getEAnnotations().clear(); return; case UMLPackage.CONNECTABLE_ELEMENT_TEMPLATE_PARAMETER__OWNED_COMMENT : getOwnedComments().clear(); return; case UMLPackage.CONNECTABLE_ELEMENT_TEMPLATE_PARAMETER__DEFAULT : setDefault((ParameterableElement) null); return; case UMLPackage.CONNECTABLE_ELEMENT_TEMPLATE_PARAMETER__OWNED_DEFAULT : setOwnedDefault((ParameterableElement) null); return; case UMLPackage.CONNECTABLE_ELEMENT_TEMPLATE_PARAMETER__PARAMETERED_ELEMENT : setParameteredElement((ParameterableElement) null); return; case UMLPackage.CONNECTABLE_ELEMENT_TEMPLATE_PARAMETER__SIGNATURE : setSignature((TemplateSignature) null); return; case UMLPackage.CONNECTABLE_ELEMENT_TEMPLATE_PARAMETER__OWNED_PARAMETERED_ELEMENT : setOwnedParameteredElement((ParameterableElement) null); return; } eDynamicUnset(featureID); } /** * * * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case UMLPackage.CONNECTABLE_ELEMENT_TEMPLATE_PARAMETER__EANNOTATIONS : return eAnnotations != null && !eAnnotations.isEmpty(); case UMLPackage.CONNECTABLE_ELEMENT_TEMPLATE_PARAMETER__OWNED_COMMENT : return ownedComments != null && !ownedComments.isEmpty(); case UMLPackage.CONNECTABLE_ELEMENT_TEMPLATE_PARAMETER__OWNED_ELEMENT : return isSetOwnedElements(); case UMLPackage.CONNECTABLE_ELEMENT_TEMPLATE_PARAMETER__OWNER : return isSetOwner(); case UMLPackage.CONNECTABLE_ELEMENT_TEMPLATE_PARAMETER__DEFAULT : return default_ != null; case UMLPackage.CONNECTABLE_ELEMENT_TEMPLATE_PARAMETER__OWNED_DEFAULT : return ownedDefault != null; case UMLPackage.CONNECTABLE_ELEMENT_TEMPLATE_PARAMETER__PARAMETERED_ELEMENT : return isSetParameteredElement(); case UMLPackage.CONNECTABLE_ELEMENT_TEMPLATE_PARAMETER__SIGNATURE : return basicGetSignature() != null; case UMLPackage.CONNECTABLE_ELEMENT_TEMPLATE_PARAMETER__OWNED_PARAMETERED_ELEMENT : return ownedParameteredElement != null; } return eDynamicIsSet(featureID); } } //ConnectableElementTemplateParameterImpl




© 2015 - 2024 Weber Informatics LLC | Privacy Policy