| /** |
| * 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 org.eclipse.emf.common.notify.Notification; |
| import org.eclipse.emf.common.notify.NotificationChain; |
| |
| 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.upr.depl.components.ComponentsPackage; |
| import org.eclipse.upr.depl.components.Property; |
| import org.eclipse.upr.depl.components.Requirement; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Requirement</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.upr.depl.components.impl.RequirementImpl#getResourceType <em>Resource Type</em>}</li> |
| * <li>{@link org.eclipse.upr.depl.components.impl.RequirementImpl#getProperties <em>Properties</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class RequirementImpl extends EObjectImpl implements Requirement { |
| /** |
| * The default value of the '{@link #getResourceType() <em>Resource Type</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getResourceType() |
| * @generated |
| * @ordered |
| */ |
| protected static final String RESOURCE_TYPE_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getResourceType() <em>Resource Type</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getResourceType() |
| * @generated |
| * @ordered |
| */ |
| protected String resourceType = RESOURCE_TYPE_EDEFAULT; |
| |
| /** |
| * The cached value of the '{@link #getProperties() <em>Properties</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getProperties() |
| * @generated |
| * @ordered |
| */ |
| protected Property properties; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected RequirementImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return ComponentsPackage.Literals.REQUIREMENT; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getResourceType() { |
| return resourceType; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setResourceType(String newResourceType) { |
| String oldResourceType = resourceType; |
| resourceType = newResourceType; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ComponentsPackage.REQUIREMENT__RESOURCE_TYPE, oldResourceType, resourceType)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Property getProperties() { |
| return properties; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetProperties(Property newProperties, NotificationChain msgs) { |
| Property oldProperties = properties; |
| properties = newProperties; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ComponentsPackage.REQUIREMENT__PROPERTIES, oldProperties, newProperties); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setProperties(Property newProperties) { |
| if (newProperties != properties) { |
| NotificationChain msgs = null; |
| if (properties != null) |
| msgs = ((InternalEObject)properties).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ComponentsPackage.REQUIREMENT__PROPERTIES, null, msgs); |
| if (newProperties != null) |
| msgs = ((InternalEObject)newProperties).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ComponentsPackage.REQUIREMENT__PROPERTIES, null, msgs); |
| msgs = basicSetProperties(newProperties, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ComponentsPackage.REQUIREMENT__PROPERTIES, newProperties, newProperties)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case ComponentsPackage.REQUIREMENT__PROPERTIES: |
| return basicSetProperties(null, 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.REQUIREMENT__RESOURCE_TYPE: |
| return getResourceType(); |
| case ComponentsPackage.REQUIREMENT__PROPERTIES: |
| return getProperties(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case ComponentsPackage.REQUIREMENT__RESOURCE_TYPE: |
| setResourceType((String)newValue); |
| return; |
| case ComponentsPackage.REQUIREMENT__PROPERTIES: |
| setProperties((Property)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case ComponentsPackage.REQUIREMENT__RESOURCE_TYPE: |
| setResourceType(RESOURCE_TYPE_EDEFAULT); |
| return; |
| case ComponentsPackage.REQUIREMENT__PROPERTIES: |
| setProperties((Property)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case ComponentsPackage.REQUIREMENT__RESOURCE_TYPE: |
| return RESOURCE_TYPE_EDEFAULT == null ? resourceType != null : !RESOURCE_TYPE_EDEFAULT.equals(resourceType); |
| case ComponentsPackage.REQUIREMENT__PROPERTIES: |
| return properties != null; |
| } |
| 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(" (resourceType: "); |
| result.append(resourceType); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //RequirementImpl |