| /** |
| * Copyright (c) 2011, 2016 - Lunifera GmbH (Gross Enzersdorf), Loetz GmbH&Co.KG (Heidelberg) |
| * 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 |
| * |
| * Based on ideas from Xtext, Xtend, Xcore |
| * |
| * Contributors: |
| * Florian Pirchner - Initial implementation |
| * |
| */ |
| package org.eclipse.osbp.dsl.semantic.entity.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.osbp.dsl.semantic.common.types.LFeature; |
| |
| import org.eclipse.osbp.dsl.semantic.common.types.impl.LLazyResolverImpl; |
| |
| import org.eclipse.osbp.dsl.semantic.entity.LNestedFeature; |
| import org.eclipse.osbp.dsl.semantic.entity.OSBPEntityPackage; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>LNested Feature</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.osbp.dsl.semantic.entity.impl.LNestedFeatureImpl#getFeature <em>Feature</em>}</li> |
| * <li>{@link org.eclipse.osbp.dsl.semantic.entity.impl.LNestedFeatureImpl#getTail <em>Tail</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class LNestedFeatureImpl extends LLazyResolverImpl implements LNestedFeature { |
| /** |
| * The cached value of the '{@link #getFeature() <em>Feature</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getFeature() |
| * @generated |
| * @ordered |
| */ |
| protected LFeature feature; |
| |
| /** |
| * The cached value of the '{@link #getTail() <em>Tail</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getTail() |
| * @generated |
| * @ordered |
| */ |
| protected LNestedFeature tail; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected LNestedFeatureImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return OSBPEntityPackage.Literals.LNESTED_FEATURE; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public LFeature getFeature() { |
| if (feature != null && feature.eIsProxy()) { |
| InternalEObject oldFeature = (InternalEObject)feature; |
| feature = (LFeature)eResolveProxy(oldFeature); |
| if (feature != oldFeature) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, OSBPEntityPackage.LNESTED_FEATURE__FEATURE, oldFeature, feature)); |
| } |
| } |
| return feature; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public LFeature basicGetFeature() { |
| return feature; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setFeature(LFeature newFeature) { |
| LFeature oldFeature = feature; |
| feature = newFeature; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, OSBPEntityPackage.LNESTED_FEATURE__FEATURE, oldFeature, feature)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public LNestedFeature getTail() { |
| return tail; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetTail(LNestedFeature newTail, NotificationChain msgs) { |
| LNestedFeature oldTail = tail; |
| tail = newTail; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, OSBPEntityPackage.LNESTED_FEATURE__TAIL, oldTail, newTail); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setTail(LNestedFeature newTail) { |
| if (newTail != tail) { |
| NotificationChain msgs = null; |
| if (tail != null) |
| msgs = ((InternalEObject)tail).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - OSBPEntityPackage.LNESTED_FEATURE__TAIL, null, msgs); |
| if (newTail != null) |
| msgs = ((InternalEObject)newTail).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - OSBPEntityPackage.LNESTED_FEATURE__TAIL, null, msgs); |
| msgs = basicSetTail(newTail, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, OSBPEntityPackage.LNESTED_FEATURE__TAIL, newTail, newTail)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case OSBPEntityPackage.LNESTED_FEATURE__TAIL: |
| return basicSetTail(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 OSBPEntityPackage.LNESTED_FEATURE__FEATURE: |
| if (resolve) return getFeature(); |
| return basicGetFeature(); |
| case OSBPEntityPackage.LNESTED_FEATURE__TAIL: |
| return getTail(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case OSBPEntityPackage.LNESTED_FEATURE__FEATURE: |
| setFeature((LFeature)newValue); |
| return; |
| case OSBPEntityPackage.LNESTED_FEATURE__TAIL: |
| setTail((LNestedFeature)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case OSBPEntityPackage.LNESTED_FEATURE__FEATURE: |
| setFeature((LFeature)null); |
| return; |
| case OSBPEntityPackage.LNESTED_FEATURE__TAIL: |
| setTail((LNestedFeature)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case OSBPEntityPackage.LNESTED_FEATURE__FEATURE: |
| return feature != null; |
| case OSBPEntityPackage.LNESTED_FEATURE__TAIL: |
| return tail != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| } //LNestedFeatureImpl |