| /******************************************************************************* |
| * Copyright (c) 2010, 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.ocl.pivot.internal; |
| |
| import java.lang.reflect.InvocationTargetException; |
| import java.util.Collection; |
| 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.InternalEList; |
| import org.eclipse.jdt.annotation.NonNull; |
| import org.eclipse.jdt.annotation.Nullable; |
| import org.eclipse.ocl.pivot.CallExp; |
| import org.eclipse.ocl.pivot.CollectionType; |
| import org.eclipse.ocl.pivot.Comment; |
| import org.eclipse.ocl.pivot.Element; |
| import org.eclipse.ocl.pivot.ElementExtension; |
| import org.eclipse.ocl.pivot.OCLExpression; |
| import org.eclipse.ocl.pivot.PivotPackage; |
| import org.eclipse.ocl.pivot.PivotTables; |
| import org.eclipse.ocl.pivot.Type; |
| import org.eclipse.ocl.pivot.ValueSpecification; |
| 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.library.oclany.OclAnyOclAsTypeOperation; |
| import org.eclipse.ocl.pivot.library.oclany.OclAnyOclIsKindOfOperation; |
| 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.InvalidValueException; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Call Exp</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.ocl.pivot.internal.CallExpImpl#isIsImplicit <em>Is Implicit</em>}</li> |
| * <li>{@link org.eclipse.ocl.pivot.internal.CallExpImpl#isIsSafe <em>Is Safe</em>}</li> |
| * <li>{@link org.eclipse.ocl.pivot.internal.CallExpImpl#getOwnedSource <em>Owned Source</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public abstract class CallExpImpl |
| extends OCLExpressionImpl |
| implements CallExp { |
| |
| /** |
| * The number of structural features of the '<em>Call Exp</em>' class. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| * @ordered |
| */ |
| public static final int CALL_EXP_FEATURE_COUNT = OCLExpressionImpl.OCL_EXPRESSION_FEATURE_COUNT + 3; |
| /** |
| * The number of operations of the '<em>Call Exp</em>' class. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| * @ordered |
| */ |
| public static final int CALL_EXP_OPERATION_COUNT = OCLExpressionImpl.OCL_EXPRESSION_OPERATION_COUNT + 3; |
| /** |
| * The default value of the '{@link #isIsImplicit() <em>Is Implicit</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #isIsImplicit() |
| * @generated |
| * @ordered |
| */ |
| protected static final boolean IS_IMPLICIT_EDEFAULT = false; |
| /** |
| * The flag representing the value of the '{@link #isIsImplicit() <em>Is Implicit</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #isIsImplicit() |
| * @generated |
| * @ordered |
| */ |
| protected static final int IS_IMPLICIT_EFLAG = 1 << 9; |
| /** |
| * The default value of the '{@link #isIsSafe() <em>Is Safe</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #isIsSafe() |
| * @generated |
| * @ordered |
| */ |
| protected static final boolean IS_SAFE_EDEFAULT = false; |
| /** |
| * The flag representing the value of the '{@link #isIsSafe() <em>Is Safe</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #isIsSafe() |
| * @generated |
| * @ordered |
| */ |
| protected static final int IS_SAFE_EFLAG = 1 << 10; |
| /** |
| * The cached value of the '{@link #getOwnedSource() <em>Owned Source</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getOwnedSource() |
| * @generated |
| * @ordered |
| */ |
| protected OCLExpression ownedSource; |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected CallExpImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return PivotPackage.Literals.CALL_EXP; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean isIsImplicit() |
| { |
| return (eFlags & IS_IMPLICIT_EFLAG) != 0; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public OCLExpression getOwnedSource() { |
| return ownedSource; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetOwnedSource(OCLExpression newOwnedSource, NotificationChain msgs) |
| { |
| OCLExpression oldOwnedSource = ownedSource; |
| ownedSource = newOwnedSource; |
| if (eNotificationRequired()) |
| { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, 11, oldOwnedSource, newOwnedSource); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setOwnedSource(OCLExpression newOwnedSource) { |
| if (newOwnedSource != ownedSource) |
| { |
| NotificationChain msgs = null; |
| if (ownedSource != null) |
| msgs = ((InternalEObject)ownedSource).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - (11), null, msgs); |
| if (newOwnedSource != null) |
| msgs = ((InternalEObject)newOwnedSource).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - (11), null, msgs); |
| msgs = basicSetOwnedSource(newOwnedSource, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, 11, newOwnedSource, newOwnedSource)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean validateSafeSourceCanBeNull(final DiagnosticChain diagnostics, final Map<Object, Object> context) |
| { |
| final @NonNull String constraintName = "CallExp::SafeSourceCanBeNull"; |
| try { |
| /** |
| * |
| * inv SafeSourceCanBeNull: |
| * let severity : Integer[1] = constraintName.getSeverity() |
| * in |
| * if severity <= 0 |
| * then true |
| * else |
| * let result : Boolean[?] = isSafe implies |
| * not ownedSource?.type.oclAsType(CollectionType).isNullFree |
| * in |
| * constraintName.logDiagnostic(self, null, diagnostics, context, null, severity, result, 0) |
| * endif |
| */ |
| final /*@NonInvalid*/ @NonNull Executor executor = PivotUtil.getExecutor(this, context); |
| final /*@NonInvalid*/ @NonNull IdResolver idResolver = executor.getIdResolver(); |
| final /*@NonInvalid*/ @NonNull IntegerValue severity_0 = CGStringGetSeverityOperation.INSTANCE.evaluate(executor, PivotPackage.Literals.CALL_EXP___VALIDATE_SAFE_SOURCE_CAN_BE_NULL__DIAGNOSTICCHAIN_MAP); |
| final /*@NonInvalid*/ boolean le = OclComparableLessThanEqualOperation.INSTANCE.evaluate(executor, severity_0, PivotTables.INT_0).booleanValue(); |
| /*@NonInvalid*/ boolean symbol_0; |
| if (le) { |
| symbol_0 = ValueUtil.TRUE_VALUE; |
| } |
| else { |
| /*@Caught*/ @Nullable Object CAUGHT_result; |
| try { |
| final /*@NonInvalid*/ boolean isSafe = this.isIsSafe(); |
| final /*@Thrown*/ @Nullable Boolean result; |
| if (!isSafe) { |
| result = ValueUtil.TRUE_VALUE; |
| } |
| else { |
| /*@Caught*/ @Nullable Object CAUGHT_not; |
| try { |
| /*@Caught*/ @NonNull Object CAUGHT_isNullFree; |
| try { |
| final /*@NonInvalid*/ org.eclipse.ocl.pivot.@NonNull Class TYP_CollectionType = idResolver.getClass(PivotTables.CLSSid_CollectionType, null); |
| final /*@NonInvalid*/ @Nullable OCLExpression ownedSource = this.getOwnedSource(); |
| final /*@NonInvalid*/ @NonNull Object type = ownedSource == null; |
| /*@Thrown*/ @Nullable Type safe_type_source; |
| if (type == Boolean.TRUE) { |
| safe_type_source = null; |
| } |
| else { |
| assert ownedSource != null; |
| final /*@Thrown*/ @Nullable Type type_0 = ownedSource.getType(); |
| safe_type_source = type_0; |
| } |
| @SuppressWarnings("null") |
| final /*@Thrown*/ @NonNull CollectionType oclAsType = (@NonNull CollectionType)OclAnyOclAsTypeOperation.INSTANCE.evaluate(executor, safe_type_source, TYP_CollectionType); |
| final /*@Thrown*/ boolean isNullFree = oclAsType.isIsNullFree(); |
| CAUGHT_isNullFree = isNullFree; |
| } |
| catch (Exception e) { |
| CAUGHT_isNullFree = ValueUtil.createInvalidValue(e); |
| } |
| if (CAUGHT_isNullFree instanceof InvalidValueException) { |
| throw (InvalidValueException)CAUGHT_isNullFree; |
| } |
| final /*@Thrown*/ @Nullable Boolean not; |
| if (CAUGHT_isNullFree == ValueUtil.FALSE_VALUE) { |
| not = ValueUtil.TRUE_VALUE; |
| } |
| else { |
| if (CAUGHT_isNullFree == ValueUtil.TRUE_VALUE) { |
| not = ValueUtil.FALSE_VALUE; |
| } |
| else { |
| not = null; |
| } |
| } |
| CAUGHT_not = not; |
| } |
| catch (Exception e) { |
| CAUGHT_not = ValueUtil.createInvalidValue(e); |
| } |
| if (CAUGHT_not == ValueUtil.TRUE_VALUE) { |
| result = ValueUtil.TRUE_VALUE; |
| } |
| else { |
| if (CAUGHT_not instanceof InvalidValueException) { |
| throw (InvalidValueException)CAUGHT_not; |
| } |
| if (CAUGHT_not == null) { |
| result = null; |
| } |
| else { |
| result = ValueUtil.FALSE_VALUE; |
| } |
| } |
| } |
| 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, PivotTables.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 validateSafeSourceCannotBeMap(final DiagnosticChain diagnostics, final Map<Object, Object> context) |
| { |
| final @NonNull String constraintName = "CallExp::SafeSourceCannotBeMap"; |
| try { |
| /** |
| * |
| * inv SafeSourceCannotBeMap: |
| * let severity : Integer[1] = constraintName.getSeverity() |
| * in |
| * if severity <= 0 |
| * then true |
| * else |
| * let result : Boolean[?] = isSafe implies |
| * let sourceType : Type[?] = ownedSource?.type |
| * in sourceType <> null implies |
| * not sourceType.oclIsKindOf(MapType) |
| * in |
| * constraintName.logDiagnostic(self, null, diagnostics, context, null, severity, result, 0) |
| * endif |
| */ |
| final /*@NonInvalid*/ @NonNull Executor executor = PivotUtil.getExecutor(this, context); |
| final /*@NonInvalid*/ @NonNull IdResolver idResolver = executor.getIdResolver(); |
| final /*@NonInvalid*/ @NonNull IntegerValue severity_0 = CGStringGetSeverityOperation.INSTANCE.evaluate(executor, PivotPackage.Literals.CALL_EXP___VALIDATE_SAFE_SOURCE_CANNOT_BE_MAP__DIAGNOSTICCHAIN_MAP); |
| final /*@NonInvalid*/ boolean le = OclComparableLessThanEqualOperation.INSTANCE.evaluate(executor, severity_0, PivotTables.INT_0).booleanValue(); |
| /*@NonInvalid*/ boolean symbol_0; |
| if (le) { |
| symbol_0 = ValueUtil.TRUE_VALUE; |
| } |
| else { |
| /*@Caught*/ @Nullable Object CAUGHT_result; |
| try { |
| final /*@NonInvalid*/ boolean isSafe = this.isIsSafe(); |
| final /*@Thrown*/ @Nullable Boolean result; |
| if (!isSafe) { |
| result = ValueUtil.TRUE_VALUE; |
| } |
| else { |
| /*@Caught*/ @Nullable Object CAUGHT_implies; |
| try { |
| /*@Caught*/ @Nullable Object CAUGHT_safe_type_source; |
| try { |
| final /*@NonInvalid*/ @Nullable OCLExpression ownedSource = this.getOwnedSource(); |
| final /*@NonInvalid*/ @NonNull Object type = ownedSource == null; |
| /*@Thrown*/ @Nullable Type safe_type_source; |
| if (type == Boolean.TRUE) { |
| safe_type_source = null; |
| } |
| else { |
| assert ownedSource != null; |
| final /*@Thrown*/ @Nullable Type type_0 = ownedSource.getType(); |
| safe_type_source = type_0; |
| } |
| CAUGHT_safe_type_source = safe_type_source; |
| } |
| catch (Exception e) { |
| CAUGHT_safe_type_source = ValueUtil.createInvalidValue(e); |
| } |
| /*@Caught*/ @NonNull Object CAUGHT_ne; |
| try { |
| if (CAUGHT_safe_type_source instanceof InvalidValueException) { |
| throw (InvalidValueException)CAUGHT_safe_type_source; |
| } |
| final /*@Thrown*/ boolean ne = CAUGHT_safe_type_source != null; |
| CAUGHT_ne = ne; |
| } |
| catch (Exception e) { |
| CAUGHT_ne = ValueUtil.createInvalidValue(e); |
| } |
| final /*@Thrown*/ @Nullable Boolean implies; |
| if (CAUGHT_ne == ValueUtil.FALSE_VALUE) { |
| implies = ValueUtil.TRUE_VALUE; |
| } |
| else { |
| /*@Caught*/ @Nullable Object CAUGHT_not; |
| try { |
| /*@Caught*/ @NonNull Object CAUGHT_oclIsKindOf; |
| try { |
| final /*@NonInvalid*/ org.eclipse.ocl.pivot.@NonNull Class TYP_MapType = idResolver.getClass(PivotTables.CLSSid_MapType, null); |
| if (CAUGHT_safe_type_source instanceof InvalidValueException) { |
| throw (InvalidValueException)CAUGHT_safe_type_source; |
| } |
| final /*@Thrown*/ boolean oclIsKindOf = OclAnyOclIsKindOfOperation.INSTANCE.evaluate(executor, CAUGHT_safe_type_source, TYP_MapType).booleanValue(); |
| CAUGHT_oclIsKindOf = oclIsKindOf; |
| } |
| catch (Exception e) { |
| CAUGHT_oclIsKindOf = ValueUtil.createInvalidValue(e); |
| } |
| if (CAUGHT_oclIsKindOf instanceof InvalidValueException) { |
| throw (InvalidValueException)CAUGHT_oclIsKindOf; |
| } |
| final /*@Thrown*/ @Nullable Boolean not; |
| if (CAUGHT_oclIsKindOf == ValueUtil.FALSE_VALUE) { |
| not = ValueUtil.TRUE_VALUE; |
| } |
| else { |
| if (CAUGHT_oclIsKindOf == ValueUtil.TRUE_VALUE) { |
| not = ValueUtil.FALSE_VALUE; |
| } |
| else { |
| not = null; |
| } |
| } |
| CAUGHT_not = not; |
| } |
| catch (Exception e) { |
| CAUGHT_not = ValueUtil.createInvalidValue(e); |
| } |
| if (CAUGHT_not == ValueUtil.TRUE_VALUE) { |
| implies = ValueUtil.TRUE_VALUE; |
| } |
| else { |
| if (CAUGHT_ne instanceof InvalidValueException) { |
| throw (InvalidValueException)CAUGHT_ne; |
| } |
| if (CAUGHT_not instanceof InvalidValueException) { |
| throw (InvalidValueException)CAUGHT_not; |
| } |
| if (CAUGHT_not == null) { |
| implies = null; |
| } |
| else { |
| implies = ValueUtil.FALSE_VALUE; |
| } |
| } |
| } |
| CAUGHT_implies = implies; |
| } |
| catch (Exception e) { |
| CAUGHT_implies = ValueUtil.createInvalidValue(e); |
| } |
| if (CAUGHT_implies == ValueUtil.TRUE_VALUE) { |
| result = ValueUtil.TRUE_VALUE; |
| } |
| else { |
| if (CAUGHT_implies instanceof InvalidValueException) { |
| throw (InvalidValueException)CAUGHT_implies; |
| } |
| if (CAUGHT_implies == null) { |
| result = null; |
| } |
| else { |
| result = ValueUtil.FALSE_VALUE; |
| } |
| } |
| } |
| 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, PivotTables.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 validateTypeIsNotInvalid(final DiagnosticChain diagnostics, final Map<Object, Object> context) |
| { |
| final @NonNull String constraintName = "CallExp::TypeIsNotInvalid"; |
| try { |
| /** |
| * |
| * inv TypeIsNotInvalid: |
| * let severity : Integer[1] = constraintName.getSeverity() |
| * in |
| * if severity <= 0 |
| * then true |
| * else |
| * let result : Boolean[1] = type <> OclInvalid |
| * in |
| * constraintName.logDiagnostic(self, null, diagnostics, context, null, severity, result, 0) |
| * endif |
| */ |
| final /*@NonInvalid*/ @NonNull Executor executor = PivotUtil.getExecutor(this, context); |
| final /*@NonInvalid*/ @NonNull IdResolver idResolver = executor.getIdResolver(); |
| final /*@NonInvalid*/ @NonNull IntegerValue severity_0 = CGStringGetSeverityOperation.INSTANCE.evaluate(executor, PivotPackage.Literals.CALL_EXP___VALIDATE_TYPE_IS_NOT_INVALID__DIAGNOSTICCHAIN_MAP); |
| final /*@NonInvalid*/ boolean le = OclComparableLessThanEqualOperation.INSTANCE.evaluate(executor, severity_0, PivotTables.INT_0).booleanValue(); |
| /*@NonInvalid*/ boolean symbol_0; |
| if (le) { |
| symbol_0 = ValueUtil.TRUE_VALUE; |
| } |
| else { |
| final /*@NonInvalid*/ org.eclipse.ocl.pivot.@NonNull Class TYP_OclInvalid = idResolver.getClass(TypeId.OCL_INVALID, null); |
| final /*@NonInvalid*/ @Nullable Type type = this.getType(); |
| final /*@NonInvalid*/ boolean result = (type != null) ? (type.getTypeId() != TYP_OclInvalid.getTypeId()) : true; |
| final /*@NonInvalid*/ boolean logDiagnostic = CGStringLogDiagnosticOperation.INSTANCE.evaluate(executor, TypeId.BOOLEAN, constraintName, this, (Object)null, diagnostics, context, (Object)null, severity_0, result, PivotTables.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 void setIsImplicit(boolean newIsImplicit) |
| { |
| boolean oldIsImplicit = (eFlags & IS_IMPLICIT_EFLAG) != 0; |
| if (newIsImplicit) eFlags |= IS_IMPLICIT_EFLAG; else eFlags &= ~IS_IMPLICIT_EFLAG; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, 9, oldIsImplicit, newIsImplicit)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean isIsSafe() |
| { |
| return (eFlags & IS_SAFE_EFLAG) != 0; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void setIsSafe(boolean newIsSafe) |
| { |
| boolean oldIsSafe = (eFlags & IS_SAFE_EFLAG) != 0; |
| if (newIsSafe) eFlags |= IS_SAFE_EFLAG; else eFlags &= ~IS_SAFE_EFLAG; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, 10, oldIsSafe, newIsSafe)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, |
| int featureID, NotificationChain msgs) { |
| switch (featureID) |
| { |
| case 0: |
| return ((InternalEList<?>)getAnnotatingComments()).basicRemove(otherEnd, msgs); |
| case 1: |
| return ((InternalEList<?>)getOwnedAnnotations()).basicRemove(otherEnd, msgs); |
| case 2: |
| return ((InternalEList<?>)getOwnedComments()).basicRemove(otherEnd, msgs); |
| case 3: |
| return ((InternalEList<?>)getOwnedExtensions()).basicRemove(otherEnd, msgs); |
| case 11: |
| return basicSetOwnedSource(null, msgs); |
| } |
| return eDynamicInverseRemove(otherEnd, featureID, msgs); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) |
| { |
| case 0: |
| return getAnnotatingComments(); |
| case 1: |
| return getOwnedAnnotations(); |
| case 2: |
| return getOwnedComments(); |
| case 3: |
| return getOwnedExtensions(); |
| case 4: |
| return getName(); |
| case 5: |
| return isIsMany(); |
| case 6: |
| return isIsRequired(); |
| case 7: |
| if (resolve) return getType(); |
| return basicGetType(); |
| case 8: |
| return getTypeValue(); |
| case 9: |
| return isIsImplicit(); |
| case 10: |
| return isIsSafe(); |
| case 11: |
| return getOwnedSource(); |
| } |
| return eDynamicGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @SuppressWarnings("unchecked") |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) |
| { |
| case 0: |
| getAnnotatingComments().clear(); |
| getAnnotatingComments().addAll((Collection<? extends Comment>)newValue); |
| return; |
| case 1: |
| getOwnedAnnotations().clear(); |
| getOwnedAnnotations().addAll((Collection<? extends Element>)newValue); |
| return; |
| case 2: |
| getOwnedComments().clear(); |
| getOwnedComments().addAll((Collection<? extends Comment>)newValue); |
| return; |
| case 3: |
| getOwnedExtensions().clear(); |
| getOwnedExtensions().addAll((Collection<? extends ElementExtension>)newValue); |
| return; |
| case 4: |
| setName((String)newValue); |
| return; |
| case 6: |
| setIsRequired((Boolean)newValue); |
| return; |
| case 7: |
| setType((Type)newValue); |
| return; |
| case 8: |
| setTypeValue((Type)newValue); |
| return; |
| case 9: |
| setIsImplicit((Boolean)newValue); |
| return; |
| case 10: |
| setIsSafe((Boolean)newValue); |
| return; |
| case 11: |
| setOwnedSource((OCLExpression)newValue); |
| return; |
| } |
| eDynamicSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) |
| { |
| case 0: |
| getAnnotatingComments().clear(); |
| return; |
| case 1: |
| getOwnedAnnotations().clear(); |
| return; |
| case 2: |
| getOwnedComments().clear(); |
| return; |
| case 3: |
| getOwnedExtensions().clear(); |
| return; |
| case 4: |
| setName(NAME_EDEFAULT); |
| return; |
| case 6: |
| setIsRequired(IS_REQUIRED_EDEFAULT); |
| return; |
| case 7: |
| setType((Type)null); |
| return; |
| case 8: |
| setTypeValue((Type)null); |
| return; |
| case 9: |
| setIsImplicit(IS_IMPLICIT_EDEFAULT); |
| return; |
| case 10: |
| setIsSafe(IS_SAFE_EDEFAULT); |
| return; |
| case 11: |
| setOwnedSource((OCLExpression)null); |
| return; |
| } |
| eDynamicUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) |
| { |
| case 0: |
| return annotatingComments != null && !annotatingComments.isEmpty(); |
| case 1: |
| return ownedAnnotations != null && !ownedAnnotations.isEmpty(); |
| case 2: |
| return ownedComments != null && !ownedComments.isEmpty(); |
| case 3: |
| return ownedExtensions != null && !ownedExtensions.isEmpty(); |
| case 4: |
| return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); |
| case 5: |
| return isIsMany() != IS_MANY_EDEFAULT; |
| case 6: |
| return ((eFlags & IS_REQUIRED_EFLAG) != 0) != IS_REQUIRED_EDEFAULT; |
| case 7: |
| return type != null; |
| case 8: |
| return typeValue != null; |
| case 9: |
| return ((eFlags & IS_IMPLICIT_EFLAG) != 0) != IS_IMPLICIT_EDEFAULT; |
| case 10: |
| return ((eFlags & IS_SAFE_EFLAG) != 0) != IS_SAFE_EDEFAULT; |
| case 11: |
| return ownedSource != null; |
| } |
| return eDynamicIsSet(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| @SuppressWarnings("unchecked") |
| public Object eInvoke(int operationID, EList<?> arguments) throws InvocationTargetException |
| { |
| switch (operationID) |
| { |
| case 0: |
| return allOwnedElements(); |
| case 1: |
| return getValue((Type)arguments.get(0), (String)arguments.get(1)); |
| case 2: |
| return CompatibleBody((ValueSpecification)arguments.get(0)); |
| case 3: |
| return isNonNull(); |
| case 4: |
| return isNull(); |
| case 5: |
| return validateTypeIsNotNull((DiagnosticChain)arguments.get(0), (Map<Object, Object>)arguments.get(1)); |
| case 6: |
| return validateSafeSourceCanBeNull((DiagnosticChain)arguments.get(0), (Map<Object, Object>)arguments.get(1)); |
| case 7: |
| return validateSafeSourceCannotBeMap((DiagnosticChain)arguments.get(0), (Map<Object, Object>)arguments.get(1)); |
| case 8: |
| return validateTypeIsNotInvalid((DiagnosticChain)arguments.get(0), (Map<Object, Object>)arguments.get(1)); |
| } |
| return eDynamicInvoke(operationID, arguments); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated NOT |
| */ |
| @Override |
| public String toString() |
| { |
| return super.toString(); |
| } |
| |
| @Override |
| public <R> R accept(@NonNull Visitor<R> visitor) { |
| return visitor.visitCallExp(this); |
| } |
| |
| } //CallExpImpl |