blob: b65842b08bb0e57d7f992afa87272c31efc7015a [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2011, 2019 Willink Transformations and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
*
* Contributors:
* E.D.Willink - initial API and implementation
*******************************************************************************/
package org.eclipse.qvtd.pivot.qvtbase.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.EObjectContainmentWithInverseEList;
import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList;
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.StandardLibrary;
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.ClassImpl;
import org.eclipse.ocl.pivot.internal.NamedElementImpl;
import org.eclipse.ocl.pivot.internal.library.executor.ExecutorSingleIterationManager;
import org.eclipse.ocl.pivot.library.AbstractBinaryOperation;
import org.eclipse.ocl.pivot.library.LibraryIteration.LibraryIterationExtension;
import org.eclipse.ocl.pivot.library.collection.CollectionExcludesOperation;
import org.eclipse.ocl.pivot.library.collection.CollectionIncludesOperation;
import org.eclipse.ocl.pivot.library.oclany.OclAnyOclAsSetOperation;
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.messages.PivotMessages;
import org.eclipse.ocl.pivot.oclstdlib.OCLstdlibTables;
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;
import org.eclipse.ocl.pivot.values.OrderedSetValue;
import org.eclipse.ocl.pivot.values.SequenceValue;
import org.eclipse.ocl.pivot.values.SetValue;
import org.eclipse.ocl.pivot.values.SetValue.Accumulator;
import org.eclipse.qvtd.pivot.qvtbase.Domain;
import org.eclipse.qvtd.pivot.qvtbase.QVTbasePackage;
import org.eclipse.qvtd.pivot.qvtbase.QVTbaseTables;
import org.eclipse.qvtd.pivot.qvtbase.Rule;
import org.eclipse.qvtd.pivot.qvtbase.Transformation;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Rule</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.qvtd.pivot.qvtbase.impl.RuleImpl#getDomain <em>Domain</em>}</li>
* <li>{@link org.eclipse.qvtd.pivot.qvtbase.impl.RuleImpl#isIsAbstract <em>Is Abstract</em>}</li>
* <li>{@link org.eclipse.qvtd.pivot.qvtbase.impl.RuleImpl#getOverridden <em>Overridden</em>}</li>
* <li>{@link org.eclipse.qvtd.pivot.qvtbase.impl.RuleImpl#getOverrides <em>Overrides</em>}</li>
* <li>{@link org.eclipse.qvtd.pivot.qvtbase.impl.RuleImpl#getTransformation <em>Transformation</em>}</li>
* </ul>
*
* @generated
*/
public abstract class RuleImpl extends NamedElementImpl implements Rule {
/**
* The number of structural features of the '<em>Rule</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public static final int RULE_FEATURE_COUNT = NamedElementImpl.NAMED_ELEMENT_FEATURE_COUNT + 5;
/**
* The number of operations of the '<em>Rule</em>' class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
* @ordered
*/
public static final int RULE_OPERATION_COUNT = NamedElementImpl.NAMED_ELEMENT_OPERATION_COUNT + 3;
/**
* The cached value of the '{@link #getDomain() <em>Domain</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDomain()
* @generated
* @ordered
*/
protected EList<Domain> domain;
/**
* The default value of the '{@link #isIsAbstract() <em>Is Abstract</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isIsAbstract()
* @generated
* @ordered
*/
protected static final boolean IS_ABSTRACT_EDEFAULT = false;
/**
* The cached value of the '{@link #isIsAbstract() <em>Is Abstract</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #isIsAbstract()
* @generated
* @ordered
*/
protected boolean isAbstract = IS_ABSTRACT_EDEFAULT;
/**
* The cached value of the '{@link #getOverridden() <em>Overridden</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOverridden()
* @generated
* @ordered
*/
protected Rule overridden;
/**
* The cached value of the '{@link #getOverrides() <em>Overrides</em>}' reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getOverrides()
* @generated
* @ordered
*/
protected EList<Rule> overrides;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected RuleImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return QVTbasePackage.Literals.RULE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EList<Domain> getDomain() {
if (domain == null) {
domain = new EObjectContainmentWithInverseEList<Domain>(Domain.class, this, NamedElementImpl.NAMED_ELEMENT_FEATURE_COUNT + 0, NamedElementImpl.NAMED_ELEMENT_FEATURE_COUNT + 2);
}
return domain;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean isIsAbstract() {
return isAbstract;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setIsAbstract(boolean newIsAbstract) {
boolean oldIsAbstract = isAbstract;
isAbstract = newIsAbstract;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, NamedElementImpl.NAMED_ELEMENT_FEATURE_COUNT + 1, oldIsAbstract, isAbstract));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EList<Rule> getOverrides() {
if (overrides == null) {
overrides = new EObjectWithInverseResolvingEList<Rule>(Rule.class, this, NamedElementImpl.NAMED_ELEMENT_FEATURE_COUNT + 3, NamedElementImpl.NAMED_ELEMENT_FEATURE_COUNT + 2);
}
return overrides;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Transformation getTransformation() {
if (eContainerFeatureID() != (NamedElementImpl.NAMED_ELEMENT_FEATURE_COUNT + 4)) return null;
return (Transformation)eInternalContainer();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetTransformation(Transformation newTransformation, NotificationChain msgs) {
msgs = eBasicSetContainer((InternalEObject)newTransformation, NamedElementImpl.NAMED_ELEMENT_FEATURE_COUNT + 4, msgs);
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setTransformation(Transformation newTransformation) {
if (newTransformation != eInternalContainer() || (eContainerFeatureID() != (NamedElementImpl.NAMED_ELEMENT_FEATURE_COUNT + 4) && newTransformation != null)) {
if (EcoreUtil.isAncestor(this, newTransformation))
throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
NotificationChain msgs = null;
if (eInternalContainer() != null)
msgs = eBasicRemoveFromContainer(msgs);
if (newTransformation != null)
msgs = ((InternalEObject)newTransformation).eInverseAdd(this, ClassImpl.CLASS_FEATURE_COUNT + 2, Transformation.class, msgs);
msgs = basicSetTransformation(newTransformation, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, NamedElementImpl.NAMED_ELEMENT_FEATURE_COUNT + 4, newTransformation, newTransformation));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Rule getOverridden() {
if (overridden != null && overridden.eIsProxy()) {
InternalEObject oldOverridden = (InternalEObject)overridden;
overridden = (Rule)eResolveProxy(oldOverridden);
if (overridden != oldOverridden) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, NamedElementImpl.NAMED_ELEMENT_FEATURE_COUNT + 2, oldOverridden, overridden));
}
}
return overridden;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Rule basicGetOverridden() {
return overridden;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetOverridden(Rule newOverridden, NotificationChain msgs) {
Rule oldOverridden = overridden;
overridden = newOverridden;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, NamedElementImpl.NAMED_ELEMENT_FEATURE_COUNT + 2, oldOverridden, newOverridden);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setOverridden(Rule newOverridden) {
if (newOverridden != overridden) {
NotificationChain msgs = null;
if (overridden != null)
msgs = ((InternalEObject)overridden).eInverseRemove(this, NamedElementImpl.NAMED_ELEMENT_FEATURE_COUNT + 3, Rule.class, msgs);
if (newOverridden != null)
msgs = ((InternalEObject)newOverridden).eInverseAdd(this, NamedElementImpl.NAMED_ELEMENT_FEATURE_COUNT + 3, Rule.class, msgs);
msgs = basicSetOverridden(newOverridden, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, NamedElementImpl.NAMED_ELEMENT_FEATURE_COUNT + 2, newOverridden, newOverridden));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean validateDomainNameIsUnique(final DiagnosticChain diagnostics, final Map<Object, Object> context) {
final @NonNull String constraintName = "Rule::DomainNameIsUnique";
try {
/**
*
* inv DomainNameIsUnique:
* let severity : Integer[1] = constraintName.getSeverity()
* in
* if severity <= 0
* then true
* else
* let result : Boolean[1] = domain->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();
/*@Caught*/ @NonNull Object CAUGHT_severity_0;
try {
final /*@Thrown*/ @NonNull IntegerValue severity_0 = CGStringGetSeverityOperation.INSTANCE.evaluate(executor, QVTbasePackage.Literals.RULE___VALIDATE_DOMAIN_NAME_IS_UNIQUE__DIAGNOSTICCHAIN_MAP);
CAUGHT_severity_0 = severity_0;
}
catch (Exception e) {
CAUGHT_severity_0 = ValueUtil.createInvalidValue(e);
}
if (CAUGHT_severity_0 instanceof InvalidValueException) {
throw (InvalidValueException)CAUGHT_severity_0;
}
final /*@Thrown*/ boolean le = OclComparableLessThanEqualOperation.INSTANCE.evaluate(executor, CAUGHT_severity_0, QVTbaseTables.INT_0).booleanValue();
/*@NonInvalid*/ boolean symbol_0;
if (le) {
symbol_0 = ValueUtil.TRUE_VALUE;
}
else {
/*@Caught*/ @NonNull Object CAUGHT_result;
try {
@SuppressWarnings("null")
final /*@NonInvalid*/ @NonNull List<Domain> domain = this.getDomain();
final /*@NonInvalid*/ @NonNull OrderedSetValue BOXED_domain = idResolver.createOrderedSetOfAll(QVTbaseTables.ORD_CLSSid_Domain, domain);
/*@Thrown*/ @NonNull Accumulator accumulator = ValueUtil.createSetAccumulatorValue(QVTbaseTables.ORD_CLSSid_Domain);
@NonNull Iterator<Object> ITERATOR__1 = BOXED_domain.iterator();
/*@Thrown*/ boolean result;
while (true) {
if (!ITERATOR__1.hasNext()) {
result = ValueUtil.TRUE_VALUE;
break;
}
@SuppressWarnings("null")
/*@NonInvalid*/ @NonNull Domain _1 = (@NonNull Domain)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, CAUGHT_severity_0, CAUGHT_result, QVTbaseTables.INT_0).booleanValue();
symbol_0 = logDiagnostic;
}
return Boolean.TRUE == symbol_0;
}
catch (Throwable e) {
return ValueUtil.validationFailedDiagnostic(constraintName, this, diagnostics, context, e);
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean validateNoOverridesCycle(final DiagnosticChain diagnostics, final Map<Object, Object> context) {
final @NonNull String constraintName = "Rule::NoOverridesCycle";
try {
/**
*
* inv NoOverridesCycle:
* let severity : Integer[1] = constraintName.getSeverity()
* in
* if severity <= 0
* then true
* else
* let
* result : Boolean[1] = overridden->closure(overridden)
* ->excludes(self)
* 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 StandardLibrary standardLibrary = idResolver.getStandardLibrary();
/*@Caught*/ @NonNull Object CAUGHT_severity_0;
try {
final /*@Thrown*/ @NonNull IntegerValue severity_0 = CGStringGetSeverityOperation.INSTANCE.evaluate(executor, QVTbasePackage.Literals.RULE___VALIDATE_NO_OVERRIDES_CYCLE__DIAGNOSTICCHAIN_MAP);
CAUGHT_severity_0 = severity_0;
}
catch (Exception e) {
CAUGHT_severity_0 = ValueUtil.createInvalidValue(e);
}
if (CAUGHT_severity_0 instanceof InvalidValueException) {
throw (InvalidValueException)CAUGHT_severity_0;
}
final /*@Thrown*/ boolean le = OclComparableLessThanEqualOperation.INSTANCE.evaluate(executor, CAUGHT_severity_0, QVTbaseTables.INT_0).booleanValue();
/*@NonInvalid*/ boolean symbol_1;
if (le) {
symbol_1 = ValueUtil.TRUE_VALUE;
}
else {
/*@Caught*/ @NonNull Object CAUGHT_result;
try {
final /*@NonInvalid*/ @Nullable Rule overridden = this.getOverridden();
final /*@Thrown*/ @NonNull SetValue oclAsSet = OclAnyOclAsSetOperation.INSTANCE.evaluate(executor, QVTbaseTables.SET_CLSSid_Rule, overridden);
final org.eclipse.ocl.pivot.@NonNull Class TYPE_closure_0 = executor.getStaticTypeOfValue(null, oclAsSet);
final @NonNull LibraryIterationExtension IMPL_closure_0 = (LibraryIterationExtension)TYPE_closure_0.lookupImplementation(standardLibrary, OCLstdlibTables.Operations._Set__closure);
final @NonNull Object ACC_closure_0 = IMPL_closure_0.createAccumulatorValue(executor, QVTbaseTables.SET_CLSSid_Rule, QVTbaseTables.CLSSid_Rule);
/**
* Implementation of the iterator body.
*/
final @NonNull AbstractBinaryOperation BODY_closure_0 = new AbstractBinaryOperation() {
/**
* overridden
*/
@Override
public @Nullable Object evaluate(final @NonNull Executor executor, final @NonNull TypeId typeId, final @Nullable Object oclAsSet, final /*@NonInvalid*/ @Nullable Object _1) {
final /*@NonInvalid*/ @Nullable Rule symbol_0 = (Rule)_1;
if (symbol_0 == null) {
throw new InvalidValueException("Null source for \'\'http://www.eclipse.org/qvt/2015/QVTbase\'::Rule::overridden\'");
}
final /*@Thrown*/ @Nullable Rule overridden_0 = symbol_0.getOverridden();
return overridden_0;
}
};
final @NonNull ExecutorSingleIterationManager MGR_closure_0 = new ExecutorSingleIterationManager(executor, QVTbaseTables.SET_CLSSid_Rule, BODY_closure_0, oclAsSet, ACC_closure_0);
@SuppressWarnings("null")
final /*@Thrown*/ @NonNull SetValue closure = (@NonNull SetValue)IMPL_closure_0.evaluateIteration(MGR_closure_0);
final /*@Thrown*/ boolean result = CollectionExcludesOperation.INSTANCE.evaluate(closure, this).booleanValue();
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, CAUGHT_severity_0, CAUGHT_result, QVTbaseTables.INT_0).booleanValue();
symbol_1 = logDiagnostic;
}
return Boolean.TRUE == symbol_1;
}
catch (Throwable e) {
return ValueUtil.validationFailedDiagnostic(constraintName, this, diagnostics, context, e);
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean validateOverridingRuleOverridesAllDomains(final DiagnosticChain diagnostics, final Map<Object, Object> context) {
final @NonNull String constraintName = "Rule::OverridingRuleOverridesAllDomains";
try {
/**
*
* inv OverridingRuleOverridesAllDomains:
* let severity : Integer[1] = constraintName.getSeverity()
* in
* if severity <= 0
* then true
* else
* let result : Boolean[?] = overridden <> null implies
* overridden.domain->forAll(od |
* self.domain.name->includes(od.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();
/*@Caught*/ @NonNull Object CAUGHT_severity_0;
try {
final /*@Thrown*/ @NonNull IntegerValue severity_0 = CGStringGetSeverityOperation.INSTANCE.evaluate(executor, QVTbasePackage.Literals.RULE___VALIDATE_OVERRIDING_RULE_OVERRIDES_ALL_DOMAINS__DIAGNOSTICCHAIN_MAP);
CAUGHT_severity_0 = severity_0;
}
catch (Exception e) {
CAUGHT_severity_0 = ValueUtil.createInvalidValue(e);
}
if (CAUGHT_severity_0 instanceof InvalidValueException) {
throw (InvalidValueException)CAUGHT_severity_0;
}
final /*@Thrown*/ boolean le = OclComparableLessThanEqualOperation.INSTANCE.evaluate(executor, CAUGHT_severity_0, QVTbaseTables.INT_0).booleanValue();
/*@NonInvalid*/ boolean symbol_0;
if (le) {
symbol_0 = ValueUtil.TRUE_VALUE;
}
else {
/*@Caught*/ @Nullable Object CAUGHT_result;
try {
final /*@NonInvalid*/ @Nullable Rule overridden = this.getOverridden();
final /*@NonInvalid*/ boolean ne = overridden != null;
/*@Thrown*/ @Nullable Boolean result;
if (ne) {
if (overridden == null) {
throw new InvalidValueException("Null source for \'\'http://www.eclipse.org/qvt/2015/QVTbase\'::Rule::domain\'");
}
@SuppressWarnings("null")
final /*@Thrown*/ @NonNull List<Domain> domain = overridden.getDomain();
final /*@Thrown*/ @NonNull OrderedSetValue BOXED_domain = idResolver.createOrderedSetOfAll(QVTbaseTables.ORD_CLSSid_Domain, domain);
/*@Thrown*/ @Nullable Object accumulator = ValueUtil.TRUE_VALUE;
@NonNull Iterator<Object> ITERATOR_od = BOXED_domain.iterator();
/*@Thrown*/ @Nullable Boolean forAll;
while (true) {
if (!ITERATOR_od.hasNext()) {
if (accumulator == ValueUtil.TRUE_VALUE) {
forAll = ValueUtil.TRUE_VALUE;
}
else {
throw (InvalidValueException)accumulator;
}
break;
}
@SuppressWarnings("null")
/*@NonInvalid*/ @NonNull Domain od = (@NonNull Domain)ITERATOR_od.next();
/**
* self.domain.name->includes(od.name)
*/
/*@Caught*/ @NonNull Object CAUGHT_includes;
try {
@SuppressWarnings("null")
final /*@NonInvalid*/ @NonNull List<Domain> domain_0 = this.getDomain();
final /*@NonInvalid*/ @NonNull OrderedSetValue BOXED_domain_0 = idResolver.createOrderedSetOfAll(QVTbaseTables.ORD_CLSSid_Domain, domain_0);
/*@Thrown*/ org.eclipse.ocl.pivot.values.SequenceValue.@NonNull Accumulator accumulator_0 = ValueUtil.createSequenceAccumulatorValue(QVTbaseTables.SEQ_PRIMid_String);
@NonNull Iterator<Object> ITERATOR__1 = BOXED_domain_0.iterator();
/*@Thrown*/ @NonNull SequenceValue collect;
while (true) {
if (!ITERATOR__1.hasNext()) {
collect = accumulator_0;
break;
}
@SuppressWarnings("null")
/*@NonInvalid*/ @NonNull Domain _1 = (@NonNull Domain)ITERATOR__1.next();
/**
* name
*/
final /*@NonInvalid*/ @Nullable String name = _1.getName();
//
accumulator_0.add(name);
}
final /*@NonInvalid*/ @Nullable String name_0 = od.getName();
final /*@Thrown*/ boolean includes = CollectionIncludesOperation.INSTANCE.evaluate(collect, name_0).booleanValue();
CAUGHT_includes = includes;
}
catch (Exception e) {
CAUGHT_includes = ValueUtil.createInvalidValue(e);
}
//
if (CAUGHT_includes == ValueUtil.FALSE_VALUE) { // Normal unsuccessful body evaluation result
forAll = ValueUtil.FALSE_VALUE;
break; // Stop immediately
}
else if (CAUGHT_includes == ValueUtil.TRUE_VALUE) { // Normal successful body evaluation result
; // Carry on
}
else if (CAUGHT_includes instanceof InvalidValueException) { // Abnormal exception evaluation result
accumulator = CAUGHT_includes; // Cache an exception failure
}
else { // Impossible badly typed result
accumulator = new InvalidValueException(PivotMessages.NonBooleanBody, "forAll");
}
}
result = forAll;
}
else {
result = ValueUtil.TRUE_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, CAUGHT_severity_0, CAUGHT_result, QVTbaseTables.INT_0).booleanValue();
symbol_0 = logDiagnostic;
}
return Boolean.TRUE == symbol_0;
}
catch (Throwable e) {
return ValueUtil.validationFailedDiagnostic(constraintName, this, diagnostics, context, e);
}
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated NOT
*/
@Override
public String toString() {
return super.toString();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case NamedElementImpl.NAMED_ELEMENT_FEATURE_COUNT + 0:
return ((InternalEList<InternalEObject>)(InternalEList<?>)getDomain()).basicAdd(otherEnd, msgs);
case NamedElementImpl.NAMED_ELEMENT_FEATURE_COUNT + 2:
if (overridden != null)
msgs = ((InternalEObject)overridden).eInverseRemove(this, NamedElementImpl.NAMED_ELEMENT_FEATURE_COUNT + 3, Rule.class, msgs);
return basicSetOverridden((Rule)otherEnd, msgs);
case NamedElementImpl.NAMED_ELEMENT_FEATURE_COUNT + 3:
return ((InternalEList<InternalEObject>)(InternalEList<?>)getOverrides()).basicAdd(otherEnd, msgs);
case NamedElementImpl.NAMED_ELEMENT_FEATURE_COUNT + 4:
if (eInternalContainer() != null)
msgs = eBasicRemoveFromContainer(msgs);
return basicSetTransformation((Transformation)otherEnd, msgs);
}
return super.eInverseAdd(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case NamedElementImpl.NAMED_ELEMENT_FEATURE_COUNT + 0:
return ((InternalEList<?>)getDomain()).basicRemove(otherEnd, msgs);
case NamedElementImpl.NAMED_ELEMENT_FEATURE_COUNT + 2:
return basicSetOverridden(null, msgs);
case NamedElementImpl.NAMED_ELEMENT_FEATURE_COUNT + 3:
return ((InternalEList<?>)getOverrides()).basicRemove(otherEnd, msgs);
case NamedElementImpl.NAMED_ELEMENT_FEATURE_COUNT + 4:
return basicSetTransformation(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) {
switch (eContainerFeatureID()) {
case NamedElementImpl.NAMED_ELEMENT_FEATURE_COUNT + 4:
return eInternalContainer().eInverseRemove(this, ClassImpl.CLASS_FEATURE_COUNT + 2, Transformation.class, msgs);
}
return super.eBasicRemoveFromContainerFeature(msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case NamedElementImpl.NAMED_ELEMENT_FEATURE_COUNT + 0:
return getDomain();
case NamedElementImpl.NAMED_ELEMENT_FEATURE_COUNT + 1:
return isIsAbstract();
case NamedElementImpl.NAMED_ELEMENT_FEATURE_COUNT + 2:
if (resolve) return getOverridden();
return basicGetOverridden();
case NamedElementImpl.NAMED_ELEMENT_FEATURE_COUNT + 3:
return getOverrides();
case NamedElementImpl.NAMED_ELEMENT_FEATURE_COUNT + 4:
return getTransformation();
}
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 NamedElementImpl.NAMED_ELEMENT_FEATURE_COUNT + 0:
getDomain().clear();
getDomain().addAll((Collection<? extends Domain>)newValue);
return;
case NamedElementImpl.NAMED_ELEMENT_FEATURE_COUNT + 1:
setIsAbstract((Boolean)newValue);
return;
case NamedElementImpl.NAMED_ELEMENT_FEATURE_COUNT + 2:
setOverridden((Rule)newValue);
return;
case NamedElementImpl.NAMED_ELEMENT_FEATURE_COUNT + 3:
getOverrides().clear();
getOverrides().addAll((Collection<? extends Rule>)newValue);
return;
case NamedElementImpl.NAMED_ELEMENT_FEATURE_COUNT + 4:
setTransformation((Transformation)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case NamedElementImpl.NAMED_ELEMENT_FEATURE_COUNT + 0:
getDomain().clear();
return;
case NamedElementImpl.NAMED_ELEMENT_FEATURE_COUNT + 1:
setIsAbstract(IS_ABSTRACT_EDEFAULT);
return;
case NamedElementImpl.NAMED_ELEMENT_FEATURE_COUNT + 2:
setOverridden((Rule)null);
return;
case NamedElementImpl.NAMED_ELEMENT_FEATURE_COUNT + 3:
getOverrides().clear();
return;
case NamedElementImpl.NAMED_ELEMENT_FEATURE_COUNT + 4:
setTransformation((Transformation)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case NamedElementImpl.NAMED_ELEMENT_FEATURE_COUNT + 0:
return domain != null && !domain.isEmpty();
case NamedElementImpl.NAMED_ELEMENT_FEATURE_COUNT + 1:
return isAbstract != IS_ABSTRACT_EDEFAULT;
case NamedElementImpl.NAMED_ELEMENT_FEATURE_COUNT + 2:
return overridden != null;
case NamedElementImpl.NAMED_ELEMENT_FEATURE_COUNT + 3:
return overrides != null && !overrides.isEmpty();
case NamedElementImpl.NAMED_ELEMENT_FEATURE_COUNT + 4:
return getTransformation() != null;
}
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 NamedElementImpl.NAMED_ELEMENT_OPERATION_COUNT + 0:
return validateDomainNameIsUnique((DiagnosticChain)arguments.get(0), (Map<Object, Object>)arguments.get(1));
case NamedElementImpl.NAMED_ELEMENT_OPERATION_COUNT + 1:
return validateNoOverridesCycle((DiagnosticChain)arguments.get(0), (Map<Object, Object>)arguments.get(1));
case NamedElementImpl.NAMED_ELEMENT_OPERATION_COUNT + 2:
return validateOverridingRuleOverridesAllDomains((DiagnosticChain)arguments.get(0), (Map<Object, Object>)arguments.get(1));
}
return super.eInvoke(operationID, arguments);
}
} //RuleImpl