| /** |
| * **************************************************************************** |
| * Copyright (c) 2020 CEA LIST. |
| * |
| * |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License 2.0 |
| * which accompanies this distribution, and is available at |
| * https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Contributors: |
| * Asma Smaoui (CEA LIST) asma.smaoui@cea.fr - Initial API and implementation |
| * |
| * **************************************************************************** |
| */ |
| package io.shell.admin.aas._1._0.impl; |
| |
| import io.shell.admin.aas._1._0.ReferenceT; |
| import io.shell.admin.aas._1._0.RelationshipElementT; |
| import io.shell.admin.aas._1._0._0Package; |
| |
| 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; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Relationship Element T</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link io.shell.admin.aas._1._0.impl.RelationshipElementTImpl#getFirst <em>First</em>}</li> |
| * <li>{@link io.shell.admin.aas._1._0.impl.RelationshipElementTImpl#getSecond <em>Second</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class RelationshipElementTImpl extends SubmodelElementAbstractTImpl implements RelationshipElementT { |
| /** |
| * The cached value of the '{@link #getFirst() <em>First</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getFirst() |
| * @generated |
| * @ordered |
| */ |
| protected ReferenceT first; |
| |
| /** |
| * The cached value of the '{@link #getSecond() <em>Second</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getSecond() |
| * @generated |
| * @ordered |
| */ |
| protected ReferenceT second; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected RelationshipElementTImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return _0Package.Literals.RELATIONSHIP_ELEMENT_T; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public ReferenceT getFirst() { |
| return first; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetFirst(ReferenceT newFirst, NotificationChain msgs) { |
| ReferenceT oldFirst = first; |
| first = newFirst; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, _0Package.RELATIONSHIP_ELEMENT_T__FIRST, oldFirst, newFirst); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setFirst(ReferenceT newFirst) { |
| if (newFirst != first) { |
| NotificationChain msgs = null; |
| if (first != null) |
| msgs = ((InternalEObject)first).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - _0Package.RELATIONSHIP_ELEMENT_T__FIRST, null, msgs); |
| if (newFirst != null) |
| msgs = ((InternalEObject)newFirst).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - _0Package.RELATIONSHIP_ELEMENT_T__FIRST, null, msgs); |
| msgs = basicSetFirst(newFirst, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, _0Package.RELATIONSHIP_ELEMENT_T__FIRST, newFirst, newFirst)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public ReferenceT getSecond() { |
| return second; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetSecond(ReferenceT newSecond, NotificationChain msgs) { |
| ReferenceT oldSecond = second; |
| second = newSecond; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, _0Package.RELATIONSHIP_ELEMENT_T__SECOND, oldSecond, newSecond); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setSecond(ReferenceT newSecond) { |
| if (newSecond != second) { |
| NotificationChain msgs = null; |
| if (second != null) |
| msgs = ((InternalEObject)second).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - _0Package.RELATIONSHIP_ELEMENT_T__SECOND, null, msgs); |
| if (newSecond != null) |
| msgs = ((InternalEObject)newSecond).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - _0Package.RELATIONSHIP_ELEMENT_T__SECOND, null, msgs); |
| msgs = basicSetSecond(newSecond, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, _0Package.RELATIONSHIP_ELEMENT_T__SECOND, newSecond, newSecond)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case _0Package.RELATIONSHIP_ELEMENT_T__FIRST: |
| return basicSetFirst(null, msgs); |
| case _0Package.RELATIONSHIP_ELEMENT_T__SECOND: |
| return basicSetSecond(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 _0Package.RELATIONSHIP_ELEMENT_T__FIRST: |
| return getFirst(); |
| case _0Package.RELATIONSHIP_ELEMENT_T__SECOND: |
| return getSecond(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case _0Package.RELATIONSHIP_ELEMENT_T__FIRST: |
| setFirst((ReferenceT)newValue); |
| return; |
| case _0Package.RELATIONSHIP_ELEMENT_T__SECOND: |
| setSecond((ReferenceT)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case _0Package.RELATIONSHIP_ELEMENT_T__FIRST: |
| setFirst((ReferenceT)null); |
| return; |
| case _0Package.RELATIONSHIP_ELEMENT_T__SECOND: |
| setSecond((ReferenceT)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case _0Package.RELATIONSHIP_ELEMENT_T__FIRST: |
| return first != null; |
| case _0Package.RELATIONSHIP_ELEMENT_T__SECOND: |
| return second != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| } //RelationshipElementTImpl |