| /** |
| * * Copyright (c) 2006-2010 Istvan Rath and Daniel Varro |
| * * 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: |
| * * Istvan Rath, Daniel Varro - initial API and implementation |
| * |
| */ |
| package org.eclipse.viatra2.gtasmmodel.vpm.editmodel.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.util.EcoreUtil; |
| |
| import org.eclipse.viatra2.gtasmmodel.vpm.editmodel.EditmodelPackage; |
| import org.eclipse.viatra2.gtasmmodel.vpm.editmodel.ModelElement; |
| import org.eclipse.viatra2.gtasmmodel.vpm.editmodel.Relationship; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Relationship</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.viatra2.gtasmmodel.vpm.editmodel.impl.RelationshipImpl#getClientStr <em>Client Str</em>}</li> |
| * <li>{@link org.eclipse.viatra2.gtasmmodel.vpm.editmodel.impl.RelationshipImpl#getSupplierStr <em>Supplier Str</em>}</li> |
| * <li>{@link org.eclipse.viatra2.gtasmmodel.vpm.editmodel.impl.RelationshipImpl#getClient <em>Client</em>}</li> |
| * <li>{@link org.eclipse.viatra2.gtasmmodel.vpm.editmodel.impl.RelationshipImpl#getSupplier <em>Supplier</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public abstract class RelationshipImpl extends VPMElementImpl implements Relationship |
| { |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public static final String copyright = " * Copyright (c) 2006-2010 Istvan Rath and Daniel Varro\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http://www.eclipse.org/legal/epl-v10.html\r\n *\r\n * Contributors:\r\n * Istvan Rath, Daniel Varro - initial API and implementation\r\n"; |
| |
| /** |
| * The default value of the '{@link #getClientStr() <em>Client Str</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getClientStr() |
| * @generated |
| * @ordered |
| */ |
| protected static final String CLIENT_STR_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getClientStr() <em>Client Str</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getClientStr() |
| * @generated |
| * @ordered |
| */ |
| protected String clientStr = CLIENT_STR_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #getSupplierStr() <em>Supplier Str</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getSupplierStr() |
| * @generated |
| * @ordered |
| */ |
| protected static final String SUPPLIER_STR_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getSupplierStr() <em>Supplier Str</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getSupplierStr() |
| * @generated |
| * @ordered |
| */ |
| protected String supplierStr = SUPPLIER_STR_EDEFAULT; |
| |
| /** |
| * The cached value of the '{@link #getSupplier() <em>Supplier</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getSupplier() |
| * @generated |
| * @ordered |
| */ |
| protected ModelElement supplier; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected RelationshipImpl() |
| { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() |
| { |
| return EditmodelPackage.Literals.RELATIONSHIP; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getClientStr() |
| { |
| return clientStr; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setClientStr(String newClientStr) |
| { |
| String oldClientStr = clientStr; |
| clientStr = newClientStr; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, EditmodelPackage.RELATIONSHIP__CLIENT_STR, oldClientStr, clientStr)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getSupplierStr() |
| { |
| return supplierStr; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setSupplierStr(String newSupplierStr) |
| { |
| String oldSupplierStr = supplierStr; |
| supplierStr = newSupplierStr; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, EditmodelPackage.RELATIONSHIP__SUPPLIER_STR, oldSupplierStr, supplierStr)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public ModelElement getClient() |
| { |
| if (eContainerFeatureID() != EditmodelPackage.RELATIONSHIP__CLIENT) return null; |
| return (ModelElement)eContainer(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetClient(ModelElement newClient, NotificationChain msgs) |
| { |
| msgs = eBasicSetContainer((InternalEObject)newClient, EditmodelPackage.RELATIONSHIP__CLIENT, msgs); |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setClient(ModelElement newClient) |
| { |
| if (newClient != eInternalContainer() || (eContainerFeatureID() != EditmodelPackage.RELATIONSHIP__CLIENT && newClient != null)) |
| { |
| if (EcoreUtil.isAncestor(this, newClient)) |
| throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); |
| NotificationChain msgs = null; |
| if (eInternalContainer() != null) |
| msgs = eBasicRemoveFromContainer(msgs); |
| if (newClient != null) |
| msgs = ((InternalEObject)newClient).eInverseAdd(this, EditmodelPackage.MODEL_ELEMENT__SUPER_RELATIONSHIPS, ModelElement.class, msgs); |
| msgs = basicSetClient(newClient, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, EditmodelPackage.RELATIONSHIP__CLIENT, newClient, newClient)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public ModelElement getSupplier() |
| { |
| if (supplier != null && supplier.eIsProxy()) |
| { |
| InternalEObject oldSupplier = (InternalEObject)supplier; |
| supplier = (ModelElement)eResolveProxy(oldSupplier); |
| if (supplier != oldSupplier) |
| { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, EditmodelPackage.RELATIONSHIP__SUPPLIER, oldSupplier, supplier)); |
| } |
| } |
| return supplier; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public ModelElement basicGetSupplier() |
| { |
| return supplier; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetSupplier(ModelElement newSupplier, NotificationChain msgs) |
| { |
| ModelElement oldSupplier = supplier; |
| supplier = newSupplier; |
| if (eNotificationRequired()) |
| { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, EditmodelPackage.RELATIONSHIP__SUPPLIER, oldSupplier, newSupplier); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setSupplier(ModelElement newSupplier) |
| { |
| if (newSupplier != supplier) |
| { |
| NotificationChain msgs = null; |
| if (supplier != null) |
| msgs = ((InternalEObject)supplier).eInverseRemove(this, EditmodelPackage.MODEL_ELEMENT__SUB_RELATIONSHIPS, ModelElement.class, msgs); |
| if (newSupplier != null) |
| msgs = ((InternalEObject)newSupplier).eInverseAdd(this, EditmodelPackage.MODEL_ELEMENT__SUB_RELATIONSHIPS, ModelElement.class, msgs); |
| msgs = basicSetSupplier(newSupplier, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, EditmodelPackage.RELATIONSHIP__SUPPLIER, newSupplier, newSupplier)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) |
| { |
| switch (featureID) |
| { |
| case EditmodelPackage.RELATIONSHIP__CLIENT: |
| if (eInternalContainer() != null) |
| msgs = eBasicRemoveFromContainer(msgs); |
| return basicSetClient((ModelElement)otherEnd, msgs); |
| case EditmodelPackage.RELATIONSHIP__SUPPLIER: |
| if (supplier != null) |
| msgs = ((InternalEObject)supplier).eInverseRemove(this, EditmodelPackage.MODEL_ELEMENT__SUB_RELATIONSHIPS, ModelElement.class, msgs); |
| return basicSetSupplier((ModelElement)otherEnd, msgs); |
| } |
| return super.eInverseAdd(otherEnd, featureID, msgs); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) |
| { |
| switch (featureID) |
| { |
| case EditmodelPackage.RELATIONSHIP__CLIENT: |
| return basicSetClient(null, msgs); |
| case EditmodelPackage.RELATIONSHIP__SUPPLIER: |
| return basicSetSupplier(null, msgs); |
| } |
| return super.eInverseRemove(otherEnd, featureID, msgs); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) |
| { |
| switch (eContainerFeatureID()) |
| { |
| case EditmodelPackage.RELATIONSHIP__CLIENT: |
| return eInternalContainer().eInverseRemove(this, EditmodelPackage.MODEL_ELEMENT__SUPER_RELATIONSHIPS, ModelElement.class, msgs); |
| } |
| return super.eBasicRemoveFromContainerFeature(msgs); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) |
| { |
| switch (featureID) |
| { |
| case EditmodelPackage.RELATIONSHIP__CLIENT_STR: |
| return getClientStr(); |
| case EditmodelPackage.RELATIONSHIP__SUPPLIER_STR: |
| return getSupplierStr(); |
| case EditmodelPackage.RELATIONSHIP__CLIENT: |
| return getClient(); |
| case EditmodelPackage.RELATIONSHIP__SUPPLIER: |
| if (resolve) return getSupplier(); |
| return basicGetSupplier(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) |
| { |
| switch (featureID) |
| { |
| case EditmodelPackage.RELATIONSHIP__CLIENT_STR: |
| setClientStr((String)newValue); |
| return; |
| case EditmodelPackage.RELATIONSHIP__SUPPLIER_STR: |
| setSupplierStr((String)newValue); |
| return; |
| case EditmodelPackage.RELATIONSHIP__CLIENT: |
| setClient((ModelElement)newValue); |
| return; |
| case EditmodelPackage.RELATIONSHIP__SUPPLIER: |
| setSupplier((ModelElement)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) |
| { |
| switch (featureID) |
| { |
| case EditmodelPackage.RELATIONSHIP__CLIENT_STR: |
| setClientStr(CLIENT_STR_EDEFAULT); |
| return; |
| case EditmodelPackage.RELATIONSHIP__SUPPLIER_STR: |
| setSupplierStr(SUPPLIER_STR_EDEFAULT); |
| return; |
| case EditmodelPackage.RELATIONSHIP__CLIENT: |
| setClient((ModelElement)null); |
| return; |
| case EditmodelPackage.RELATIONSHIP__SUPPLIER: |
| setSupplier((ModelElement)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) |
| { |
| switch (featureID) |
| { |
| case EditmodelPackage.RELATIONSHIP__CLIENT_STR: |
| return CLIENT_STR_EDEFAULT == null ? clientStr != null : !CLIENT_STR_EDEFAULT.equals(clientStr); |
| case EditmodelPackage.RELATIONSHIP__SUPPLIER_STR: |
| return SUPPLIER_STR_EDEFAULT == null ? supplierStr != null : !SUPPLIER_STR_EDEFAULT.equals(supplierStr); |
| case EditmodelPackage.RELATIONSHIP__CLIENT: |
| return getClient() != null; |
| case EditmodelPackage.RELATIONSHIP__SUPPLIER: |
| return supplier != 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(" (clientStr: "); |
| result.append(clientStr); |
| result.append(", supplierStr: "); |
| result.append(supplierStr); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //RelationshipImpl |