| /** |
| * Copyright (c) 2014 Fraunhofer FOKUS |
| * 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: |
| * Max Bureck |
| * Marc-Florian Wendland |
| */ |
| package org.eclipse.upr.depl.components.impl; |
| |
| import java.util.Collection; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| import org.eclipse.emf.common.notify.NotificationChain; |
| |
| 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.impl.EObjectImpl; |
| |
| import org.eclipse.emf.ecore.util.EObjectContainmentEList; |
| import org.eclipse.emf.ecore.util.EObjectResolvingEList; |
| import org.eclipse.emf.ecore.util.InternalEList; |
| |
| import org.eclipse.upr.depl.components.Component; |
| import org.eclipse.upr.depl.components.ComponentImplementation; |
| import org.eclipse.upr.depl.components.ComponentsPackage; |
| import org.eclipse.upr.depl.components.Port; |
| import org.eclipse.upr.depl.components.Property; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Component</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.upr.depl.components.impl.ComponentImpl#getBase_Component <em>Base Component</em>}</li> |
| * <li>{@link org.eclipse.upr.depl.components.impl.ComponentImpl#getOwnedPort <em>Owned Port</em>}</li> |
| * <li>{@link org.eclipse.upr.depl.components.impl.ComponentImpl#getLabel <em>Label</em>}</li> |
| * <li>{@link org.eclipse.upr.depl.components.impl.ComponentImpl#getUUID <em>UUID</em>}</li> |
| * <li>{@link org.eclipse.upr.depl.components.impl.ComponentImpl#getImplementation <em>Implementation</em>}</li> |
| * <li>{@link org.eclipse.upr.depl.components.impl.ComponentImpl#getConfigProperty <em>Config Property</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class ComponentImpl extends EObjectImpl implements Component { |
| /** |
| * The cached value of the '{@link #getBase_Component() <em>Base Component</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getBase_Component() |
| * @generated |
| * @ordered |
| */ |
| protected org.eclipse.uml2.uml.Component base_Component; |
| |
| /** |
| * The cached value of the '{@link #getOwnedPort() <em>Owned Port</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getOwnedPort() |
| * @generated |
| * @ordered |
| */ |
| protected EList<Port> ownedPort; |
| |
| /** |
| * The default value of the '{@link #getLabel() <em>Label</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getLabel() |
| * @generated |
| * @ordered |
| */ |
| protected static final String LABEL_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getLabel() <em>Label</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getLabel() |
| * @generated |
| * @ordered |
| */ |
| protected String label = LABEL_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #getUUID() <em>UUID</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getUUID() |
| * @generated |
| * @ordered |
| */ |
| protected static final String UUID_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getUUID() <em>UUID</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getUUID() |
| * @generated |
| * @ordered |
| */ |
| protected String uuid = UUID_EDEFAULT; |
| |
| /** |
| * The cached value of the '{@link #getImplementation() <em>Implementation</em>}' reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getImplementation() |
| * @generated |
| * @ordered |
| */ |
| protected EList<ComponentImplementation> implementation; |
| |
| /** |
| * The cached value of the '{@link #getConfigProperty() <em>Config Property</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getConfigProperty() |
| * @generated |
| * @ordered |
| */ |
| protected EList<Property> configProperty; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected ComponentImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return ComponentsPackage.Literals.COMPONENT; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public org.eclipse.uml2.uml.Component getBase_Component() { |
| if (base_Component != null && base_Component.eIsProxy()) { |
| InternalEObject oldBase_Component = (InternalEObject)base_Component; |
| base_Component = (org.eclipse.uml2.uml.Component)eResolveProxy(oldBase_Component); |
| if (base_Component != oldBase_Component) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, ComponentsPackage.COMPONENT__BASE_COMPONENT, oldBase_Component, base_Component)); |
| } |
| } |
| return base_Component; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public org.eclipse.uml2.uml.Component basicGetBase_Component() { |
| return base_Component; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setBase_Component(org.eclipse.uml2.uml.Component newBase_Component) { |
| org.eclipse.uml2.uml.Component oldBase_Component = base_Component; |
| base_Component = newBase_Component; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ComponentsPackage.COMPONENT__BASE_COMPONENT, oldBase_Component, base_Component)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<Port> getOwnedPort() { |
| if (ownedPort == null) { |
| ownedPort = new EObjectContainmentEList<Port>(Port.class, this, ComponentsPackage.COMPONENT__OWNED_PORT); |
| } |
| return ownedPort; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getLabel() { |
| return label; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setLabel(String newLabel) { |
| String oldLabel = label; |
| label = newLabel; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ComponentsPackage.COMPONENT__LABEL, oldLabel, label)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getUUID() { |
| return uuid; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setUUID(String newUUID) { |
| String oldUUID = uuid; |
| uuid = newUUID; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ComponentsPackage.COMPONENT__UUID, oldUUID, uuid)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<ComponentImplementation> getImplementation() { |
| if (implementation == null) { |
| implementation = new EObjectResolvingEList<ComponentImplementation>(ComponentImplementation.class, this, ComponentsPackage.COMPONENT__IMPLEMENTATION); |
| } |
| return implementation; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<Property> getConfigProperty() { |
| if (configProperty == null) { |
| configProperty = new EObjectContainmentEList<Property>(Property.class, this, ComponentsPackage.COMPONENT__CONFIG_PROPERTY); |
| } |
| return configProperty; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case ComponentsPackage.COMPONENT__OWNED_PORT: |
| return ((InternalEList<?>)getOwnedPort()).basicRemove(otherEnd, msgs); |
| case ComponentsPackage.COMPONENT__CONFIG_PROPERTY: |
| return ((InternalEList<?>)getConfigProperty()).basicRemove(otherEnd, 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 ComponentsPackage.COMPONENT__BASE_COMPONENT: |
| if (resolve) return getBase_Component(); |
| return basicGetBase_Component(); |
| case ComponentsPackage.COMPONENT__OWNED_PORT: |
| return getOwnedPort(); |
| case ComponentsPackage.COMPONENT__LABEL: |
| return getLabel(); |
| case ComponentsPackage.COMPONENT__UUID: |
| return getUUID(); |
| case ComponentsPackage.COMPONENT__IMPLEMENTATION: |
| return getImplementation(); |
| case ComponentsPackage.COMPONENT__CONFIG_PROPERTY: |
| return getConfigProperty(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @SuppressWarnings("unchecked") |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case ComponentsPackage.COMPONENT__BASE_COMPONENT: |
| setBase_Component((org.eclipse.uml2.uml.Component)newValue); |
| return; |
| case ComponentsPackage.COMPONENT__OWNED_PORT: |
| getOwnedPort().clear(); |
| getOwnedPort().addAll((Collection<? extends Port>)newValue); |
| return; |
| case ComponentsPackage.COMPONENT__LABEL: |
| setLabel((String)newValue); |
| return; |
| case ComponentsPackage.COMPONENT__UUID: |
| setUUID((String)newValue); |
| return; |
| case ComponentsPackage.COMPONENT__IMPLEMENTATION: |
| getImplementation().clear(); |
| getImplementation().addAll((Collection<? extends ComponentImplementation>)newValue); |
| return; |
| case ComponentsPackage.COMPONENT__CONFIG_PROPERTY: |
| getConfigProperty().clear(); |
| getConfigProperty().addAll((Collection<? extends Property>)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case ComponentsPackage.COMPONENT__BASE_COMPONENT: |
| setBase_Component((org.eclipse.uml2.uml.Component)null); |
| return; |
| case ComponentsPackage.COMPONENT__OWNED_PORT: |
| getOwnedPort().clear(); |
| return; |
| case ComponentsPackage.COMPONENT__LABEL: |
| setLabel(LABEL_EDEFAULT); |
| return; |
| case ComponentsPackage.COMPONENT__UUID: |
| setUUID(UUID_EDEFAULT); |
| return; |
| case ComponentsPackage.COMPONENT__IMPLEMENTATION: |
| getImplementation().clear(); |
| return; |
| case ComponentsPackage.COMPONENT__CONFIG_PROPERTY: |
| getConfigProperty().clear(); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case ComponentsPackage.COMPONENT__BASE_COMPONENT: |
| return base_Component != null; |
| case ComponentsPackage.COMPONENT__OWNED_PORT: |
| return ownedPort != null && !ownedPort.isEmpty(); |
| case ComponentsPackage.COMPONENT__LABEL: |
| return LABEL_EDEFAULT == null ? label != null : !LABEL_EDEFAULT.equals(label); |
| case ComponentsPackage.COMPONENT__UUID: |
| return UUID_EDEFAULT == null ? uuid != null : !UUID_EDEFAULT.equals(uuid); |
| case ComponentsPackage.COMPONENT__IMPLEMENTATION: |
| return implementation != null && !implementation.isEmpty(); |
| case ComponentsPackage.COMPONENT__CONFIG_PROPERTY: |
| return configProperty != null && !configProperty.isEmpty(); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public String toString() { |
| if (eIsProxy()) return super.toString(); |
| |
| StringBuffer result = new StringBuffer(super.toString()); |
| result.append(" (label: "); |
| result.append(label); |
| result.append(", UUID: "); |
| result.append(uuid); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //ComponentImpl |