blob: cffcba45ec42fc2a4686fc567c623214d0b755cd [file] [log] [blame]
/*******************************************************************************
* 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.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.EObjectResolvingEList;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.ocl.pivot.Comment;
import org.eclipse.ocl.pivot.CompleteInheritance;
import org.eclipse.ocl.pivot.Constraint;
import org.eclipse.ocl.pivot.Element;
import org.eclipse.ocl.pivot.ElementExtension;
import org.eclipse.ocl.pivot.ExpressionInOCL;
import org.eclipse.ocl.pivot.LanguageExpression;
import org.eclipse.ocl.pivot.Namespace;
import org.eclipse.ocl.pivot.OCLExpression;
import org.eclipse.ocl.pivot.Operation;
import org.eclipse.ocl.pivot.Parameter;
import org.eclipse.ocl.pivot.ParameterTypes;
import org.eclipse.ocl.pivot.PivotPackage;
import org.eclipse.ocl.pivot.PivotTables;
import org.eclipse.ocl.pivot.Precedence;
import org.eclipse.ocl.pivot.StandardLibrary;
import org.eclipse.ocl.pivot.TemplateBinding;
import org.eclipse.ocl.pivot.TemplateParameters;
import org.eclipse.ocl.pivot.TemplateSignature;
import org.eclipse.ocl.pivot.TemplateableElement;
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.IdManager;
import org.eclipse.ocl.pivot.ids.IdResolver;
import org.eclipse.ocl.pivot.ids.OperationId;
import org.eclipse.ocl.pivot.ids.ParametersId;
import org.eclipse.ocl.pivot.ids.TypeId;
import org.eclipse.ocl.pivot.library.LibraryFeature;
import org.eclipse.ocl.pivot.library.oclany.OclAnyOclAsTypeOperation;
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.TypeUtil;
import org.eclipse.ocl.pivot.utilities.ValueUtil;
import org.eclipse.ocl.pivot.values.IntegerValue;
import org.eclipse.ocl.pivot.values.InvalidValueException;
import org.eclipse.ocl.pivot.values.SetValue;
import org.eclipse.ocl.pivot.values.SetValue.Accumulator;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Operation</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.ocl.pivot.internal.OperationImpl#getOwnedConstraints <em>Owned Constraints</em>}</li>
* <li>{@link org.eclipse.ocl.pivot.internal.OperationImpl#getOwnedBindings <em>Owned Bindings</em>}</li>
* <li>{@link org.eclipse.ocl.pivot.internal.OperationImpl#getOwnedSignature <em>Owned Signature</em>}</li>
* <li>{@link org.eclipse.ocl.pivot.internal.OperationImpl#getUnspecializedElement <em>Unspecialized Element</em>}</li>
* <li>{@link org.eclipse.ocl.pivot.internal.OperationImpl#getBodyExpression <em>Body Expression</em>}</li>
* <li>{@link org.eclipse.ocl.pivot.internal.OperationImpl#isIsInvalidating <em>Is Invalidating</em>}</li>
* <li>{@link org.eclipse.ocl.pivot.internal.OperationImpl#isIsTransient <em>Is Transient</em>}</li>
* <li>{@link org.eclipse.ocl.pivot.internal.OperationImpl#isIsTypeof <em>Is Typeof</em>}</li>
* <li>{@link org.eclipse.ocl.pivot.internal.OperationImpl#isIsValidating <em>Is Validating</em>}</li>
* <li>{@link org.eclipse.ocl.pivot.internal.OperationImpl#getOwnedParameters <em>Owned Parameters</em>}</li>
* <li>{@link org.eclipse.ocl.pivot.internal.OperationImpl#getOwnedPostconditions <em>Owned Postconditions</em>}</li>
* <li>{@link org.eclipse.ocl.pivot.internal.OperationImpl#getOwnedPreconditions <em>Owned Preconditions</em>}</li>
* <li>{@link org.eclipse.ocl.pivot.internal.OperationImpl#getOwningClass <em>Owning Class</em>}</li>
* <li>{@link org.eclipse.ocl.pivot.internal.OperationImpl#getPrecedence <em>Precedence</em>}</li>
* <li>{@link org.eclipse.ocl.pivot.internal.OperationImpl#getRaisedExceptions <em>Raised Exceptions</em>}</li>
* <li>{@link org.eclipse.ocl.pivot.internal.OperationImpl#getRedefinedOperations <em>Redefined Operations</em>}</li>
* </ul>
*
* @generated
*/
public class OperationImpl
extends FeatureImpl
implements Operation {
/**
* The number of structural features of the '<em>Operation</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public static final int OPERATION_FEATURE_COUNT = FeatureImpl.FEATURE_FEATURE_COUNT + 16;
/**
* The number of operations of the '<em>Operation</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public static final int OPERATION_OPERATION_COUNT = FeatureImpl.FEATURE_OPERATION_COUNT + 4;
/**
* The cached value of the '{@link #getOwnedConstraints() <em>Owned Constraints</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOwnedConstraints()
* @generated
* @ordered
*/
protected EList<Constraint> ownedConstraints;
/**
* The cached value of the '{@link #getOwnedBindings() <em>Owned Bindings</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOwnedBindings()
* @generated
* @ordered
*/
protected EList<TemplateBinding> ownedBindings;
/**
* The cached value of the '{@link #getOwnedSignature() <em>Owned Signature</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOwnedSignature()
* @generated
* @ordered
*/
protected TemplateSignature ownedSignature;
/**
* The cached value of the '{@link #getUnspecializedElement() <em>Unspecialized Element</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getUnspecializedElement()
* @generated
* @ordered
*/
protected TemplateableElement unspecializedElement;
/**
* The cached value of the '{@link #getBodyExpression() <em>Body Expression</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getBodyExpression()
* @generated
* @ordered
*/
protected LanguageExpression bodyExpression;
/**
* The default value of the '{@link #isIsInvalidating() <em>Is Invalidating</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isIsInvalidating()
* @generated
* @ordered
*/
protected static final boolean IS_INVALIDATING_EDEFAULT = false;
/**
* The flag representing the value of the '{@link #isIsInvalidating() <em>Is Invalidating</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isIsInvalidating()
* @generated
* @ordered
*/
protected static final int IS_INVALIDATING_EFLAG = 1 << 10;
/**
* The default value of the '{@link #isIsTransient() <em>Is Transient</em>}' attribute.
* <!-- begin-user-doc -->
* @since 1.3
* <!-- end-user-doc -->
* @see #isIsTransient()
* @generated
* @ordered
*/
protected static final boolean IS_TRANSIENT_EDEFAULT = false;
/**
* The flag representing the value of the '{@link #isIsTransient() <em>Is Transient</em>}' attribute.
* <!-- begin-user-doc -->
* @since 1.3
* <!-- end-user-doc -->
* @see #isIsTransient()
* @generated
* @ordered
*/
protected static final int IS_TRANSIENT_EFLAG = 1 << 11;
/**
* The default value of the '{@link #isIsTypeof() <em>Is Typeof</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isIsTypeof()
* @generated
* @ordered
*/
protected static final boolean IS_TYPEOF_EDEFAULT = false;
/**
* The flag representing the value of the '{@link #isIsTypeof() <em>Is Typeof</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isIsTypeof()
* @generated
* @ordered
*/
protected static final int IS_TYPEOF_EFLAG = 1 << 12;
/**
* The default value of the '{@link #isIsValidating() <em>Is Validating</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isIsValidating()
* @generated
* @ordered
*/
protected static final boolean IS_VALIDATING_EDEFAULT = false;
/**
* The flag representing the value of the '{@link #isIsValidating() <em>Is Validating</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isIsValidating()
* @generated
* @ordered
*/
protected static final int IS_VALIDATING_EFLAG = 1 << 13;
/**
* 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<Parameter> ownedParameters;
/**
* The cached value of the '{@link #getOwnedPostconditions() <em>Owned Postconditions</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOwnedPostconditions()
* @generated
* @ordered
*/
protected EList<Constraint> ownedPostconditions;
/**
* The cached value of the '{@link #getOwnedPreconditions() <em>Owned Preconditions</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOwnedPreconditions()
* @generated
* @ordered
*/
protected EList<Constraint> ownedPreconditions;
/**
* The cached value of the '{@link #getPrecedence() <em>Precedence</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getPrecedence()
* @generated
* @ordered
*/
protected Precedence precedence;
/**
* The cached value of the '{@link #getRaisedExceptions() <em>Raised Exceptions</em>}' reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getRaisedExceptions()
* @generated
* @ordered
*/
protected EList<Type> raisedExceptions;
/**
* The cached value of the '{@link #getRedefinedOperations() <em>Redefined Operations</em>}' reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getRedefinedOperations()
* @generated
* @ordered
*/
protected EList<Operation> redefinedOperations;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected OperationImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return PivotPackage.Literals.OPERATION;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
@SuppressWarnings("null")
public @NonNull List<Constraint> getOwnedConstraints()
{
if (ownedConstraints == null)
{
ownedConstraints = new EObjectContainmentEList<Constraint>(Constraint.class, this, 11);
}
return ownedConstraints;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public List<TemplateBinding> getOwnedBindings()
{
if (ownedBindings == null)
{
ownedBindings = new EObjectContainmentWithInverseEList<TemplateBinding>(TemplateBinding.class, this, 12, 5);
}
return ownedBindings;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
@SuppressWarnings("null")
public @NonNull List<Type> getRaisedExceptions()
{
if (raisedExceptions == null)
{
raisedExceptions = new EObjectResolvingEList<Type>(Type.class, this, 25);
}
return raisedExceptions;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("null")
@Override
public @NonNull List<Operation> getRedefinedOperations()
{
if (redefinedOperations == null)
{
redefinedOperations = new EObjectResolvingEList<Operation>(Operation.class, this, 26);
}
return redefinedOperations;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
@SuppressWarnings("null")
public @NonNull List<Parameter> getOwnedParameters()
{
if (ownedParameters == null)
{
ownedParameters = new EObjectContainmentWithInverseEList<Parameter>(Parameter.class, this, 20, 10);
}
return ownedParameters;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("null")
@Override
public @NonNull List<Constraint> getOwnedPostconditions()
{
if (ownedPostconditions == null)
{
ownedPostconditions = new EObjectContainmentWithInverseEList<Constraint>(Constraint.class, this, 21, 9);
}
return ownedPostconditions;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("null")
@Override
public @NonNull List<Constraint> getOwnedPreconditions()
{
if (ownedPreconditions == null)
{
ownedPreconditions = new EObjectContainmentWithInverseEList<Constraint>(Constraint.class, this, 22, 10);
}
return ownedPreconditions;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public TemplateSignature getOwnedSignature() {
return ownedSignature;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetOwnedSignature(TemplateSignature newOwnedSignature, NotificationChain msgs)
{
TemplateSignature oldOwnedSignature = ownedSignature;
ownedSignature = newOwnedSignature;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, 13, oldOwnedSignature, newOwnedSignature);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setOwnedSignature(
TemplateSignature newOwnedSignature) {
if (newOwnedSignature != ownedSignature)
{
NotificationChain msgs = null;
if (ownedSignature != null)
msgs = ((InternalEObject)ownedSignature).eInverseRemove(this, 5, TemplateSignature.class, msgs);
if (newOwnedSignature != null)
msgs = ((InternalEObject)newOwnedSignature).eInverseAdd(this, 5, TemplateSignature.class, msgs);
msgs = basicSetOwnedSignature(newOwnedSignature, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, 13, newOwnedSignature, newOwnedSignature));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
@Override
public TemplateableElement getUnspecializedElement()
{
// throw new UnsupportedOperationException(); // FIXME Eliminate this feature once Acceleo bug 349278 fixed
return null;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
@Override
public void setUnspecializedElement(TemplateableElement newUnspecializedElement)
{
throw new UnsupportedOperationException(); // FIXME Eliminate this feature once Acceleo bug 349278 fixed
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Precedence getPrecedence() {
if (precedence != null && precedence.eIsProxy())
{
InternalEObject oldPrecedence = (InternalEObject)precedence;
precedence = (Precedence)eResolveProxy(oldPrecedence);
if (precedence != oldPrecedence)
{
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, 24, oldPrecedence, precedence));
}
}
return precedence;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Precedence basicGetPrecedence() {
return precedence;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setPrecedence(Precedence newPrecedence) {
Precedence oldPrecedence = precedence;
precedence = newPrecedence;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, 24, oldPrecedence, precedence));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public LanguageExpression getBodyExpression()
{
return bodyExpression;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetBodyExpression(LanguageExpression newBodyExpression, NotificationChain msgs)
{
LanguageExpression oldBodyExpression = bodyExpression;
bodyExpression = newBodyExpression;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, 15, oldBodyExpression, newBodyExpression);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setBodyExpression(LanguageExpression newBodyExpression)
{
if (newBodyExpression != bodyExpression)
{
NotificationChain msgs = null;
if (bodyExpression != null)
msgs = ((InternalEObject)bodyExpression).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - (15), null, msgs);
if (newBodyExpression != null)
msgs = ((InternalEObject)newBodyExpression).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - (15), null, msgs);
msgs = basicSetBodyExpression(newBodyExpression, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, 15, newBodyExpression, newBodyExpression));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean isIsInvalidating()
{
return (eFlags & IS_INVALIDATING_EFLAG) != 0;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setIsInvalidating(boolean newIsInvalidating)
{
boolean oldIsInvalidating = (eFlags & IS_INVALIDATING_EFLAG) != 0;
if (newIsInvalidating) eFlags |= IS_INVALIDATING_EFLAG; else eFlags &= ~IS_INVALIDATING_EFLAG;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, 16, oldIsInvalidating, newIsInvalidating));
}
/**
* <!-- begin-user-doc -->
* @since 1.3
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean isIsTransient()
{
return (eFlags & IS_TRANSIENT_EFLAG) != 0;
}
/**
* <!-- begin-user-doc -->
* @since 1.3
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setIsTransient(boolean newIsTransient)
{
boolean oldIsTransient = (eFlags & IS_TRANSIENT_EFLAG) != 0;
if (newIsTransient) eFlags |= IS_TRANSIENT_EFLAG; else eFlags &= ~IS_TRANSIENT_EFLAG;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, 17, oldIsTransient, newIsTransient));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean isIsTypeof()
{
return (eFlags & IS_TYPEOF_EFLAG) != 0;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setIsTypeof(boolean newIsTypeof)
{
boolean oldIsTypeof = (eFlags & IS_TYPEOF_EFLAG) != 0;
if (newIsTypeof) eFlags |= IS_TYPEOF_EFLAG; else eFlags &= ~IS_TYPEOF_EFLAG;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, 18, oldIsTypeof, newIsTypeof));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean isIsValidating()
{
return (eFlags & IS_VALIDATING_EFLAG) != 0;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setIsValidating(boolean newIsValidating)
{
boolean oldIsValidating = (eFlags & IS_VALIDATING_EFLAG) != 0;
if (newIsValidating) eFlags |= IS_VALIDATING_EFLAG; else eFlags &= ~IS_VALIDATING_EFLAG;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, 19, oldIsValidating, newIsValidating));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public org.eclipse.ocl.pivot.Class getOwningClass() {
if (eContainerFeatureID() != (23)) return null;
return (org.eclipse.ocl.pivot.Class)eInternalContainer();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetOwningClass(org.eclipse.ocl.pivot.Class newOwningClass, NotificationChain msgs)
{
msgs = eBasicSetContainer((InternalEObject)newOwningClass, 23, msgs);
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setOwningClass(org.eclipse.ocl.pivot.Class newOwningClass)
{
if (newOwningClass != eInternalContainer() || (eContainerFeatureID() != (23) && newOwningClass != null))
{
if (EcoreUtil.isAncestor(this, newOwningClass))
throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); //$NON-NLS-1$
NotificationChain msgs = null;
if (eInternalContainer() != null)
msgs = eBasicRemoveFromContainer(msgs);
if (newOwningClass != null)
msgs = ((InternalEObject)newOwningClass).eInverseAdd(this, 16, org.eclipse.ocl.pivot.Class.class, msgs);
msgs = basicSetOwningClass(newOwningClass, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, 23, newOwningClass, newOwningClass));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean validateCompatibleReturn(final DiagnosticChain diagnostics, final Map<Object, Object> context)
{
final @NonNull String constraintName = "Operation::CompatibleReturn";
try {
/**
*
* inv CompatibleReturn:
* let severity : Integer[1] = constraintName.getSeverity()
* in
* if severity <= 0
* then true
* else
* let result : Boolean[?] = bodyExpression <> null and
* bodyExpression.oclAsType(ExpressionInOCL).ownedBody <> null implies
* CompatibleBody(bodyExpression)
* 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.OPERATION___VALIDATE_COMPATIBLE_RETURN__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 {
/*@Caught*/ @Nullable Object CAUGHT_and;
try {
final /*@NonInvalid*/ @Nullable LanguageExpression bodyExpression = this.getBodyExpression();
final /*@NonInvalid*/ boolean ne = bodyExpression != null;
final /*@Thrown*/ @Nullable Boolean and;
if (!ne) {
and = ValueUtil.FALSE_VALUE;
}
else {
/*@Caught*/ @NonNull Object CAUGHT_ne_0;
try {
final /*@NonInvalid*/ org.eclipse.ocl.pivot.@NonNull Class TYP_ExpressionInOCL = idResolver.getClass(PivotTables.CLSSid_ExpressionInOCL, null);
@SuppressWarnings("null")
final /*@Thrown*/ @NonNull ExpressionInOCL oclAsType = (@NonNull ExpressionInOCL)OclAnyOclAsTypeOperation.INSTANCE.evaluate(executor, bodyExpression, TYP_ExpressionInOCL);
final /*@Thrown*/ @Nullable OCLExpression ownedBody = oclAsType.getOwnedBody();
final /*@Thrown*/ boolean ne_0 = ownedBody != null;
CAUGHT_ne_0 = ne_0;
}
catch (Exception e) {
CAUGHT_ne_0 = ValueUtil.createInvalidValue(e);
}
if (CAUGHT_ne_0 == ValueUtil.FALSE_VALUE) {
and = ValueUtil.FALSE_VALUE;
}
else {
if (CAUGHT_ne_0 instanceof InvalidValueException) {
throw (InvalidValueException)CAUGHT_ne_0;
}
and = ValueUtil.TRUE_VALUE;
}
}
CAUGHT_and = and;
}
catch (Exception e) {
CAUGHT_and = ValueUtil.createInvalidValue(e);
}
final /*@Thrown*/ @Nullable Boolean result;
if (CAUGHT_and == ValueUtil.FALSE_VALUE) {
result = ValueUtil.TRUE_VALUE;
}
else {
/*@Caught*/ @NonNull Object CAUGHT_CompatibleBody;
try {
final /*@NonInvalid*/ @Nullable LanguageExpression bodyExpression_1 = this.getBodyExpression();
final /*@Thrown*/ boolean CompatibleBody = this.CompatibleBody(bodyExpression_1);
CAUGHT_CompatibleBody = CompatibleBody;
}
catch (Exception e) {
CAUGHT_CompatibleBody = ValueUtil.createInvalidValue(e);
}
if (CAUGHT_CompatibleBody == ValueUtil.TRUE_VALUE) {
result = ValueUtil.TRUE_VALUE;
}
else {
if (CAUGHT_and instanceof InvalidValueException) {
throw (InvalidValueException)CAUGHT_and;
}
if (CAUGHT_CompatibleBody instanceof InvalidValueException) {
throw (InvalidValueException)CAUGHT_CompatibleBody;
}
if (CAUGHT_and == 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 validateLoadableImplementation(final DiagnosticChain diagnostics, final Map<Object, Object> context)
{
/**
* inv LoadableImplementation: true
*/
return ValueUtil.TRUE_VALUE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean validateUniquePreconditionName(final DiagnosticChain diagnostics, final Map<Object, Object> context)
{
final @NonNull String constraintName = "Operation::UniquePreconditionName";
try {
/**
*
* inv UniquePreconditionName:
* let severity : Integer[1] = constraintName.getSeverity()
* in
* if severity <= 0
* then true
* else
* let result : Boolean[1] = ownedPreconditions->isUnique(name)
* 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.OPERATION___VALIDATE_UNIQUE_PRECONDITION_NAME__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*/ @NonNull Object CAUGHT_result;
try {
final /*@NonInvalid*/ @NonNull List<Constraint> ownedPreconditions = this.getOwnedPreconditions();
final /*@NonInvalid*/ @NonNull SetValue BOXED_ownedPreconditions = idResolver.createSetOfAll(PivotTables.SET_CLSSid_Constraint, ownedPreconditions);
/*@Thrown*/ @NonNull Accumulator accumulator = ValueUtil.createSetAccumulatorValue(PivotTables.SET_CLSSid_Constraint);
@NonNull Iterator<Object> ITERATOR__1 = BOXED_ownedPreconditions.iterator();
/*@Thrown*/ boolean result;
while (true) {
if (!ITERATOR__1.hasNext()) {
result = ValueUtil.TRUE_VALUE;
break;
}
@SuppressWarnings("null")
/*@NonInvalid*/ @NonNull Constraint _1 = (@NonNull Constraint)ITERATOR__1.next();
/**
* name
*/
final /*@NonInvalid*/ @Nullable String name = _1.getName();
//
if (accumulator.includes(name) == ValueUtil.TRUE_VALUE) {
result = ValueUtil.FALSE_VALUE; // Abort after second find
break;
}
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, 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 validateUniquePostconditionName(final DiagnosticChain diagnostics, final Map<Object, Object> context)
{
final @NonNull String constraintName = "Operation::UniquePostconditionName";
try {
/**
*
* inv UniquePostconditionName:
* let severity : Integer[1] = constraintName.getSeverity()
* in
* if severity <= 0
* then true
* else
* let result : Boolean[1] = ownedPostconditions->isUnique(name)
* 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.OPERATION___VALIDATE_UNIQUE_POSTCONDITION_NAME__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*/ @NonNull Object CAUGHT_result;
try {
final /*@NonInvalid*/ @NonNull List<Constraint> ownedPostconditions = this.getOwnedPostconditions();
final /*@NonInvalid*/ @NonNull SetValue BOXED_ownedPostconditions = idResolver.createSetOfAll(PivotTables.SET_CLSSid_Constraint, ownedPostconditions);
/*@Thrown*/ @NonNull Accumulator accumulator = ValueUtil.createSetAccumulatorValue(PivotTables.SET_CLSSid_Constraint);
@NonNull Iterator<Object> ITERATOR__1 = BOXED_ownedPostconditions.iterator();
/*@Thrown*/ boolean result;
while (true) {
if (!ITERATOR__1.hasNext()) {
result = ValueUtil.TRUE_VALUE;
break;
}
@SuppressWarnings("null")
/*@NonInvalid*/ @NonNull Constraint _1 = (@NonNull Constraint)ITERATOR__1.next();
/**
* name
*/
final /*@NonInvalid*/ @Nullable String name = _1.getName();
//
if (accumulator.includes(name) == ValueUtil.TRUE_VALUE) {
result = ValueUtil.FALSE_VALUE; // Abort after second find
break;
}
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, 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
*/
@SuppressWarnings("unchecked")
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd,
int featureID, NotificationChain msgs) {
switch (featureID)
{
case 0:
return ((InternalEList<InternalEObject>)(InternalEList<?>)getAnnotatingComments()).basicAdd(otherEnd, msgs);
case 2:
return ((InternalEList<InternalEObject>)(InternalEList<?>)getOwnedComments()).basicAdd(otherEnd, msgs);
case 3:
return ((InternalEList<InternalEObject>)(InternalEList<?>)getOwnedExtensions()).basicAdd(otherEnd, msgs);
case 12:
return ((InternalEList<InternalEObject>)(InternalEList<?>)getOwnedBindings()).basicAdd(otherEnd, msgs);
case 13:
if (ownedSignature != null)
msgs = ((InternalEObject)ownedSignature).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - (13), null, msgs);
return basicSetOwnedSignature((TemplateSignature)otherEnd, msgs);
case 20:
return ((InternalEList<InternalEObject>)(InternalEList<?>)getOwnedParameters()).basicAdd(otherEnd, msgs);
case 21:
return ((InternalEList<InternalEObject>)(InternalEList<?>)getOwnedPostconditions()).basicAdd(otherEnd, msgs);
case 22:
return ((InternalEList<InternalEObject>)(InternalEList<?>)getOwnedPreconditions()).basicAdd(otherEnd, msgs);
case 23:
if (eInternalContainer() != null)
msgs = eBasicRemoveFromContainer(msgs);
return basicSetOwningClass((org.eclipse.ocl.pivot.Class)otherEnd, msgs);
}
return eDynamicInverseAdd(otherEnd, featureID, msgs);
}
/**
* <!-- 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 ((InternalEList<?>)getOwnedConstraints()).basicRemove(otherEnd, msgs);
case 12:
return ((InternalEList<?>)getOwnedBindings()).basicRemove(otherEnd, msgs);
case 13:
return basicSetOwnedSignature(null, msgs);
case 15:
return basicSetBodyExpression(null, msgs);
case 20:
return ((InternalEList<?>)getOwnedParameters()).basicRemove(otherEnd, msgs);
case 21:
return ((InternalEList<?>)getOwnedPostconditions()).basicRemove(otherEnd, msgs);
case 22:
return ((InternalEList<?>)getOwnedPreconditions()).basicRemove(otherEnd, msgs);
case 23:
return basicSetOwningClass(null, msgs);
}
return eDynamicInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eBasicRemoveFromContainerFeature(
NotificationChain msgs) {
switch (eContainerFeatureID())
{
case 23:
return eInternalContainer().eInverseRemove(this, 16, org.eclipse.ocl.pivot.Class.class, msgs);
}
return eDynamicBasicRemoveFromContainer(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 getImplementation();
case 9:
return getImplementationClass();
case 10:
return isIsStatic();
case 11:
return getOwnedConstraints();
case 12:
return getOwnedBindings();
case 13:
return getOwnedSignature();
case 14:
return getUnspecializedElement();
case 15:
return getBodyExpression();
case 16:
return isIsInvalidating();
case 17:
return isIsTransient();
case 18:
return isIsTypeof();
case 19:
return isIsValidating();
case 20:
return getOwnedParameters();
case 21:
return getOwnedPostconditions();
case 22:
return getOwnedPreconditions();
case 23:
return getOwningClass();
case 24:
if (resolve) return getPrecedence();
return basicGetPrecedence();
case 25:
return getRaisedExceptions();
case 26:
return getRedefinedOperations();
}
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:
setImplementation((LibraryFeature)newValue);
return;
case 9:
setImplementationClass((String)newValue);
return;
case 10:
setIsStatic((Boolean)newValue);
return;
case 11:
getOwnedConstraints().clear();
getOwnedConstraints().addAll((Collection<? extends Constraint>)newValue);
return;
case 12:
getOwnedBindings().clear();
getOwnedBindings().addAll((Collection<? extends TemplateBinding>)newValue);
return;
case 13:
setOwnedSignature((TemplateSignature)newValue);
return;
case 14:
setUnspecializedElement((TemplateableElement)newValue);
return;
case 15:
setBodyExpression((LanguageExpression)newValue);
return;
case 16:
setIsInvalidating((Boolean)newValue);
return;
case 17:
setIsTransient((Boolean)newValue);
return;
case 18:
setIsTypeof((Boolean)newValue);
return;
case 19:
setIsValidating((Boolean)newValue);
return;
case 20:
getOwnedParameters().clear();
getOwnedParameters().addAll((Collection<? extends Parameter>)newValue);
return;
case 21:
getOwnedPostconditions().clear();
getOwnedPostconditions().addAll((Collection<? extends Constraint>)newValue);
return;
case 22:
getOwnedPreconditions().clear();
getOwnedPreconditions().addAll((Collection<? extends Constraint>)newValue);
return;
case 23:
setOwningClass((org.eclipse.ocl.pivot.Class)newValue);
return;
case 24:
setPrecedence((Precedence)newValue);
return;
case 25:
getRaisedExceptions().clear();
getRaisedExceptions().addAll((Collection<? extends Type>)newValue);
return;
case 26:
getRedefinedOperations().clear();
getRedefinedOperations().addAll((Collection<? extends Operation>)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:
setImplementation(IMPLEMENTATION_EDEFAULT);
return;
case 9:
setImplementationClass(IMPLEMENTATION_CLASS_EDEFAULT);
return;
case 10:
setIsStatic(IS_STATIC_EDEFAULT);
return;
case 11:
getOwnedConstraints().clear();
return;
case 12:
getOwnedBindings().clear();
return;
case 13:
setOwnedSignature((TemplateSignature)null);
return;
case 14:
setUnspecializedElement((TemplateableElement)null);
return;
case 15:
setBodyExpression((LanguageExpression)null);
return;
case 16:
setIsInvalidating(IS_INVALIDATING_EDEFAULT);
return;
case 17:
setIsTransient(IS_TRANSIENT_EDEFAULT);
return;
case 18:
setIsTypeof(IS_TYPEOF_EDEFAULT);
return;
case 19:
setIsValidating(IS_VALIDATING_EDEFAULT);
return;
case 20:
getOwnedParameters().clear();
return;
case 21:
getOwnedPostconditions().clear();
return;
case 22:
getOwnedPreconditions().clear();
return;
case 23:
setOwningClass((org.eclipse.ocl.pivot.Class)null);
return;
case 24:
setPrecedence((Precedence)null);
return;
case 25:
getRaisedExceptions().clear();
return;
case 26:
getRedefinedOperations().clear();
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 IMPLEMENTATION_EDEFAULT == null ? implementation != null : !IMPLEMENTATION_EDEFAULT.equals(implementation);
case 9:
return IMPLEMENTATION_CLASS_EDEFAULT == null ? implementationClass != null : !IMPLEMENTATION_CLASS_EDEFAULT.equals(implementationClass);
case 10:
return ((eFlags & IS_STATIC_EFLAG) != 0) != IS_STATIC_EDEFAULT;
case 11:
return ownedConstraints != null && !ownedConstraints.isEmpty();
case 12:
return ownedBindings != null && !ownedBindings.isEmpty();
case 13:
return ownedSignature != null;
case 14:
return unspecializedElement != null;
case 15:
return bodyExpression != null;
case 16:
return ((eFlags & IS_INVALIDATING_EFLAG) != 0) != IS_INVALIDATING_EDEFAULT;
case 17:
return ((eFlags & IS_TRANSIENT_EFLAG) != 0) != IS_TRANSIENT_EDEFAULT;
case 18:
return ((eFlags & IS_TYPEOF_EFLAG) != 0) != IS_TYPEOF_EDEFAULT;
case 19:
return ((eFlags & IS_VALIDATING_EFLAG) != 0) != IS_VALIDATING_EDEFAULT;
case 20:
return ownedParameters != null && !ownedParameters.isEmpty();
case 21:
return ownedPostconditions != null && !ownedPostconditions.isEmpty();
case 22:
return ownedPreconditions != null && !ownedPreconditions.isEmpty();
case 23:
return getOwningClass() != null;
case 24:
return precedence != null;
case 25:
return raisedExceptions != null && !raisedExceptions.isEmpty();
case 26:
return redefinedOperations != null && !redefinedOperations.isEmpty();
}
return eDynamicIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
if (baseClass == Namespace.class)
{
switch (derivedFeatureID)
{
case 11: return 5;
default: return -1;
}
}
if (baseClass == TemplateableElement.class)
{
switch (derivedFeatureID)
{
case 12: return 4;
case 13: return 5;
case 14: return 6;
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 == Namespace.class)
{
switch (baseFeatureID)
{
case 5: return 11;
default: return -1;
}
}
if (baseClass == TemplateableElement.class)
{
switch (baseFeatureID)
{
case 4: return 12;
case 5: return 13;
case 6: return 14;
default: return -1;
}
}
return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
}
/**
* <!-- 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 validateNameIsNotNull((DiagnosticChain)arguments.get(0), (Map<Object, Object>)arguments.get(1));
case 4:
return validateTypeIsNotInvalid((DiagnosticChain)arguments.get(0), (Map<Object, Object>)arguments.get(1));
case 5:
return validateTypeIsNotNull((DiagnosticChain)arguments.get(0), (Map<Object, Object>)arguments.get(1));
case 6:
return validateCompatibleReturn((DiagnosticChain)arguments.get(0), (Map<Object, Object>)arguments.get(1));
case 7:
return validateLoadableImplementation((DiagnosticChain)arguments.get(0), (Map<Object, Object>)arguments.get(1));
case 8:
return validateUniquePostconditionName((DiagnosticChain)arguments.get(0), (Map<Object, Object>)arguments.get(1));
case 9:
return validateUniquePreconditionName((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.visitOperation(this);
}
@Override
public int getIndex() {
return -1; // WIP
}
@Override
public @Nullable CompleteInheritance getInheritance(@NonNull StandardLibrary standardLibrary) {
org.eclipse.ocl.pivot.Class owningType = getOwningClass();
if (owningType != null) {
return standardLibrary.getInheritance(owningType);
}
else {
return null;
}
}
@Override
public @NonNull ParametersId getParametersId() {
return getOperationId().getParametersId();
}
@Override
public @NonNull ParameterTypes getParameterTypes() {
List<Parameter> ownedParameter = getOwnedParameters();
int iMax = ownedParameter.size();
@NonNull Type @NonNull [] types = new @NonNull Type[iMax];
for (int i = 0; i < iMax; i++) {
Type parameterType = ownedParameter.get(i).getType();
assert parameterType != null;
types[i] = parameterType;
}
return TypeUtil.createParameterTypes(types);
}
@Override
public @NonNull TemplateParameters getTypeParameters() {
return TemplateSignatureImpl.getTypeParameters(getOwnedSignature());
}
private OperationId operationId = null;
@Override
public final @NonNull OperationId getOperationId() {
OperationId operationId2 = operationId;
if (operationId2 == null) {
synchronized (this) {
operationId2 = operationId;
if (operationId2 == null) {
operationId = operationId2 = IdManager.getOperationId(this);
}
}
}
return operationId2;
}
} //OperationImpl