| /******************************************************************************* |
| * Copyright (c) 2012, 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 |
| *******************************************************************************/ |
| package org.eclipse.qvtd.xtext.qvtimperativecs.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.jdt.annotation.NonNull; |
| import org.eclipse.ocl.xtext.basecs.impl.NamedElementCSImpl; |
| import org.eclipse.ocl.xtext.basecs.util.BaseCSVisitor; |
| import org.eclipse.qvtd.xtext.qvtimperativecs.MappingCS; |
| import org.eclipse.qvtd.xtext.qvtimperativecs.MappingParameterCS; |
| import org.eclipse.qvtd.xtext.qvtimperativecs.QVTimperativeCSPackage; |
| import org.eclipse.qvtd.xtext.qvtimperativecs.StatementCS; |
| import org.eclipse.qvtd.xtext.qvtimperativecs.util.QVTimperativeCSVisitor; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Mapping CS</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.qvtd.xtext.qvtimperativecs.impl.MappingCSImpl#isIsStrict <em>Is Strict</em>}</li> |
| * <li>{@link org.eclipse.qvtd.xtext.qvtimperativecs.impl.MappingCSImpl#getOwnedParameters <em>Owned Parameters</em>}</li> |
| * <li>{@link org.eclipse.qvtd.xtext.qvtimperativecs.impl.MappingCSImpl#getOwnedStatements <em>Owned Statements</em>}</li> |
| * <li>{@link org.eclipse.qvtd.xtext.qvtimperativecs.impl.MappingCSImpl#getFirstPass <em>First Pass</em>}</li> |
| * <li>{@link org.eclipse.qvtd.xtext.qvtimperativecs.impl.MappingCSImpl#getLastPass <em>Last Pass</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class MappingCSImpl extends NamedElementCSImpl implements MappingCS { |
| /** |
| * The number of structural features of the '<em>Mapping CS</em>' class. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| * @ordered |
| */ |
| public static final int MAPPING_CS_FEATURE_COUNT = NamedElementCSImpl.NAMED_ELEMENT_CS_FEATURE_COUNT + 5; |
| /** |
| * The default value of the '{@link #isIsStrict() <em>Is Strict</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #isIsStrict() |
| * @generated |
| * @ordered |
| */ |
| protected static final boolean IS_STRICT_EDEFAULT = false; |
| /** |
| * The cached value of the '{@link #isIsStrict() <em>Is Strict</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #isIsStrict() |
| * @generated |
| * @ordered |
| */ |
| protected boolean isStrict = IS_STRICT_EDEFAULT; |
| /** |
| * The cached value of the '{@link #getOwnedParameters() <em>Owned Parameters</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getOwnedParameters() |
| * @generated |
| * @ordered |
| */ |
| protected EList<MappingParameterCS> ownedParameters; |
| /** |
| * The cached value of the '{@link #getOwnedStatements() <em>Owned Statements</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getOwnedStatements() |
| * @generated |
| * @ordered |
| */ |
| protected EList<StatementCS> ownedStatements; |
| /** |
| * The default value of the '{@link #getFirstPass() <em>First Pass</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getFirstPass() |
| * @generated |
| * @ordered |
| */ |
| protected static final Integer FIRST_PASS_EDEFAULT = null; |
| /** |
| * The cached value of the '{@link #getFirstPass() <em>First Pass</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getFirstPass() |
| * @generated |
| * @ordered |
| */ |
| protected Integer firstPass = FIRST_PASS_EDEFAULT; |
| /** |
| * The default value of the '{@link #getLastPass() <em>Last Pass</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getLastPass() |
| * @generated |
| * @ordered |
| */ |
| protected static final Integer LAST_PASS_EDEFAULT = null; |
| /** |
| * The cached value of the '{@link #getLastPass() <em>Last Pass</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getLastPass() |
| * @generated |
| * @ordered |
| */ |
| protected Integer lastPass = LAST_PASS_EDEFAULT; |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected MappingCSImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return QVTimperativeCSPackage.Literals.MAPPING_CS; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean isIsStrict() { |
| return isStrict; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setIsStrict(boolean newIsStrict) { |
| boolean oldIsStrict = isStrict; |
| isStrict = newIsStrict; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, NamedElementCSImpl.NAMED_ELEMENT_CS_FEATURE_COUNT + 0, oldIsStrict, isStrict)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public EList<MappingParameterCS> getOwnedParameters() { |
| if (ownedParameters == null) { |
| ownedParameters = new EObjectContainmentEList<MappingParameterCS>(MappingParameterCS.class, this, NamedElementCSImpl.NAMED_ELEMENT_CS_FEATURE_COUNT + 1); |
| } |
| return ownedParameters; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public EList<StatementCS> getOwnedStatements() { |
| if (ownedStatements == null) { |
| ownedStatements = new EObjectContainmentEList<StatementCS>(StatementCS.class, this, NamedElementCSImpl.NAMED_ELEMENT_CS_FEATURE_COUNT + 2); |
| } |
| return ownedStatements; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Integer getFirstPass() { |
| return firstPass; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setFirstPass(Integer newFirstPass) { |
| Integer oldFirstPass = firstPass; |
| firstPass = newFirstPass; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, NamedElementCSImpl.NAMED_ELEMENT_CS_FEATURE_COUNT + 3, oldFirstPass, firstPass)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Integer getLastPass() { |
| return lastPass; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setLastPass(Integer newLastPass) { |
| Integer oldLastPass = lastPass; |
| lastPass = newLastPass; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, NamedElementCSImpl.NAMED_ELEMENT_CS_FEATURE_COUNT + 4, oldLastPass, lastPass)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated NOT |
| */ |
| @Override |
| public String toString() { |
| return super.toString(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case NamedElementCSImpl.NAMED_ELEMENT_CS_FEATURE_COUNT + 1: |
| return ((InternalEList<?>)getOwnedParameters()).basicRemove(otherEnd, msgs); |
| case NamedElementCSImpl.NAMED_ELEMENT_CS_FEATURE_COUNT + 2: |
| return ((InternalEList<?>)getOwnedStatements()).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 NamedElementCSImpl.NAMED_ELEMENT_CS_FEATURE_COUNT + 0: |
| return isIsStrict(); |
| case NamedElementCSImpl.NAMED_ELEMENT_CS_FEATURE_COUNT + 1: |
| return getOwnedParameters(); |
| case NamedElementCSImpl.NAMED_ELEMENT_CS_FEATURE_COUNT + 2: |
| return getOwnedStatements(); |
| case NamedElementCSImpl.NAMED_ELEMENT_CS_FEATURE_COUNT + 3: |
| return getFirstPass(); |
| case NamedElementCSImpl.NAMED_ELEMENT_CS_FEATURE_COUNT + 4: |
| return getLastPass(); |
| } |
| 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 NamedElementCSImpl.NAMED_ELEMENT_CS_FEATURE_COUNT + 0: |
| setIsStrict((Boolean)newValue); |
| return; |
| case NamedElementCSImpl.NAMED_ELEMENT_CS_FEATURE_COUNT + 1: |
| getOwnedParameters().clear(); |
| getOwnedParameters().addAll((Collection<? extends MappingParameterCS>)newValue); |
| return; |
| case NamedElementCSImpl.NAMED_ELEMENT_CS_FEATURE_COUNT + 2: |
| getOwnedStatements().clear(); |
| getOwnedStatements().addAll((Collection<? extends StatementCS>)newValue); |
| return; |
| case NamedElementCSImpl.NAMED_ELEMENT_CS_FEATURE_COUNT + 3: |
| setFirstPass((Integer)newValue); |
| return; |
| case NamedElementCSImpl.NAMED_ELEMENT_CS_FEATURE_COUNT + 4: |
| setLastPass((Integer)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case NamedElementCSImpl.NAMED_ELEMENT_CS_FEATURE_COUNT + 0: |
| setIsStrict(IS_STRICT_EDEFAULT); |
| return; |
| case NamedElementCSImpl.NAMED_ELEMENT_CS_FEATURE_COUNT + 1: |
| getOwnedParameters().clear(); |
| return; |
| case NamedElementCSImpl.NAMED_ELEMENT_CS_FEATURE_COUNT + 2: |
| getOwnedStatements().clear(); |
| return; |
| case NamedElementCSImpl.NAMED_ELEMENT_CS_FEATURE_COUNT + 3: |
| setFirstPass(FIRST_PASS_EDEFAULT); |
| return; |
| case NamedElementCSImpl.NAMED_ELEMENT_CS_FEATURE_COUNT + 4: |
| setLastPass(LAST_PASS_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case NamedElementCSImpl.NAMED_ELEMENT_CS_FEATURE_COUNT + 0: |
| return isStrict != IS_STRICT_EDEFAULT; |
| case NamedElementCSImpl.NAMED_ELEMENT_CS_FEATURE_COUNT + 1: |
| return ownedParameters != null && !ownedParameters.isEmpty(); |
| case NamedElementCSImpl.NAMED_ELEMENT_CS_FEATURE_COUNT + 2: |
| return ownedStatements != null && !ownedStatements.isEmpty(); |
| case NamedElementCSImpl.NAMED_ELEMENT_CS_FEATURE_COUNT + 3: |
| return FIRST_PASS_EDEFAULT == null ? firstPass != null : !FIRST_PASS_EDEFAULT.equals(firstPass); |
| case NamedElementCSImpl.NAMED_ELEMENT_CS_FEATURE_COUNT + 4: |
| return LAST_PASS_EDEFAULT == null ? lastPass != null : !LAST_PASS_EDEFAULT.equals(lastPass); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @SuppressWarnings("unchecked") |
| @Override |
| public <R> R accept(@NonNull BaseCSVisitor<R> visitor) { |
| if (visitor instanceof QVTimperativeCSVisitor) { |
| return (R) ((QVTimperativeCSVisitor<?>)visitor).visitMappingCS(this); |
| } |
| else { |
| return super.accept(visitor); |
| } |
| } |
| } //MappingCSImpl |