| /******************************************************************************* |
| * Copyright (c) 2013, 2020 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.pivot.qvtimperative.impl; |
| |
| import java.lang.reflect.InvocationTargetException; |
| import java.util.Collection; |
| import java.util.Iterator; |
| import java.util.List; |
| import java.util.Map; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| import org.eclipse.emf.common.notify.NotificationChain; |
| import org.eclipse.emf.common.util.DiagnosticChain; |
| 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.EObjectContainmentWithInverseEList; |
| import org.eclipse.emf.ecore.util.InternalEList; |
| import org.eclipse.jdt.annotation.NonNull; |
| import org.eclipse.jdt.annotation.Nullable; |
| import org.eclipse.ocl.pivot.VariableDeclaration; |
| import org.eclipse.ocl.pivot.evaluation.Executor; |
| import org.eclipse.ocl.pivot.ids.IdResolver; |
| import org.eclipse.ocl.pivot.ids.TypeId; |
| import org.eclipse.ocl.pivot.internal.VariableDeclarationImpl; |
| import org.eclipse.ocl.pivot.library.collection.CollectionSelectByKindOperation; |
| import org.eclipse.ocl.pivot.library.collection.CollectionUnionOperation; |
| import org.eclipse.ocl.pivot.library.oclany.OclComparableLessThanEqualOperation; |
| import org.eclipse.ocl.pivot.library.string.CGStringGetSeverityOperation; |
| import org.eclipse.ocl.pivot.library.string.CGStringLogDiagnosticOperation; |
| import org.eclipse.ocl.pivot.util.Visitor; |
| import org.eclipse.ocl.pivot.utilities.PivotUtil; |
| import org.eclipse.ocl.pivot.utilities.ValueUtil; |
| import org.eclipse.ocl.pivot.values.IntegerValue; |
| import org.eclipse.ocl.pivot.values.OrderedSetValue; |
| import org.eclipse.ocl.pivot.values.SetValue; |
| import org.eclipse.ocl.pivot.values.SetValue.Accumulator; |
| import org.eclipse.qvtd.pivot.qvtbase.impl.RuleImpl; |
| import org.eclipse.qvtd.pivot.qvtimperative.Mapping; |
| import org.eclipse.qvtd.pivot.qvtimperative.MappingParameter; |
| import org.eclipse.qvtd.pivot.qvtimperative.QVTimperativePackage; |
| import org.eclipse.qvtd.pivot.qvtimperative.QVTimperativeTables; |
| import org.eclipse.qvtd.pivot.qvtimperative.Statement; |
| import org.eclipse.qvtd.pivot.qvtimperative.util.QVTimperativeVisitor; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Mapping</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.qvtd.pivot.qvtimperative.impl.MappingImpl#isIsStrict <em>Is Strict</em>}</li> |
| * <li>{@link org.eclipse.qvtd.pivot.qvtimperative.impl.MappingImpl#getOwnedMappingParameters <em>Owned Mapping Parameters</em>}</li> |
| * <li>{@link org.eclipse.qvtd.pivot.qvtimperative.impl.MappingImpl#getOwnedStatements <em>Owned Statements</em>}</li> |
| * <li>{@link org.eclipse.qvtd.pivot.qvtimperative.impl.MappingImpl#getFirstPass <em>First Pass</em>}</li> |
| * <li>{@link org.eclipse.qvtd.pivot.qvtimperative.impl.MappingImpl#getLastPass <em>Last Pass</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class MappingImpl extends RuleImpl implements Mapping { |
| /** |
| * The number of structural features of the '<em>Mapping</em>' class. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| * @ordered |
| */ |
| public static final int MAPPING_FEATURE_COUNT = RuleImpl.RULE_FEATURE_COUNT + 5; |
| |
| /** |
| * The number of operations of the '<em>Mapping</em>' class. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| * @ordered |
| */ |
| public static final int MAPPING_OPERATION_COUNT = RuleImpl.RULE_OPERATION_COUNT + 3; |
| |
| /** |
| * 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 #getOwnedMappingParameters() <em>Owned Mapping Parameters</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getOwnedMappingParameters() |
| * @generated |
| * @ordered |
| */ |
| protected EList<MappingParameter> ownedMappingParameters; |
| |
| /** |
| * 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<Statement> 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 MappingImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return QVTimperativePackage.Literals.MAPPING; |
| } |
| |
| /** |
| * <!-- 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, RuleImpl.RULE_FEATURE_COUNT + 0, oldIsStrict, isStrict)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public EList<MappingParameter> getOwnedMappingParameters() { |
| if (ownedMappingParameters == null) { |
| ownedMappingParameters = new EObjectContainmentWithInverseEList<MappingParameter>(MappingParameter.class, this, RuleImpl.RULE_FEATURE_COUNT + 1, VariableDeclarationImpl.VARIABLE_DECLARATION_FEATURE_COUNT + 0); |
| } |
| return ownedMappingParameters; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public EList<Statement> getOwnedStatements() { |
| if (ownedStatements == null) { |
| ownedStatements = new EObjectContainmentEList<Statement>(Statement.class, this, RuleImpl.RULE_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, RuleImpl.RULE_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, RuleImpl.RULE_FEATURE_COUNT + 4, oldLastPass, lastPass)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean validateNameIsNotNull(final DiagnosticChain diagnostics, final Map<Object, Object> context) { |
| final @NonNull String constraintName = "Mapping::NameIsNotNull"; |
| try { |
| /** |
| * |
| * inv NameIsNotNull: |
| * let severity : Integer[1] = constraintName.getSeverity() |
| * in |
| * if severity <= 0 |
| * then true |
| * else |
| * let result : Boolean[1] = name <> null |
| * in |
| * constraintName.logDiagnostic(self, null, diagnostics, context, null, severity, result, 0) |
| * endif |
| */ |
| final /*@NonInvalid*/ @NonNull Executor executor = PivotUtil.getExecutor(this); |
| final /*@NonInvalid*/ @NonNull IntegerValue severity_0 = CGStringGetSeverityOperation.INSTANCE.evaluate(executor, QVTimperativePackage.Literals.MAPPING___VALIDATE_NAME_IS_NOT_NULL__DIAGNOSTICCHAIN_MAP); |
| final /*@NonInvalid*/ boolean le = OclComparableLessThanEqualOperation.INSTANCE.evaluate(executor, severity_0, QVTimperativeTables.INT_0).booleanValue(); |
| /*@NonInvalid*/ boolean symbol_0; |
| if (le) { |
| symbol_0 = true; |
| } |
| else { |
| final /*@NonInvalid*/ @Nullable String name = this.getName(); |
| final /*@NonInvalid*/ boolean result = name != null; |
| final /*@NonInvalid*/ boolean logDiagnostic = CGStringLogDiagnosticOperation.INSTANCE.evaluate(executor, TypeId.BOOLEAN, constraintName, this, (Object)null, diagnostics, context, (Object)null, severity_0, result, QVTimperativeTables.INT_0).booleanValue(); |
| symbol_0 = logDiagnostic; |
| } |
| return symbol_0; |
| } |
| catch (Throwable e) { |
| return ValueUtil.validationFailedDiagnostic(constraintName, this, diagnostics, context, e); |
| } |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean validateMappingParameterNamesAreUnique(final DiagnosticChain diagnostics, final Map<Object, Object> context) { |
| final @NonNull String constraintName = "Mapping::MappingParameterNamesAreUnique"; |
| try { |
| /** |
| * |
| * inv MappingParameterNamesAreUnique: |
| * let severity : Integer[1] = constraintName.getSeverity() |
| * in |
| * if severity <= 0 |
| * then true |
| * else |
| * let result : Boolean[1] = ownedMappingParameters->isUnique(name) |
| * in |
| * constraintName.logDiagnostic(self, null, diagnostics, context, null, severity, result, 0) |
| * endif |
| */ |
| final /*@NonInvalid*/ @NonNull Executor executor = PivotUtil.getExecutor(this); |
| final /*@NonInvalid*/ @NonNull IdResolver idResolver = executor.getIdResolver(); |
| final /*@NonInvalid*/ @NonNull IntegerValue severity_0 = CGStringGetSeverityOperation.INSTANCE.evaluate(executor, QVTimperativePackage.Literals.MAPPING___VALIDATE_MAPPING_PARAMETER_NAMES_ARE_UNIQUE__DIAGNOSTICCHAIN_MAP); |
| final /*@NonInvalid*/ boolean le = OclComparableLessThanEqualOperation.INSTANCE.evaluate(executor, severity_0, QVTimperativeTables.INT_0).booleanValue(); |
| /*@NonInvalid*/ boolean symbol_0; |
| if (le) { |
| symbol_0 = true; |
| } |
| else { |
| /*@Caught*/ @NonNull Object CAUGHT_result; |
| try { |
| @SuppressWarnings("null") |
| final /*@NonInvalid*/ @NonNull List<MappingParameter> ownedMappingParameters = this.getOwnedMappingParameters(); |
| final /*@NonInvalid*/ @NonNull SetValue BOXED_ownedMappingParameters = idResolver.createSetOfAll(QVTimperativeTables.SET_CLSSid_MappingParameter, ownedMappingParameters); |
| /*@Thrown*/ @NonNull Accumulator accumulator = ValueUtil.createSetAccumulatorValue(QVTimperativeTables.SET_CLSSid_MappingParameter); |
| @NonNull Iterator<Object> ITERATOR__1 = BOXED_ownedMappingParameters.iterator(); |
| /*@Thrown*/ boolean result; |
| while (true) { |
| if (!ITERATOR__1.hasNext()) { |
| result = true; |
| break; |
| } |
| @SuppressWarnings("null") |
| /*@NonInvalid*/ @NonNull MappingParameter _1 = (@NonNull MappingParameter)ITERATOR__1.next(); |
| /** |
| * name |
| */ |
| final /*@NonInvalid*/ @Nullable String name = _1.getName(); |
| // |
| if (accumulator.includes(name) == ValueUtil.TRUE_VALUE) { |
| result = false; |
| break; // Abort after second find |
| } |
| else { |
| accumulator.add(name); |
| } |
| } |
| CAUGHT_result = result; |
| } |
| catch (Exception e) { |
| CAUGHT_result = ValueUtil.createInvalidValue(e); |
| } |
| final /*@NonInvalid*/ boolean logDiagnostic = CGStringLogDiagnosticOperation.INSTANCE.evaluate(executor, TypeId.BOOLEAN, constraintName, this, (Object)null, diagnostics, context, (Object)null, severity_0, CAUGHT_result, QVTimperativeTables.INT_0).booleanValue(); |
| symbol_0 = logDiagnostic; |
| } |
| return symbol_0; |
| } |
| catch (Throwable e) { |
| return ValueUtil.validationFailedDiagnostic(constraintName, this, diagnostics, context, e); |
| } |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean validateLocalVariableNamesAreUnique(final DiagnosticChain diagnostics, final Map<Object, Object> context) { |
| final @NonNull String constraintName = "Mapping::LocalVariableNamesAreUnique"; |
| try { |
| /** |
| * |
| * inv LocalVariableNamesAreUnique: |
| * let severity : Integer[1] = constraintName.getSeverity() |
| * in |
| * if severity <= 0 |
| * then true |
| * else |
| * let |
| * result : Boolean[1] = ownedMappingParameters->union( |
| * ownedStatements->selectByKind(VariableStatement)) |
| * ->isUnique(name) |
| * in |
| * constraintName.logDiagnostic(self, null, diagnostics, context, null, severity, result, 0) |
| * endif |
| */ |
| final /*@NonInvalid*/ @NonNull Executor executor = PivotUtil.getExecutor(this); |
| final /*@NonInvalid*/ @NonNull IdResolver idResolver = executor.getIdResolver(); |
| final /*@NonInvalid*/ @NonNull IntegerValue severity_0 = CGStringGetSeverityOperation.INSTANCE.evaluate(executor, QVTimperativePackage.Literals.MAPPING___VALIDATE_LOCAL_VARIABLE_NAMES_ARE_UNIQUE__DIAGNOSTICCHAIN_MAP); |
| final /*@NonInvalid*/ boolean le = OclComparableLessThanEqualOperation.INSTANCE.evaluate(executor, severity_0, QVTimperativeTables.INT_0).booleanValue(); |
| /*@NonInvalid*/ boolean symbol_1; |
| if (le) { |
| symbol_1 = true; |
| } |
| else { |
| /*@Caught*/ @NonNull Object CAUGHT_result; |
| try { |
| final /*@NonInvalid*/ org.eclipse.ocl.pivot.@NonNull Class TYP_qvtimperative_c_c_VariableStatement = idResolver.getClass(QVTimperativeTables.CLSSid_VariableStatement, null); |
| @SuppressWarnings("null") |
| final /*@NonInvalid*/ @NonNull List<MappingParameter> ownedMappingParameters = this.getOwnedMappingParameters(); |
| final /*@NonInvalid*/ @NonNull SetValue BOXED_ownedMappingParameters = idResolver.createSetOfAll(QVTimperativeTables.SET_CLSSid_MappingParameter, ownedMappingParameters); |
| @SuppressWarnings("null") |
| final /*@NonInvalid*/ @NonNull List<Statement> ownedStatements = this.getOwnedStatements(); |
| final /*@NonInvalid*/ @NonNull OrderedSetValue BOXED_ownedStatements = idResolver.createOrderedSetOfAll(QVTimperativeTables.ORD_CLSSid_Statement, ownedStatements); |
| final /*@NonInvalid*/ org.eclipse.ocl.pivot.@NonNull Class symbol_0 = (org.eclipse.ocl.pivot.Class)TYP_qvtimperative_c_c_VariableStatement; |
| final /*@NonInvalid*/ @NonNull OrderedSetValue selectByKind = (@Nullable OrderedSetValue)CollectionSelectByKindOperation.INSTANCE.evaluate(executor, BOXED_ownedStatements, symbol_0); |
| final /*@NonInvalid*/ @NonNull SetValue union = (@Nullable SetValue)CollectionUnionOperation.INSTANCE.evaluate(BOXED_ownedMappingParameters, selectByKind); |
| /*@Thrown*/ @NonNull Accumulator accumulator = ValueUtil.createSetAccumulatorValue(QVTimperativeTables.SET_CLSSid_VariableDeclaration); |
| @NonNull Iterator<Object> ITERATOR__1 = union.iterator(); |
| /*@Thrown*/ boolean result; |
| while (true) { |
| if (!ITERATOR__1.hasNext()) { |
| result = true; |
| break; |
| } |
| @SuppressWarnings("null") |
| /*@NonInvalid*/ @NonNull VariableDeclaration _1 = (@NonNull VariableDeclaration)ITERATOR__1.next(); |
| /** |
| * name |
| */ |
| final /*@NonInvalid*/ @Nullable String name = _1.getName(); |
| // |
| if (accumulator.includes(name) == ValueUtil.TRUE_VALUE) { |
| result = false; |
| break; // Abort after second find |
| } |
| else { |
| accumulator.add(name); |
| } |
| } |
| CAUGHT_result = result; |
| } |
| catch (Exception e) { |
| CAUGHT_result = ValueUtil.createInvalidValue(e); |
| } |
| final /*@NonInvalid*/ boolean logDiagnostic = CGStringLogDiagnosticOperation.INSTANCE.evaluate(executor, TypeId.BOOLEAN, constraintName, this, (Object)null, diagnostics, context, (Object)null, severity_0, CAUGHT_result, QVTimperativeTables.INT_0).booleanValue(); |
| symbol_1 = logDiagnostic; |
| } |
| return symbol_1; |
| } |
| catch (Throwable e) { |
| return ValueUtil.validationFailedDiagnostic(constraintName, this, diagnostics, context, e); |
| } |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @SuppressWarnings("unchecked") |
| @Override |
| public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case RuleImpl.RULE_FEATURE_COUNT + 1: |
| return ((InternalEList<InternalEObject>)(InternalEList<?>)getOwnedMappingParameters()).basicAdd(otherEnd, msgs); |
| } |
| return super.eInverseAdd(otherEnd, featureID, msgs); |
| } |
| |
| /** |
| * <!-- 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 RuleImpl.RULE_FEATURE_COUNT + 1: |
| return ((InternalEList<?>)getOwnedMappingParameters()).basicRemove(otherEnd, msgs); |
| case RuleImpl.RULE_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 RuleImpl.RULE_FEATURE_COUNT + 0: |
| return isIsStrict(); |
| case RuleImpl.RULE_FEATURE_COUNT + 1: |
| return getOwnedMappingParameters(); |
| case RuleImpl.RULE_FEATURE_COUNT + 2: |
| return getOwnedStatements(); |
| case RuleImpl.RULE_FEATURE_COUNT + 3: |
| return getFirstPass(); |
| case RuleImpl.RULE_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 RuleImpl.RULE_FEATURE_COUNT + 0: |
| setIsStrict((Boolean)newValue); |
| return; |
| case RuleImpl.RULE_FEATURE_COUNT + 1: |
| getOwnedMappingParameters().clear(); |
| getOwnedMappingParameters().addAll((Collection<? extends MappingParameter>)newValue); |
| return; |
| case RuleImpl.RULE_FEATURE_COUNT + 2: |
| getOwnedStatements().clear(); |
| getOwnedStatements().addAll((Collection<? extends Statement>)newValue); |
| return; |
| case RuleImpl.RULE_FEATURE_COUNT + 3: |
| setFirstPass((Integer)newValue); |
| return; |
| case RuleImpl.RULE_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 RuleImpl.RULE_FEATURE_COUNT + 0: |
| setIsStrict(IS_STRICT_EDEFAULT); |
| return; |
| case RuleImpl.RULE_FEATURE_COUNT + 1: |
| getOwnedMappingParameters().clear(); |
| return; |
| case RuleImpl.RULE_FEATURE_COUNT + 2: |
| getOwnedStatements().clear(); |
| return; |
| case RuleImpl.RULE_FEATURE_COUNT + 3: |
| setFirstPass(FIRST_PASS_EDEFAULT); |
| return; |
| case RuleImpl.RULE_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 RuleImpl.RULE_FEATURE_COUNT + 0: |
| return isStrict != IS_STRICT_EDEFAULT; |
| case RuleImpl.RULE_FEATURE_COUNT + 1: |
| return ownedMappingParameters != null && !ownedMappingParameters.isEmpty(); |
| case RuleImpl.RULE_FEATURE_COUNT + 2: |
| return ownedStatements != null && !ownedStatements.isEmpty(); |
| case RuleImpl.RULE_FEATURE_COUNT + 3: |
| return FIRST_PASS_EDEFAULT == null ? firstPass != null : !FIRST_PASS_EDEFAULT.equals(firstPass); |
| case RuleImpl.RULE_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 |
| */ |
| @Override |
| @SuppressWarnings("unchecked") |
| public Object eInvoke(int operationID, EList<?> arguments) throws InvocationTargetException { |
| switch (operationID) { |
| case RuleImpl.RULE_OPERATION_COUNT + 0: |
| return validateNameIsNotNull((DiagnosticChain)arguments.get(0), (Map<Object, Object>)arguments.get(1)); |
| case RuleImpl.RULE_OPERATION_COUNT + 1: |
| return validateMappingParameterNamesAreUnique((DiagnosticChain)arguments.get(0), (Map<Object, Object>)arguments.get(1)); |
| case RuleImpl.RULE_OPERATION_COUNT + 2: |
| return validateLocalVariableNamesAreUnique((DiagnosticChain)arguments.get(0), (Map<Object, Object>)arguments.get(1)); |
| } |
| return super.eInvoke(operationID, arguments); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @SuppressWarnings("unchecked") |
| @Override |
| public <R> R accept(@NonNull Visitor<R> visitor) { |
| if (visitor instanceof QVTimperativeVisitor) { |
| return (R) ((QVTimperativeVisitor<?>)visitor).visitMapping(this); |
| } |
| else { |
| return super.accept(visitor); |
| } |
| } |
| |
| @Override |
| public void setIsAbstract(boolean newIsAbstract) { |
| assert !newIsAbstract; // QVTi does not use abstract mappings |
| super.setIsAbstract(newIsAbstract); |
| } |
| } //MappingImpl |