| /** |
| * Copyright (c) 2011, 2015 - 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 |
| * |
| * Contributors: |
| * Florian Pirchner - Initial implementation |
| * |
| * generated by Xtext 2.11.0 |
| |
| */ |
| package org.eclipse.xtext.example.domainmodel.domainmodel.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.util.EObjectContainmentEList; |
| import org.eclipse.emf.ecore.util.InternalEList; |
| |
| import org.eclipse.xtext.common.types.JvmParameterizedTypeReference; |
| |
| import org.eclipse.xtext.example.domainmodel.domainmodel.DomainmodelPackage; |
| import org.eclipse.xtext.example.domainmodel.domainmodel.Entity; |
| import org.eclipse.xtext.example.domainmodel.domainmodel.Feature; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Entity</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.xtext.example.domainmodel.domainmodel.impl.EntityImpl#getSuperType <em>Super Type</em>}</li> |
| * <li>{@link org.eclipse.xtext.example.domainmodel.domainmodel.impl.EntityImpl#getFeatures <em>Features</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class EntityImpl extends AbstractElementImpl implements Entity |
| { |
| /** |
| * The cached value of the '{@link #getSuperType() <em>Super Type</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getSuperType() |
| * @generated |
| * @ordered |
| */ |
| protected JvmParameterizedTypeReference superType; |
| |
| /** |
| * The cached value of the '{@link #getFeatures() <em>Features</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getFeatures() |
| * @generated |
| * @ordered |
| */ |
| protected EList<Feature> features; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected EntityImpl() |
| { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() |
| { |
| return DomainmodelPackage.Literals.ENTITY; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public JvmParameterizedTypeReference getSuperType() |
| { |
| return superType; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetSuperType(JvmParameterizedTypeReference newSuperType, NotificationChain msgs) |
| { |
| JvmParameterizedTypeReference oldSuperType = superType; |
| superType = newSuperType; |
| if (eNotificationRequired()) |
| { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DomainmodelPackage.ENTITY__SUPER_TYPE, oldSuperType, newSuperType); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setSuperType(JvmParameterizedTypeReference newSuperType) |
| { |
| if (newSuperType != superType) |
| { |
| NotificationChain msgs = null; |
| if (superType != null) |
| msgs = ((InternalEObject)superType).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DomainmodelPackage.ENTITY__SUPER_TYPE, null, msgs); |
| if (newSuperType != null) |
| msgs = ((InternalEObject)newSuperType).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DomainmodelPackage.ENTITY__SUPER_TYPE, null, msgs); |
| msgs = basicSetSuperType(newSuperType, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, DomainmodelPackage.ENTITY__SUPER_TYPE, newSuperType, newSuperType)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<Feature> getFeatures() |
| { |
| if (features == null) |
| { |
| features = new EObjectContainmentEList<Feature>(Feature.class, this, DomainmodelPackage.ENTITY__FEATURES); |
| } |
| return features; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) |
| { |
| switch (featureID) |
| { |
| case DomainmodelPackage.ENTITY__SUPER_TYPE: |
| return basicSetSuperType(null, msgs); |
| case DomainmodelPackage.ENTITY__FEATURES: |
| return ((InternalEList<?>)getFeatures()).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 DomainmodelPackage.ENTITY__SUPER_TYPE: |
| return getSuperType(); |
| case DomainmodelPackage.ENTITY__FEATURES: |
| return getFeatures(); |
| } |
| 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 DomainmodelPackage.ENTITY__SUPER_TYPE: |
| setSuperType((JvmParameterizedTypeReference)newValue); |
| return; |
| case DomainmodelPackage.ENTITY__FEATURES: |
| getFeatures().clear(); |
| getFeatures().addAll((Collection<? extends Feature>)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) |
| { |
| switch (featureID) |
| { |
| case DomainmodelPackage.ENTITY__SUPER_TYPE: |
| setSuperType((JvmParameterizedTypeReference)null); |
| return; |
| case DomainmodelPackage.ENTITY__FEATURES: |
| getFeatures().clear(); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) |
| { |
| switch (featureID) |
| { |
| case DomainmodelPackage.ENTITY__SUPER_TYPE: |
| return superType != null; |
| case DomainmodelPackage.ENTITY__FEATURES: |
| return features != null && !features.isEmpty(); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| } //EntityImpl |