| /** |
| * <copyright> |
| * |
| * Copyright (c) 2013, 2019 Willink Transformations and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v2.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v20.html |
| * |
| * Contributors: |
| * E.D.Willink - Initial API and implementation |
| * |
| * </copyright> |
| */ |
| package org.eclipse.qvtd.pivot.qvtcore.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.jdt.annotation.NonNull; |
| |
| import org.eclipse.ocl.pivot.internal.ElementImpl; |
| import org.eclipse.ocl.pivot.util.Visitor; |
| |
| import org.eclipse.qvtd.pivot.qvtbase.impl.DomainImpl; |
| |
| import org.eclipse.qvtd.pivot.qvtbase.impl.PatternImpl; |
| import org.eclipse.qvtd.pivot.qvtcore.Area; |
| import org.eclipse.qvtd.pivot.qvtcore.BottomPattern; |
| import org.eclipse.qvtd.pivot.qvtcore.CoreDomain; |
| import org.eclipse.qvtd.pivot.qvtcore.GuardPattern; |
| import org.eclipse.qvtd.pivot.qvtcore.QVTcorePackage; |
| |
| import org.eclipse.qvtd.pivot.qvtcore.util.QVTcoreVisitor; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Core Domain</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.qvtd.pivot.qvtcore.impl.CoreDomainImpl#getGuardPattern <em>Guard Pattern</em>}</li> |
| * <li>{@link org.eclipse.qvtd.pivot.qvtcore.impl.CoreDomainImpl#getBottomPattern <em>Bottom Pattern</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class CoreDomainImpl extends DomainImpl implements CoreDomain { |
| /** |
| * The number of structural features of the '<em>Core Domain</em>' class. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| * @ordered |
| */ |
| public static final int CORE_DOMAIN_FEATURE_COUNT = DomainImpl.DOMAIN_FEATURE_COUNT + 2; |
| |
| /** |
| * The number of operations of the '<em>Core Domain</em>' class. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| * @ordered |
| */ |
| public static final int CORE_DOMAIN_OPERATION_COUNT = DomainImpl.DOMAIN_OPERATION_COUNT + 0; |
| |
| /** |
| * The cached value of the '{@link #getGuardPattern() <em>Guard Pattern</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getGuardPattern() |
| * @generated |
| * @ordered |
| */ |
| protected GuardPattern guardPattern; |
| |
| /** |
| * The cached value of the '{@link #getBottomPattern() <em>Bottom Pattern</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getBottomPattern() |
| * @generated |
| * @ordered |
| */ |
| protected BottomPattern bottomPattern; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected CoreDomainImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return QVTcorePackage.Literals.CORE_DOMAIN; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public GuardPattern getGuardPattern() { |
| return guardPattern; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetGuardPattern(GuardPattern newGuardPattern, NotificationChain msgs) { |
| GuardPattern oldGuardPattern = guardPattern; |
| guardPattern = newGuardPattern; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DomainImpl.DOMAIN_FEATURE_COUNT + 0, oldGuardPattern, newGuardPattern); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setGuardPattern(GuardPattern newGuardPattern) { |
| if (newGuardPattern != guardPattern) { |
| NotificationChain msgs = null; |
| if (guardPattern != null) |
| msgs = ((InternalEObject)guardPattern).eInverseRemove(this, PatternImpl.PATTERN_FEATURE_COUNT + 1, GuardPattern.class, msgs); |
| if (newGuardPattern != null) |
| msgs = ((InternalEObject)newGuardPattern).eInverseAdd(this, PatternImpl.PATTERN_FEATURE_COUNT + 1, GuardPattern.class, msgs); |
| msgs = basicSetGuardPattern(newGuardPattern, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, DomainImpl.DOMAIN_FEATURE_COUNT + 0, newGuardPattern, newGuardPattern)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public BottomPattern getBottomPattern() { |
| return bottomPattern; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetBottomPattern(BottomPattern newBottomPattern, NotificationChain msgs) { |
| BottomPattern oldBottomPattern = bottomPattern; |
| bottomPattern = newBottomPattern; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DomainImpl.DOMAIN_FEATURE_COUNT + 1, oldBottomPattern, newBottomPattern); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setBottomPattern(BottomPattern newBottomPattern) { |
| if (newBottomPattern != bottomPattern) { |
| NotificationChain msgs = null; |
| if (bottomPattern != null) |
| msgs = ((InternalEObject)bottomPattern).eInverseRemove(this, PatternImpl.PATTERN_FEATURE_COUNT + 1, BottomPattern.class, msgs); |
| if (newBottomPattern != null) |
| msgs = ((InternalEObject)newBottomPattern).eInverseAdd(this, PatternImpl.PATTERN_FEATURE_COUNT + 1, BottomPattern.class, msgs); |
| msgs = basicSetBottomPattern(newBottomPattern, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, DomainImpl.DOMAIN_FEATURE_COUNT + 1, newBottomPattern, newBottomPattern)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case DomainImpl.DOMAIN_FEATURE_COUNT + 0: |
| if (guardPattern != null) |
| msgs = ((InternalEObject)guardPattern).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - (DomainImpl.DOMAIN_FEATURE_COUNT + 0), null, msgs); |
| return basicSetGuardPattern((GuardPattern)otherEnd, msgs); |
| case DomainImpl.DOMAIN_FEATURE_COUNT + 1: |
| if (bottomPattern != null) |
| msgs = ((InternalEObject)bottomPattern).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - (DomainImpl.DOMAIN_FEATURE_COUNT + 1), null, msgs); |
| return basicSetBottomPattern((BottomPattern)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 DomainImpl.DOMAIN_FEATURE_COUNT + 0: |
| return basicSetGuardPattern(null, msgs); |
| case DomainImpl.DOMAIN_FEATURE_COUNT + 1: |
| return basicSetBottomPattern(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 DomainImpl.DOMAIN_FEATURE_COUNT + 0: |
| return getGuardPattern(); |
| case DomainImpl.DOMAIN_FEATURE_COUNT + 1: |
| return getBottomPattern(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case DomainImpl.DOMAIN_FEATURE_COUNT + 0: |
| setGuardPattern((GuardPattern)newValue); |
| return; |
| case DomainImpl.DOMAIN_FEATURE_COUNT + 1: |
| setBottomPattern((BottomPattern)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case DomainImpl.DOMAIN_FEATURE_COUNT + 0: |
| setGuardPattern((GuardPattern)null); |
| return; |
| case DomainImpl.DOMAIN_FEATURE_COUNT + 1: |
| setBottomPattern((BottomPattern)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case DomainImpl.DOMAIN_FEATURE_COUNT + 0: |
| return guardPattern != null; |
| case DomainImpl.DOMAIN_FEATURE_COUNT + 1: |
| return bottomPattern != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) { |
| if (baseClass == Area.class) { |
| switch (derivedFeatureID) { |
| case DomainImpl.DOMAIN_FEATURE_COUNT + 0: return ElementImpl.ELEMENT_FEATURE_COUNT + 0; |
| case DomainImpl.DOMAIN_FEATURE_COUNT + 1: return ElementImpl.ELEMENT_FEATURE_COUNT + 1; |
| default: return -1; |
| } |
| } |
| return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) { |
| if (baseClass == Area.class) { |
| switch (baseFeatureID) { |
| case ElementImpl.ELEMENT_FEATURE_COUNT + 0: return DomainImpl.DOMAIN_FEATURE_COUNT + 0; |
| case ElementImpl.ELEMENT_FEATURE_COUNT + 1: return DomainImpl.DOMAIN_FEATURE_COUNT + 1; |
| default: return -1; |
| } |
| } |
| return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass); |
| } |
| |
| /** |
| * {@inheritDoc} |
| * @generated |
| */ |
| @SuppressWarnings("unchecked") |
| @Override |
| public <R> R accept(@NonNull Visitor<R> visitor) { |
| return (R) ((QVTcoreVisitor<?>)visitor).visitCoreDomain(this); |
| } |
| |
| } //CoreDomainImpl |