From 2c079239b9e0a610ed1e85172180d9a56b3dd608 Mon Sep 17 00:00:00 2001 From: Lutz Wrage Date: Fri, 18 Sep 2026 13:07:00 -0400 Subject: [PATCH] Track Xsemantics generated Java sources Keep the six ALISA generated Java sources in version control while continuing to ignore their trace files. Remove Xsemantics generation plugins, dependencies, and clean filesets so Maven compiles the checked-in output without regenerating or deleting it. Validated with a clean root-reactor verify using -T5 and AssureTests: all 30 tests passed, and the generated sources remained byte-for-byte unchanged. --- alisa/org.osate.alisa.common/pom.xml | 10 - .../org/osate/alisa/common/typing/.gitignore | 2 - .../common/typing/CommonInterpreter.java | 2090 ++++++++++++++ .../alisa/common/typing/CommonTypeSystem.java | 2410 +++++++++++++++++ .../alisa/common/typing/validation/.gitignore | 2 - .../CommonInterpreterValidator.java | 19 + .../validation/CommonTypeSystemValidator.java | 36 + alisa/org.osate.verify/pom.xml | 11 - .../org/osate/verify/typing/.gitignore | 1 - .../osate/verify/typing/VerifyTypeSystem.java | 809 ++++++ .../osate/verify/typing/validation/.gitignore | 1 - .../validation/VerifyTypeSystemValidator.java | 47 + ba/org.osate.xtext.aadl2.ba/pom.xml | 8 - core/org.osate.ui/pom.xml | 4 +- ge/osate-ge.experimental.releng/pom.xml | 40 - releng/org.osate.build.main/pom.xml | 51 - 16 files changed, 5413 insertions(+), 128 deletions(-) create mode 100644 alisa/org.osate.alisa.common/xsemantics-gen/org/osate/alisa/common/typing/CommonInterpreter.java create mode 100644 alisa/org.osate.alisa.common/xsemantics-gen/org/osate/alisa/common/typing/CommonTypeSystem.java create mode 100644 alisa/org.osate.alisa.common/xsemantics-gen/org/osate/alisa/common/typing/validation/CommonInterpreterValidator.java create mode 100644 alisa/org.osate.alisa.common/xsemantics-gen/org/osate/alisa/common/typing/validation/CommonTypeSystemValidator.java create mode 100644 alisa/org.osate.verify/xsemantics-gen/org/osate/verify/typing/VerifyTypeSystem.java create mode 100644 alisa/org.osate.verify/xsemantics-gen/org/osate/verify/typing/validation/VerifyTypeSystemValidator.java diff --git a/alisa/org.osate.alisa.common/pom.xml b/alisa/org.osate.alisa.common/pom.xml index af12b60bcf1..24551700196 100644 --- a/alisa/org.osate.alisa.common/pom.xml +++ b/alisa/org.osate.alisa.common/pom.xml @@ -15,14 +15,4 @@ 3.2.3-SNAPSHOT eclipse-plugin - - - - org.eclipse.xtext - xtext-maven-plugin - - - - - diff --git a/alisa/org.osate.alisa.common/xsemantics-gen/org/osate/alisa/common/typing/.gitignore b/alisa/org.osate.alisa.common/xsemantics-gen/org/osate/alisa/common/typing/.gitignore index ee7b95a5837..dbab62dbdc5 100644 --- a/alisa/org.osate.alisa.common/xsemantics-gen/org/osate/alisa/common/typing/.gitignore +++ b/alisa/org.osate.alisa.common/xsemantics-gen/org/osate/alisa/common/typing/.gitignore @@ -1,4 +1,2 @@ -/CommonTypeSystem.java /.CommonTypeSystem.java._trace -/CommonInterpreter.java /.CommonInterpreter.java._trace diff --git a/alisa/org.osate.alisa.common/xsemantics-gen/org/osate/alisa/common/typing/CommonInterpreter.java b/alisa/org.osate.alisa.common/xsemantics-gen/org/osate/alisa/common/typing/CommonInterpreter.java new file mode 100644 index 00000000000..3f156e9030c --- /dev/null +++ b/alisa/org.osate.alisa.common/xsemantics-gen/org/osate/alisa/common/typing/CommonInterpreter.java @@ -0,0 +1,2090 @@ +package org.osate.alisa.common.typing; + +import com.google.inject.Provider; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Objects; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.eclipse.xsemantics.runtime.ErrorInformation; +import org.eclipse.xsemantics.runtime.Result; +import org.eclipse.xsemantics.runtime.RuleApplicationTrace; +import org.eclipse.xsemantics.runtime.RuleEnvironment; +import org.eclipse.xsemantics.runtime.RuleFailedException; +import org.eclipse.xsemantics.runtime.XsemanticsRuntimeSystem; +import org.eclipse.xtext.nodemodel.util.NodeModelUtils; +import org.eclipse.xtext.util.PolymorphicDispatcher; +import org.eclipse.xtext.xbase.lib.Exceptions; +import org.eclipse.xtext.xbase.lib.Functions.Function1; +import org.eclipse.xtext.xbase.lib.IterableExtensions; +import org.eclipse.xtext.xbase.lib.ListExtensions; +import org.osate.aadl2.Aadl2Factory; +import org.osate.aadl2.AadlInteger; +import org.osate.aadl2.AbstractNamedValue; +import org.osate.aadl2.BasicPropertyAssociation; +import org.osate.aadl2.BooleanLiteral; +import org.osate.aadl2.IntegerLiteral; +import org.osate.aadl2.NamedElement; +import org.osate.aadl2.NumberType; +import org.osate.aadl2.NumberValue; +import org.osate.aadl2.Property; +import org.osate.aadl2.PropertyConstant; +import org.osate.aadl2.PropertyExpression; +import org.osate.aadl2.PropertyValue; +import org.osate.aadl2.RangeValue; +import org.osate.aadl2.RealLiteral; +import org.osate.aadl2.RecordValue; +import org.osate.aadl2.StringLiteral; +import org.osate.aadl2.UnitsType; +import org.osate.aadl2.instance.InstanceFactory; +import org.osate.aadl2.instance.InstanceObject; +import org.osate.aadl2.instance.InstanceReferenceValue; +import org.osate.alisa.common.common.ABinaryOperation; +import org.osate.alisa.common.common.AConditional; +import org.osate.alisa.common.common.AFunctionCall; +import org.osate.alisa.common.common.AModelReference; +import org.osate.alisa.common.common.APropertyReference; +import org.osate.alisa.common.common.ARange; +import org.osate.alisa.common.common.AUnaryOperation; +import org.osate.alisa.common.common.AUnitExpression; +import org.osate.alisa.common.common.AVariableDeclaration; +import org.osate.alisa.common.common.AVariableReference; +import org.osate.alisa.common.common.ComputeDeclaration; +import org.osate.alisa.common.common.Operation; +import org.osate.alisa.common.common.ValDeclaration; + +@SuppressWarnings("all") +public class CommonInterpreter extends XsemanticsRuntimeSystem { + public static final String COMBINENUMERIC = "org.osate.alisa.common.typing.CombineNumeric"; + + public static final String CHOOSEROOT = "org.osate.alisa.common.typing.ChooseRoot"; + + public static final String ERRORPOSITION = "org.osate.alisa.common.typing.ErrorPosition"; + + public static final String INTERPRETBINARYEXPRESSION = "org.osate.alisa.common.typing.InterpretBinaryExpression"; + + public static final String INTERPRETFUNCTIONCALL = "org.osate.alisa.common.typing.InterpretFunctionCall"; + + public static final String INTERPRETUNARYEXPRESSION = "org.osate.alisa.common.typing.InterpretUnaryExpression"; + + public static final String INTERPRETUNITEXPRESSION = "org.osate.alisa.common.typing.InterpretUnitExpression"; + + public static final String INTERPRETVAL = "org.osate.alisa.common.typing.InterpretVal"; + + public static final String INTERPRETCOMPUTE = "org.osate.alisa.common.typing.InterpretCompute"; + + public static final String INTERPRETVARREF = "org.osate.alisa.common.typing.InterpretVarRef"; + + public static final String INTERPETITE = "org.osate.alisa.common.typing.InterpetITE"; + + public static final String INTERPRETMODELREFERENCE = "org.osate.alisa.common.typing.InterpretModelReference"; + + public static final String INTERPRETPROPERTYREFERENCE = "org.osate.alisa.common.typing.InterpretPropertyReference"; + + public static final String INTERPRETINTEGERLITERAL = "org.osate.alisa.common.typing.InterpretIntegerLiteral"; + + public static final String INTERPRETREALLITERAL = "org.osate.alisa.common.typing.InterpretRealLiteral"; + + public static final String INTERPRETSTRINGLITERAL = "org.osate.alisa.common.typing.InterpretStringLiteral"; + + public static final String INTERPRETBOOLEANLITERAL = "org.osate.alisa.common.typing.InterpretBooleanLiteral"; + + public static final String INTERPRETRANGE = "org.osate.alisa.common.typing.InterpretRange"; + + public static final String NOTIMPLEMENTED = "org.osate.alisa.common.typing.NotImplemented"; + + public static final String EQUALBOOLEAN = "org.osate.alisa.common.typing.EqualBoolean"; + + public static final String EQUALSTRING = "org.osate.alisa.common.typing.EqualString"; + + public static final String EQUALNUMBER = "org.osate.alisa.common.typing.EqualNumber"; + + public static final String EQUALRANGE = "org.osate.alisa.common.typing.EqualRange"; + + public static final String EQUALRECORD = "org.osate.alisa.common.typing.EqualRecord"; + + public static final String EQUALMODELELEMENT = "org.osate.alisa.common.typing.EqualModelElement"; + + public static final String EQUAL = "org.osate.alisa.common.typing.Equal"; + + public static final String COMPARENUMBERS = "org.osate.alisa.common.typing.CompareNumbers"; + + public static final String COMPARENUMBERRANGE = "org.osate.alisa.common.typing.CompareNumberRange"; + + public static final String COMPARERANGENUMBER = "org.osate.alisa.common.typing.CompareRangeNumber"; + + public static final String COMPARERANGES = "org.osate.alisa.common.typing.CompareRanges"; + + public static final String COMPARETONUMBER = "org.osate.alisa.common.typing.CompareToNumber"; + + private PolymorphicDispatcher combineNumericDispatcher; + + private PolymorphicDispatcher chooseRootDispatcher; + + private PolymorphicDispatcher errorPositionDispatcher; + + private PolymorphicDispatcher> interpretExpressionDispatcher; + + private PolymorphicDispatcher> interpretVariableDispatcher; + + private PolymorphicDispatcher> equalDispatcher; + + private PolymorphicDispatcher> compareDispatcher; + + private PolymorphicDispatcher> cmpNumDispatcher; + + public CommonInterpreter() { + init(); + } + + public void init() { + interpretExpressionDispatcher = buildPolymorphicDispatcher1( + "interpretExpressionImpl", 3, "|-", "~>"); + interpretVariableDispatcher = buildPolymorphicDispatcher1( + "interpretVariableImpl", 3, "||-", "~>"); + equalDispatcher = buildPolymorphicDispatcher1( + "equalImpl", 4, "|=", ":"); + compareDispatcher = buildPolymorphicDispatcher1( + "compareImpl", 4, "|>", ":"); + cmpNumDispatcher = buildPolymorphicDispatcher1( + "cmpNumImpl", 4, "|>", ":", "~>"); + combineNumericDispatcher = buildPolymorphicDispatcher( + "combineNumericImpl", 3); + chooseRootDispatcher = buildPolymorphicDispatcher( + "chooseRootImpl", 3); + errorPositionDispatcher = buildPolymorphicDispatcher( + "errorPositionImpl", 2); + } + + public NumberType combineNumeric(final NumberType left, final NumberType right) throws RuleFailedException { + return combineNumeric(null, left, right); + } + + public NumberType combineNumeric(final RuleApplicationTrace _trace_, final NumberType left, final NumberType right) throws RuleFailedException { + try { + return combineNumericInternal(_trace_, left, right); + } catch (Exception _e_combineNumeric) { + throw extractRuleFailedException(_e_combineNumeric); + } + } + + public NamedElement chooseRoot(final EObject io, final RuleEnvironment G) throws RuleFailedException { + return chooseRoot(null, io, G); + } + + public NamedElement chooseRoot(final RuleApplicationTrace _trace_, final EObject io, final RuleEnvironment G) throws RuleFailedException { + try { + return chooseRootInternal(_trace_, io, G); + } catch (Exception _e_chooseRoot) { + throw extractRuleFailedException(_e_chooseRoot); + } + } + + public String errorPosition(final EObject o) throws RuleFailedException { + return errorPosition(null, o); + } + + public String errorPosition(final RuleApplicationTrace _trace_, final EObject o) throws RuleFailedException { + try { + return errorPositionInternal(_trace_, o); + } catch (Exception _e_errorPosition) { + throw extractRuleFailedException(_e_errorPosition); + } + } + + public Result interpretExpression(final PropertyExpression expression) { + return interpretExpression(new RuleEnvironment(), null, expression); + } + + public Result interpretExpression(final RuleEnvironment _environment_, final PropertyExpression expression) { + return interpretExpression(_environment_, null, expression); + } + + public Result interpretExpression(final RuleEnvironment _environment_, final RuleApplicationTrace _trace_, final PropertyExpression expression) { + try { + return interpretExpressionInternal(_environment_, _trace_, expression); + } catch (Exception _e_interpretExpression) { + return resultForFailure(_e_interpretExpression); + } + } + + public Result interpretVariable(final AVariableDeclaration decl) { + return interpretVariable(new RuleEnvironment(), null, decl); + } + + public Result interpretVariable(final RuleEnvironment _environment_, final AVariableDeclaration decl) { + return interpretVariable(_environment_, null, decl); + } + + public Result interpretVariable(final RuleEnvironment _environment_, final RuleApplicationTrace _trace_, final AVariableDeclaration decl) { + try { + return interpretVariableInternal(_environment_, _trace_, decl); + } catch (Exception _e_interpretVariable) { + return resultForFailure(_e_interpretVariable); + } + } + + public Result equal(final PropertyValue left, final PropertyValue right) { + return equal(new RuleEnvironment(), null, left, right); + } + + public Result equal(final RuleEnvironment _environment_, final PropertyValue left, final PropertyValue right) { + return equal(_environment_, null, left, right); + } + + public Result equal(final RuleEnvironment _environment_, final RuleApplicationTrace _trace_, final PropertyValue left, final PropertyValue right) { + try { + return equalInternal(_environment_, _trace_, left, right); + } catch (Exception _e_equal) { + return resultForFailure(_e_equal); + } + } + + public Boolean equalSucceeded(final PropertyValue left, final PropertyValue right) { + return equalSucceeded(new RuleEnvironment(), null, left, right); + } + + public Boolean equalSucceeded(final RuleEnvironment _environment_, final PropertyValue left, final PropertyValue right) { + return equalSucceeded(_environment_, null, left, right); + } + + public Boolean equalSucceeded(final RuleEnvironment _environment_, final RuleApplicationTrace _trace_, final PropertyValue left, final PropertyValue right) { + try { + equalInternal(_environment_, _trace_, left, right); + return true; + } catch (Exception _e_equal) { + return false; + } + } + + public Result compare(final PropertyValue left, final PropertyValue right) { + return compare(new RuleEnvironment(), null, left, right); + } + + public Result compare(final RuleEnvironment _environment_, final PropertyValue left, final PropertyValue right) { + return compare(_environment_, null, left, right); + } + + public Result compare(final RuleEnvironment _environment_, final RuleApplicationTrace _trace_, final PropertyValue left, final PropertyValue right) { + try { + return compareInternal(_environment_, _trace_, left, right); + } catch (Exception _e_compare) { + return resultForFailure(_e_compare); + } + } + + public Boolean compareSucceeded(final PropertyValue left, final PropertyValue right) { + return compareSucceeded(new RuleEnvironment(), null, left, right); + } + + public Boolean compareSucceeded(final RuleEnvironment _environment_, final PropertyValue left, final PropertyValue right) { + return compareSucceeded(_environment_, null, left, right); + } + + public Boolean compareSucceeded(final RuleEnvironment _environment_, final RuleApplicationTrace _trace_, final PropertyValue left, final PropertyValue right) { + try { + compareInternal(_environment_, _trace_, left, right); + return true; + } catch (Exception _e_compare) { + return false; + } + } + + public Result cmpNum(final PropertyValue left, final PropertyValue right) { + return cmpNum(new RuleEnvironment(), null, left, right); + } + + public Result cmpNum(final RuleEnvironment _environment_, final PropertyValue left, final PropertyValue right) { + return cmpNum(_environment_, null, left, right); + } + + public Result cmpNum(final RuleEnvironment _environment_, final RuleApplicationTrace _trace_, final PropertyValue left, final PropertyValue right) { + try { + return cmpNumInternal(_environment_, _trace_, left, right); + } catch (Exception _e_cmpNum) { + return resultForFailure(_e_cmpNum); + } + } + + protected NumberType combineNumericInternal(final RuleApplicationTrace _trace_, final NumberType left, final NumberType right) { + try { + checkParamsNotNull(left, right); + return combineNumericDispatcher.invoke(_trace_, left, right); + } catch (Exception _e_combineNumeric) { + sneakyThrowRuleFailedException(_e_combineNumeric); + return null; + } + } + + protected void combineNumericThrowException(final String _error, final String _issue, final Exception _ex, final NumberType left, final NumberType right, final ErrorInformation[] _errorInformations) throws RuleFailedException { + throwRuleFailedException(_error, _issue, _ex, _errorInformations); + } + + protected NamedElement chooseRootInternal(final RuleApplicationTrace _trace_, final EObject io, final RuleEnvironment G) { + try { + checkParamsNotNull(io, G); + return chooseRootDispatcher.invoke(_trace_, io, G); + } catch (Exception _e_chooseRoot) { + sneakyThrowRuleFailedException(_e_chooseRoot); + return null; + } + } + + protected void chooseRootThrowException(final String _error, final String _issue, final Exception _ex, final EObject io, final RuleEnvironment G, final ErrorInformation[] _errorInformations) throws RuleFailedException { + throwRuleFailedException(_error, _issue, _ex, _errorInformations); + } + + protected String errorPositionInternal(final RuleApplicationTrace _trace_, final EObject o) { + try { + checkParamsNotNull(o); + return errorPositionDispatcher.invoke(_trace_, o); + } catch (Exception _e_errorPosition) { + sneakyThrowRuleFailedException(_e_errorPosition); + return null; + } + } + + protected void errorPositionThrowException(final String _error, final String _issue, final Exception _ex, final EObject o, final ErrorInformation[] _errorInformations) throws RuleFailedException { + throwRuleFailedException(_error, _issue, _ex, _errorInformations); + } + + protected Result interpretExpressionInternal(final RuleEnvironment _environment_, final RuleApplicationTrace _trace_, final PropertyExpression expression) { + try { + checkParamsNotNull(expression); + return interpretExpressionDispatcher.invoke(_environment_, _trace_, expression); + } catch (Exception _e_interpretExpression) { + sneakyThrowRuleFailedException(_e_interpretExpression); + return null; + } + } + + protected void interpretExpressionThrowException(final String _error, final String _issue, final Exception _ex, final PropertyExpression expression, final ErrorInformation[] _errorInformations) throws RuleFailedException { + throwRuleFailedException(_error, _issue, _ex, _errorInformations); + } + + protected Result interpretVariableInternal(final RuleEnvironment _environment_, final RuleApplicationTrace _trace_, final AVariableDeclaration decl) { + try { + checkParamsNotNull(decl); + return interpretVariableDispatcher.invoke(_environment_, _trace_, decl); + } catch (Exception _e_interpretVariable) { + sneakyThrowRuleFailedException(_e_interpretVariable); + return null; + } + } + + protected void interpretVariableThrowException(final String _error, final String _issue, final Exception _ex, final AVariableDeclaration decl, final ErrorInformation[] _errorInformations) throws RuleFailedException { + throwRuleFailedException(_error, _issue, _ex, _errorInformations); + } + + protected Result equalInternal(final RuleEnvironment _environment_, final RuleApplicationTrace _trace_, final PropertyValue left, final PropertyValue right) { + try { + checkParamsNotNull(left, right); + return equalDispatcher.invoke(_environment_, _trace_, left, right); + } catch (Exception _e_equal) { + sneakyThrowRuleFailedException(_e_equal); + return null; + } + } + + protected void equalThrowException(final String _error, final String _issue, final Exception _ex, final PropertyValue left, final PropertyValue right, final ErrorInformation[] _errorInformations) throws RuleFailedException { + throwRuleFailedException(_error, _issue, _ex, _errorInformations); + } + + protected Result compareInternal(final RuleEnvironment _environment_, final RuleApplicationTrace _trace_, final PropertyValue left, final PropertyValue right) { + try { + checkParamsNotNull(left, right); + return compareDispatcher.invoke(_environment_, _trace_, left, right); + } catch (Exception _e_compare) { + sneakyThrowRuleFailedException(_e_compare); + return null; + } + } + + protected void compareThrowException(final String _error, final String _issue, final Exception _ex, final PropertyValue left, final PropertyValue right, final ErrorInformation[] _errorInformations) throws RuleFailedException { + throwRuleFailedException(_error, _issue, _ex, _errorInformations); + } + + protected Result cmpNumInternal(final RuleEnvironment _environment_, final RuleApplicationTrace _trace_, final PropertyValue left, final PropertyValue right) { + try { + checkParamsNotNull(left, right); + return cmpNumDispatcher.invoke(_environment_, _trace_, left, right); + } catch (Exception _e_cmpNum) { + sneakyThrowRuleFailedException(_e_cmpNum); + return null; + } + } + + protected void cmpNumThrowException(final String _error, final String _issue, final Exception _ex, final PropertyValue left, final PropertyValue right, final ErrorInformation[] _errorInformations) throws RuleFailedException { + throwRuleFailedException(_error, _issue, _ex, _errorInformations); + } + + protected NumberType combineNumericImpl(final RuleApplicationTrace _trace_, final NumberType left, final NumberType right) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final NumberType _result_ = applyAuxFunCombineNumeric(_subtrace_, left, right); + addToTrace(_trace_, new Provider() { + public Object get() { + return auxFunName("combineNumeric") + "(" + stringRep(left) + ", " + stringRep(right)+ ")" + " = " + stringRep(_result_); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyAuxFunCombineNumeric) { + combineNumericThrowException(auxFunName("combineNumeric") + "(" + stringRep(left) + ", " + stringRep(right)+ ")", + COMBINENUMERIC, + e_applyAuxFunCombineNumeric, left, right, new ErrorInformation[] {new ErrorInformation(left), new ErrorInformation(right)}); + return null; + } + } + + protected NumberType applyAuxFunCombineNumeric(final RuleApplicationTrace _trace_, final NumberType left, final NumberType right) throws RuleFailedException { + NumberType _xblockexpression = null; + { + NumberType _xifexpression = null; + if (((left instanceof AadlInteger) && (right instanceof AadlInteger))) { + _xifexpression = Aadl2Factory.eINSTANCE.createAadlInteger(); + } else { + _xifexpression = Aadl2Factory.eINSTANCE.createAadlReal(); + } + final NumberType result = _xifexpression; + UnitsType _xifexpression_1 = null; + UnitsType _unitsType = left.getUnitsType(); + boolean _tripleNotEquals = (_unitsType != null); + if (_tripleNotEquals) { + _xifexpression_1 = left.getUnitsType(); + } else { + _xifexpression_1 = right.getUnitsType(); + } + result.setReferencedUnitsType(_xifexpression_1); + _xblockexpression = (result); + } + return _xblockexpression; + } + + protected NamedElement chooseRootImpl(final RuleApplicationTrace _trace_, final EObject obj, final RuleEnvironment G) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final NamedElement _result_ = applyAuxFunChooseRoot(_subtrace_, obj, G); + addToTrace(_trace_, new Provider() { + public Object get() { + return auxFunName("chooseRoot") + "(" + stringRep(obj) + ", " + stringRep(G)+ ")" + " = " + stringRep(_result_); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyAuxFunChooseRoot) { + chooseRootThrowException(auxFunName("chooseRoot") + "(" + stringRep(obj) + ", " + stringRep(G)+ ")", + CHOOSEROOT, + e_applyAuxFunChooseRoot, obj, G, new ErrorInformation[] {new ErrorInformation(obj)}); + return null; + } + } + + protected NamedElement applyAuxFunChooseRoot(final RuleApplicationTrace _trace_, final EObject obj, final RuleEnvironment G) throws RuleFailedException { + NamedElement _xblockexpression = null; + { + final NamedElement element = this.env(G, "target", NamedElement.class); + _xblockexpression = (element); + } + return _xblockexpression; + } + + protected String errorPositionImpl(final RuleApplicationTrace _trace_, final EObject o) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final String _result_ = applyAuxFunErrorPosition(_subtrace_, o); + addToTrace(_trace_, new Provider() { + public Object get() { + return auxFunName("errorPosition") + "(" + stringRep(o)+ ")" + " = " + stringRep(_result_); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyAuxFunErrorPosition) { + errorPositionThrowException(auxFunName("errorPosition") + "(" + stringRep(o)+ ")", + ERRORPOSITION, + e_applyAuxFunErrorPosition, o, new ErrorInformation[] {new ErrorInformation(o)}); + return null; + } + } + + protected String applyAuxFunErrorPosition(final RuleApplicationTrace _trace_, final EObject o) throws RuleFailedException { + String _xblockexpression = null; + { + final String fileName = o.eResource().getURI().path(); + final int line = NodeModelUtils.findActualNodeFor(o).getStartLine(); + _xblockexpression = (((((" (" + fileName) + ":") + Integer.valueOf(line)) + ")")); + } + return _xblockexpression; + } + + protected Result interpretExpressionImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final ABinaryOperation binary) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleInterpretBinaryExpression(G, _subtrace_, binary); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("InterpretBinaryExpression") + stringRepForEnv(G) + " |- " + stringRep(binary) + " ~> " + stringRep(_result_.getFirst()); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleInterpretBinaryExpression) { + interpretExpressionThrowException(ruleName("InterpretBinaryExpression") + stringRepForEnv(G) + " |- " + stringRep(binary) + " ~> " + "PropertyValue", + INTERPRETBINARYEXPRESSION, + e_applyRuleInterpretBinaryExpression, binary, new ErrorInformation[] {new ErrorInformation(binary)}); + return null; + } + } + + protected Result applyRuleInterpretBinaryExpression(final RuleEnvironment G, final RuleApplicationTrace _trace_, final ABinaryOperation binary) throws RuleFailedException { + PropertyValue propVal = null; // output parameter + /* G |- binary.left ~> var PropertyValue leftVal */ + PropertyExpression _left = binary.getLeft(); + PropertyValue leftVal = null; + Result result = interpretExpressionInternal(G, _trace_, _left); + checkAssignableTo(result.getFirst(), PropertyValue.class); + leftVal = (PropertyValue) result.getFirst(); + + /* G |- binary.right ~> var PropertyValue rightVal */ + PropertyExpression _right = binary.getRight(); + PropertyValue rightVal = null; + Result result_1 = interpretExpressionInternal(G, _trace_, _right); + checkAssignableTo(result_1.getFirst(), PropertyValue.class); + rightVal = (PropertyValue) result_1.getFirst(); + + PropertyValue _switchResult = null; + Operation _operator = binary.getOperator(); + if (_operator != null) { + switch (_operator) { + case AND: + case OR: + case ALT_AND: + case ALT_OR: + BooleanLiteral _xblockexpression = null; + { + final BooleanLiteral boolVal = Aadl2Factory.eINSTANCE.createBooleanLiteral(); + final BooleanLiteral left = ((BooleanLiteral) leftVal); + final BooleanLiteral right = ((BooleanLiteral) rightVal); + boolean _xifexpression = false; + Operation _operator_1 = binary.getOperator(); + boolean _equals = Objects.equals(_operator_1, Operation.AND); + if (_equals) { + boolean _xifexpression_1 = false; + if ((left.getValue() && right.getValue())) { + _xifexpression_1 = true; + } else { + _xifexpression_1 = false; + } + _xifexpression = _xifexpression_1; + } else { + boolean _xifexpression_2 = false; + if ((left.getValue() || right.getValue())) { + _xifexpression_2 = true; + } else { + _xifexpression_2 = false; + } + _xifexpression = _xifexpression_2; + } + boolVal.setValue(_xifexpression); + _xblockexpression = (boolVal); + } + _switchResult = _xblockexpression; + break; + case EQ: + case NEQ: + BooleanLiteral _xblockexpression_1 = null; + { + final BooleanLiteral boolVal = Aadl2Factory.eINSTANCE.createBooleanLiteral(); + /* G |= leftVal : rightVal */ + boolean _ruleinvocation = equalSucceeded(G, _trace_, leftVal, rightVal); + boolVal.setValue(_ruleinvocation); + Operation _operator_1 = binary.getOperator(); + boolean _equals = Objects.equals(_operator_1, Operation.NEQ); + if (_equals) { + boolean _value = boolVal.getValue(); + boolean _not = (!_value); + boolVal.setValue(_not); + } + _xblockexpression_1 = (boolVal); + } + _switchResult = _xblockexpression_1; + break; + case LT: + BooleanLiteral _xblockexpression_2 = null; + { + final BooleanLiteral boolVal = Aadl2Factory.eINSTANCE.createBooleanLiteral(); + /* G, 'op' <- binary.operator |> leftVal : rightVal */ + Operation _operator_1 = binary.getOperator(); + boolean _ruleinvocation = compareSucceeded(environmentComposition( + G, environmentEntry("op", _operator_1) + ), _trace_, leftVal, rightVal); + boolVal.setValue(_ruleinvocation); + _xblockexpression_2 = (boolVal); + } + _switchResult = _xblockexpression_2; + break; + case LEQ: + BooleanLiteral _xblockexpression_3 = null; + { + final BooleanLiteral boolVal = Aadl2Factory.eINSTANCE.createBooleanLiteral(); + /* G, 'op' <- binary.operator |> leftVal : rightVal */ + Operation _operator_1 = binary.getOperator(); + boolean _ruleinvocation = compareSucceeded(environmentComposition( + G, environmentEntry("op", _operator_1) + ), _trace_, leftVal, rightVal); + boolVal.setValue(_ruleinvocation); + _xblockexpression_3 = (boolVal); + } + _switchResult = _xblockexpression_3; + break; + case GT: + BooleanLiteral _xblockexpression_4 = null; + { + final BooleanLiteral boolVal = Aadl2Factory.eINSTANCE.createBooleanLiteral(); + /* G, 'op' <- binary.operator |> leftVal : rightVal */ + Operation _operator_1 = binary.getOperator(); + boolean _ruleinvocation = compareSucceeded(environmentComposition( + G, environmentEntry("op", _operator_1) + ), _trace_, leftVal, rightVal); + boolVal.setValue(_ruleinvocation); + _xblockexpression_4 = (boolVal); + } + _switchResult = _xblockexpression_4; + break; + case GEQ: + BooleanLiteral _xblockexpression_5 = null; + { + final BooleanLiteral boolVal = Aadl2Factory.eINSTANCE.createBooleanLiteral(); + /* G, 'op' <- binary.operator |> leftVal : rightVal */ + Operation _operator_1 = binary.getOperator(); + boolean _ruleinvocation = compareSucceeded(environmentComposition( + G, environmentEntry("op", _operator_1) + ), _trace_, leftVal, rightVal); + boolVal.setValue(_ruleinvocation); + _xblockexpression_5 = (boolVal); + } + _switchResult = _xblockexpression_5; + break; + case IN: + BooleanLiteral _xblockexpression_6 = null; + { + final BooleanLiteral boolVal = Aadl2Factory.eINSTANCE.createBooleanLiteral(); + boolean _matched = false; + if (leftVal instanceof NumberValue) { + _matched=true; + /* G, 'op' <- Operation.LT |> leftVal : rightVal */ + boolean _ruleinvocation = compareSucceeded(environmentComposition( + G, environmentEntry("op", Operation.LT) + ), _trace_, ((NumberValue)leftVal), rightVal); + final boolean lessThan = _ruleinvocation; + /* G, 'op' <- Operation.GT |> leftVal : rightVal */ + boolean _ruleinvocation_1 = compareSucceeded(environmentComposition( + G, environmentEntry("op", Operation.GT) + ), _trace_, ((NumberValue)leftVal), rightVal); + final boolean greaterThan = _ruleinvocation_1; + boolVal.setValue((!(lessThan || greaterThan))); + } + if (!_matched) { + if (leftVal instanceof RangeValue) { + _matched=true; + /* G |- leftVal.minimum ~> var NumberValue min */ + PropertyExpression _minimum = ((RangeValue)leftVal).getMinimum(); + NumberValue min = null; + Result result_2 = interpretExpressionInternal(G, _trace_, _minimum); + checkAssignableTo(result_2.getFirst(), NumberValue.class); + min = (NumberValue) result_2.getFirst(); + + /* G |- leftVal.maximum ~> var NumberValue max */ + PropertyExpression _maximum = ((RangeValue)leftVal).getMaximum(); + NumberValue max = null; + Result result_3 = interpretExpressionInternal(G, _trace_, _maximum); + checkAssignableTo(result_3.getFirst(), NumberValue.class); + max = (NumberValue) result_3.getFirst(); + + /* G, 'op' <- Operation.LT |> min : rightVal */ + boolean _ruleinvocation = compareSucceeded(environmentComposition( + G, environmentEntry("op", Operation.LT) + ), _trace_, min, rightVal); + final boolean minLessThan = _ruleinvocation; + /* G, 'op' <- Operation.GT |> min : rightVal */ + boolean _ruleinvocation_1 = compareSucceeded(environmentComposition( + G, environmentEntry("op", Operation.GT) + ), _trace_, min, rightVal); + final boolean minGreaterThan = _ruleinvocation_1; + /* G, 'op' <- Operation.LT |> max : rightVal */ + boolean _ruleinvocation_2 = compareSucceeded(environmentComposition( + G, environmentEntry("op", Operation.LT) + ), _trace_, max, rightVal); + final boolean maxLessThan = _ruleinvocation_2; + /* G, 'op' <- Operation.GT |> max : rightVal */ + boolean _ruleinvocation_3 = compareSucceeded(environmentComposition( + G, environmentEntry("op", Operation.GT) + ), _trace_, max, rightVal); + final boolean maxGreaterThan = _ruleinvocation_3; + boolVal.setValue(((!(minLessThan || minGreaterThan)) && (!(maxLessThan || maxGreaterThan)))); + } + } + _xblockexpression_6 = (boolVal); + } + _switchResult = _xblockexpression_6; + break; + case PLUS: + _switchResult = InterpreterUtil.add(((NumberValue) leftVal), ((NumberValue) rightVal)); + break; + case MINUS: + _switchResult = InterpreterUtil.subtract(((NumberValue) leftVal), ((NumberValue) rightVal)); + break; + case MULT: + _switchResult = InterpreterUtil.multiply(((NumberValue) leftVal), ((NumberValue) rightVal)); + break; + case DIV: + _switchResult = InterpreterUtil.divide(((NumberValue) leftVal), ((NumberValue) rightVal)); + break; + case INTDIV: + _switchResult = InterpreterUtil.divideInt(((IntegerLiteral) leftVal), ((IntegerLiteral) rightVal)); + break; + case MOD: + _switchResult = InterpreterUtil.mod(((IntegerLiteral) leftVal), ((IntegerLiteral) rightVal)); + break; + default: + _switchResult = null; + break; + } + } else { + _switchResult = null; + } + propVal = _switchResult; + return new Result(propVal); + } + + protected Result interpretExpressionImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final AFunctionCall call) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleInterpretFunctionCall(G, _subtrace_, call); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("InterpretFunctionCall") + stringRepForEnv(G) + " |- " + stringRep(call) + " ~> " + stringRep(_result_.getFirst()); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleInterpretFunctionCall) { + interpretExpressionThrowException(ruleName("InterpretFunctionCall") + stringRepForEnv(G) + " |- " + stringRep(call) + " ~> " + "PropertyValue", + INTERPRETFUNCTIONCALL, + e_applyRuleInterpretFunctionCall, call, new ErrorInformation[] {new ErrorInformation(call)}); + return null; + } + } + + protected Result applyRuleInterpretFunctionCall(final RuleEnvironment G, final RuleApplicationTrace _trace_, final AFunctionCall call) throws RuleFailedException { + PropertyValue propVal = null; // output parameter + NumberValue _switchResult = null; + String _function = call.getFunction(); + if (_function != null) { + switch (_function) { + case "min": + final Function1 _function_1 = (PropertyExpression arg) -> { + NumberValue _xblockexpression = null; + { + /* G |- arg ~> var PropertyValue pval */ + PropertyValue pval = null; + Result result = interpretExpressionInternal(G, _trace_, arg); + checkAssignableTo(result.getFirst(), PropertyValue.class); + pval = (PropertyValue) result.getFirst(); + + NumberValue _xifexpression = null; + if ((pval instanceof RangeValue)) { + _xifexpression = ((RangeValue)pval).getMinimumValue(); + } else { + _xifexpression = ((NumberValue) pval); + } + _xblockexpression = _xifexpression; + } + return _xblockexpression; + }; + _switchResult = InterpreterUtil.min(ListExtensions.map(call.getArguments(), _function_1)); + break; + case "max": + final Function1 _function_2 = (PropertyExpression arg) -> { + NumberValue _xblockexpression = null; + { + /* G |- arg ~> var PropertyValue pval */ + PropertyValue pval = null; + Result result = interpretExpressionInternal(G, _trace_, arg); + checkAssignableTo(result.getFirst(), PropertyValue.class); + pval = (PropertyValue) result.getFirst(); + + NumberValue _xifexpression = null; + if ((pval instanceof RangeValue)) { + _xifexpression = ((RangeValue)pval).getMaximumValue(); + } else { + _xifexpression = ((NumberValue) pval); + } + _xblockexpression = _xifexpression; + } + return _xblockexpression; + }; + _switchResult = InterpreterUtil.max(ListExtensions.map(call.getArguments(), _function_2)); + break; + case "abs": + NumberValue _xblockexpression = null; + { + /* G |- call.arguments.get(0) ~> var NumberValue pVal */ + PropertyExpression _get = call.getArguments().get(0); + NumberValue pVal = null; + Result result = interpretExpressionInternal(G, _trace_, _get); + checkAssignableTo(result.getFirst(), NumberValue.class); + pVal = (NumberValue) result.getFirst(); + + boolean _matched = false; + if (pVal instanceof RealLiteral) { + _matched=true; + double _xifexpression = (double) 0; + double _value = ((RealLiteral)pVal).getValue(); + boolean _lessThan = (_value < 0); + if (_lessThan) { + double _value_1 = ((RealLiteral)pVal).getValue(); + _xifexpression = (-_value_1); + } else { + _xifexpression = ((RealLiteral)pVal).getValue(); + } + ((RealLiteral)pVal).setValue(_xifexpression); + } + if (!_matched) { + if (pVal instanceof IntegerLiteral) { + _matched=true; + long _xifexpression = (long) 0; + long _value = ((IntegerLiteral)pVal).getValue(); + boolean _lessThan = (_value < 0); + if (_lessThan) { + long _value_1 = ((IntegerLiteral)pVal).getValue(); + _xifexpression = (-_value_1); + } else { + _xifexpression = ((IntegerLiteral)pVal).getValue(); + } + ((IntegerLiteral)pVal).setValue(_xifexpression); + } + } + _xblockexpression = (pVal); + } + _switchResult = _xblockexpression; + break; + case "round": + IntegerLiteral _xblockexpression_1 = null; + { + /* G |- call.arguments.get(0) ~> var NumberValue pVal */ + PropertyExpression _get = call.getArguments().get(0); + NumberValue pVal = null; + Result result = interpretExpressionInternal(G, _trace_, _get); + checkAssignableTo(result.getFirst(), NumberValue.class); + pVal = (NumberValue) result.getFirst(); + + _xblockexpression_1 = (InterpreterUtil.round(pVal)); + } + _switchResult = _xblockexpression_1; + break; + case "ceil": + IntegerLiteral _xblockexpression_2 = null; + { + /* G |- call.arguments.get(0) ~> var NumberValue pVal */ + PropertyExpression _get = call.getArguments().get(0); + NumberValue pVal = null; + Result result = interpretExpressionInternal(G, _trace_, _get); + checkAssignableTo(result.getFirst(), NumberValue.class); + pVal = (NumberValue) result.getFirst(); + + _xblockexpression_2 = (InterpreterUtil.ceil(pVal)); + } + _switchResult = _xblockexpression_2; + break; + case "floor": + IntegerLiteral _xblockexpression_3 = null; + { + /* G |- call.arguments.get(0) ~> var NumberValue pVal */ + PropertyExpression _get = call.getArguments().get(0); + NumberValue pVal = null; + Result result = interpretExpressionInternal(G, _trace_, _get); + checkAssignableTo(result.getFirst(), NumberValue.class); + pVal = (NumberValue) result.getFirst(); + + _xblockexpression_3 = (InterpreterUtil.floor(pVal)); + } + _switchResult = _xblockexpression_3; + break; + } + } + propVal = _switchResult; + return new Result(propVal); + } + + protected Result interpretExpressionImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final AUnaryOperation unary) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleInterpretUnaryExpression(G, _subtrace_, unary); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("InterpretUnaryExpression") + stringRepForEnv(G) + " |- " + stringRep(unary) + " ~> " + stringRep(_result_.getFirst()); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleInterpretUnaryExpression) { + interpretExpressionThrowException(ruleName("InterpretUnaryExpression") + stringRepForEnv(G) + " |- " + stringRep(unary) + " ~> " + "PropertyValue", + INTERPRETUNARYEXPRESSION, + e_applyRuleInterpretUnaryExpression, unary, new ErrorInformation[] {new ErrorInformation(unary)}); + return null; + } + } + + protected Result applyRuleInterpretUnaryExpression(final RuleEnvironment G, final RuleApplicationTrace _trace_, final AUnaryOperation unary) throws RuleFailedException { + PropertyValue propVal = null; // output parameter + /* G |- unary.operand ~> propVal */ + PropertyExpression _operand = unary.getOperand(); + Result result = interpretExpressionInternal(G, _trace_, _operand); + checkAssignableTo(result.getFirst(), PropertyValue.class); + propVal = (PropertyValue) result.getFirst(); + + Operation _operator = unary.getOperator(); + if (_operator != null) { + switch (_operator) { + case MINUS: + boolean _matched = false; + if (propVal instanceof RealLiteral) { + _matched=true; + double _value = ((RealLiteral)propVal).getValue(); + double _minus = (-_value); + ((RealLiteral)propVal).setValue(_minus); + } + if (!_matched) { + if (propVal instanceof IntegerLiteral) { + _matched=true; + long _value = ((IntegerLiteral)propVal).getValue(); + long _minus = (-_value); + ((IntegerLiteral)propVal).setValue(_minus); + } + } + break; + case NOT: + boolean _matched_1 = false; + if (propVal instanceof BooleanLiteral) { + _matched_1=true; + boolean _value = ((BooleanLiteral)propVal).getValue(); + boolean _not = (!_value); + ((BooleanLiteral)propVal).setValue(_not); + } + break; + default: + break; + } + } else { + } + return new Result(propVal); + } + + protected Result interpretExpressionImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final AUnitExpression unit) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleInterpretUnitExpression(G, _subtrace_, unit); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("InterpretUnitExpression") + stringRepForEnv(G) + " |- " + stringRep(unit) + " ~> " + stringRep(_result_.getFirst()); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleInterpretUnitExpression) { + interpretExpressionThrowException(ruleName("InterpretUnitExpression") + stringRepForEnv(G) + " |- " + stringRep(unit) + " ~> " + "PropertyValue", + INTERPRETUNITEXPRESSION, + e_applyRuleInterpretUnitExpression, unit, new ErrorInformation[] {new ErrorInformation(unit)}); + return null; + } + } + + protected Result applyRuleInterpretUnitExpression(final RuleEnvironment G, final RuleApplicationTrace _trace_, final AUnitExpression unit) throws RuleFailedException { + PropertyValue number = null; // output parameter + /* G |- unit.expression ~> var PropertyValue propval */ + PropertyExpression _expression = unit.getExpression(); + PropertyValue propval = null; + Result result = interpretExpressionInternal(G, _trace_, _expression); + checkAssignableTo(result.getFirst(), PropertyValue.class); + propval = (PropertyValue) result.getFirst(); + + if ((propval instanceof NumberValue)) { + final NumberValue num = EcoreUtil.copy(((NumberValue)propval)); + final boolean unit_add = (((!unit.isDrop()) && (!unit.isConvert())) && (unit.getUnit() != null)); + if ((unit.isDrop() || unit.isConvert())) { + boolean _matched = false; + if (num instanceof IntegerLiteral) { + _matched=true; + ((IntegerLiteral)num).setValue(Math.round(((IntegerLiteral)num).getScaledValue(unit.getUnit()))); + } + if (!_matched) { + if (num instanceof RealLiteral) { + _matched=true; + ((RealLiteral)num).setValue(((RealLiteral)num).getScaledValue(unit.getUnit())); + } + } + if (!_matched) { + } + } + boolean _isDrop = unit.isDrop(); + if (_isDrop) { + num.setUnit(null); + } else { + if ((unit.isConvert() || unit_add)) { + num.setUnit(unit.getUnit()); + } + } + number = num; + } else { + number = propval; + } + return new Result(number); + } + + protected Result interpretVariableImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final ValDeclaration varDecl) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleInterpretVal(G, _subtrace_, varDecl); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("InterpretVal") + stringRepForEnv(G) + " ||- " + stringRep(varDecl) + " ~> " + stringRep(_result_.getFirst()); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleInterpretVal) { + interpretVariableThrowException(ruleName("InterpretVal") + stringRepForEnv(G) + " ||- " + stringRep(varDecl) + " ~> " + "PropertyValue", + INTERPRETVAL, + e_applyRuleInterpretVal, varDecl, new ErrorInformation[] {new ErrorInformation(varDecl)}); + return null; + } + } + + protected Result applyRuleInterpretVal(final RuleEnvironment G, final RuleApplicationTrace _trace_, final ValDeclaration varDecl) throws RuleFailedException { + PropertyValue propVal = null; // output parameter + Object _env = this.env(G, "vals", Object.class); + final HashMap map = ((HashMap) _env); + boolean _containsKey = map.containsKey(varDecl); + if (_containsKey) { + propVal = map.get(varDecl); + } else { + /* G |- varDecl.value ~> propVal */ + PropertyExpression _value = varDecl.getValue(); + Result result = interpretExpressionInternal(G, _trace_, _value); + checkAssignableTo(result.getFirst(), PropertyValue.class); + propVal = (PropertyValue) result.getFirst(); + + map.put(varDecl, propVal); + } + return new Result(propVal); + } + + protected Result interpretVariableImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final ComputeDeclaration varDecl) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleInterpretCompute(G, _subtrace_, varDecl); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("InterpretCompute") + stringRepForEnv(G) + " ||- " + stringRep(varDecl) + " ~> " + stringRep(_result_.getFirst()); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleInterpretCompute) { + interpretVariableThrowException(ruleName("InterpretCompute") + stringRepForEnv(G) + " ||- " + stringRep(varDecl) + " ~> " + "PropertyValue", + INTERPRETCOMPUTE, + e_applyRuleInterpretCompute, varDecl, new ErrorInformation[] {new ErrorInformation(varDecl)}); + return null; + } + } + + protected Result applyRuleInterpretCompute(final RuleEnvironment G, final RuleApplicationTrace _trace_, final ComputeDeclaration varDecl) throws RuleFailedException { + PropertyValue propVal = null; // output parameter + /* { val map = env(G, 'computes', Object) as HashMap map.containsKey(varDecl.name) propVal = map.get(varDecl.name) } or { fail error 'interpreter: compute variable ' + varDecl.name + ' has no value' } */ + { + RuleFailedException previousFailure = null; + try { + Object _env = this.env(G, "computes", Object.class); + final HashMap map = ((HashMap) _env); + boolean _containsKey = map.containsKey(varDecl.getName()); + /* map.containsKey(varDecl.name) */ + if (!_containsKey) { + sneakyThrowRuleFailedException("map.containsKey(varDecl.name)"); + } + propVal = map.get(varDecl.getName()); + } catch (Exception e) { + previousFailure = extractRuleFailedException(e); + /* fail error 'interpreter: compute variable ' + varDecl.name + ' has no value' */ + String _name = varDecl.getName(); + String _plus = ("interpreter: compute variable " + _name); + String _plus_1 = (_plus + " has no value"); + String error = _plus_1; + throwForExplicitFail(error, new ErrorInformation(null, null)); + } + } + return new Result(propVal); + } + + protected Result interpretExpressionImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final AVariableReference varRef) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleInterpretVarRef(G, _subtrace_, varRef); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("InterpretVarRef") + stringRepForEnv(G) + " |- " + stringRep(varRef) + " ~> " + stringRep(_result_.getFirst()); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleInterpretVarRef) { + interpretExpressionThrowException(ruleName("InterpretVarRef") + stringRepForEnv(G) + " |- " + stringRep(varRef) + " ~> " + "PropertyValue", + INTERPRETVARREF, + e_applyRuleInterpretVarRef, varRef, new ErrorInformation[] {new ErrorInformation(varRef)}); + return null; + } + } + + protected Result applyRuleInterpretVarRef(final RuleEnvironment G, final RuleApplicationTrace _trace_, final AVariableReference varRef) throws RuleFailedException { + PropertyValue propVal = null; // output parameter + /* G ||- varRef.variable ~> propVal */ + AVariableDeclaration _variable = varRef.getVariable(); + Result result = interpretVariableInternal(G, _trace_, _variable); + checkAssignableTo(result.getFirst(), PropertyValue.class); + propVal = (PropertyValue) result.getFirst(); + + return new Result(propVal); + } + + protected Result interpretExpressionImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final AConditional ite) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleInterpetITE(G, _subtrace_, ite); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("InterpetITE") + stringRepForEnv(G) + " |- " + stringRep(ite) + " ~> " + stringRep(_result_.getFirst()); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleInterpetITE) { + interpretExpressionThrowException(ruleName("InterpetITE") + stringRepForEnv(G) + " |- " + stringRep(ite) + " ~> " + "PropertyValue", + INTERPETITE, + e_applyRuleInterpetITE, ite, new ErrorInformation[] {new ErrorInformation(ite)}); + return null; + } + } + + protected Result applyRuleInterpetITE(final RuleEnvironment G, final RuleApplicationTrace _trace_, final AConditional ite) throws RuleFailedException { + PropertyValue propVal = null; // output parameter + /* G |- ite.^if ~> var BooleanLiteral cond */ + PropertyExpression _if = ite.getIf(); + BooleanLiteral cond = null; + Result result = interpretExpressionInternal(G, _trace_, _if); + checkAssignableTo(result.getFirst(), BooleanLiteral.class); + cond = (BooleanLiteral) result.getFirst(); + + boolean _value = cond.getValue(); + if (_value) { + /* G |- ite.then ~> propVal */ + PropertyExpression _then = ite.getThen(); + Result result_1 = interpretExpressionInternal(G, _trace_, _then); + checkAssignableTo(result_1.getFirst(), PropertyValue.class); + propVal = (PropertyValue) result_1.getFirst(); + + } else { + /* G |- ite.^else ~> propVal */ + PropertyExpression _else = ite.getElse(); + Result result_2 = interpretExpressionInternal(G, _trace_, _else); + checkAssignableTo(result_2.getFirst(), PropertyValue.class); + propVal = (PropertyValue) result_2.getFirst(); + + } + return new Result(propVal); + } + + protected Result interpretExpressionImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final AModelReference ref) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleInterpretModelReference(G, _subtrace_, ref); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("InterpretModelReference") + stringRepForEnv(G) + " |- " + stringRep(ref) + " ~> " + stringRep(_result_.getFirst()); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleInterpretModelReference) { + interpretExpressionThrowException(ruleName("InterpretModelReference") + stringRepForEnv(G) + " |- " + stringRep(ref) + " ~> " + "InstanceReferenceValue", + INTERPRETMODELREFERENCE, + e_applyRuleInterpretModelReference, ref, new ErrorInformation[] {new ErrorInformation(ref)}); + return null; + } + } + + protected Result applyRuleInterpretModelReference(final RuleEnvironment G, final RuleApplicationTrace _trace_, final AModelReference ref) throws RuleFailedException { + InstanceReferenceValue propVal = null; // output parameter + InstanceObject _xblockexpression = null; + { + final NamedElement root = this.chooseRootInternal(_trace_, ref, G); + _xblockexpression = (InterpreterUtil.resolve(ref, root)); + } + final InstanceObject resolved = _xblockexpression; + /* { resolved !== null propVal = InstanceFactory.eINSTANCE.createInstanceReferenceValue propVal.referencedInstanceObject = resolved } or { fail error 'cannot resolve reference to model element ' + NodeModelUtils.findActualNodeFor(ref).text + errorPosition(ref) } */ + { + RuleFailedException previousFailure = null; + try { + /* resolved !== null */ + if (!(resolved != null)) { + sneakyThrowRuleFailedException("resolved !== null"); + } + propVal = InstanceFactory.eINSTANCE.createInstanceReferenceValue(); + propVal.setReferencedInstanceObject(resolved); + } catch (Exception e) { + previousFailure = extractRuleFailedException(e); + /* fail error 'cannot resolve reference to model element ' + NodeModelUtils.findActualNodeFor(ref).text + errorPosition(ref) */ + String _text = NodeModelUtils.findActualNodeFor(ref).getText(); + String _plus = ("cannot resolve reference to model element " + _text); + String _errorPosition = this.errorPositionInternal(_trace_, ref); + String _plus_1 = (_plus + _errorPosition); + String error = _plus_1; + throwForExplicitFail(error, new ErrorInformation(null, null)); + } + } + return new Result(propVal); + } + + protected Result interpretExpressionImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final APropertyReference prop) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleInterpretPropertyReference(G, _subtrace_, prop); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("InterpretPropertyReference") + stringRepForEnv(G) + " |- " + stringRep(prop) + " ~> " + stringRep(_result_.getFirst()); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleInterpretPropertyReference) { + interpretExpressionThrowException(ruleName("InterpretPropertyReference") + stringRepForEnv(G) + " |- " + stringRep(prop) + " ~> " + "PropertyValue", + INTERPRETPROPERTYREFERENCE, + e_applyRuleInterpretPropertyReference, prop, new ErrorInformation[] {new ErrorInformation(prop)}); + return null; + } + } + + protected Result applyRuleInterpretPropertyReference(final RuleEnvironment G, final RuleApplicationTrace _trace_, final APropertyReference prop) throws RuleFailedException { + PropertyValue propVal = null; // output parameter + NamedElement io = null; + /* { prop.modelElementReference !== null G |- prop.modelElementReference ~> var InstanceReferenceValue element io = element.referencedInstanceObject } or { io = chooseRoot(prop, G) } */ + { + RuleFailedException previousFailure = null; + try { + AModelReference _modelElementReference = prop.getModelElementReference(); + boolean _tripleNotEquals = (_modelElementReference != null); + /* prop.modelElementReference !== null */ + if (!_tripleNotEquals) { + sneakyThrowRuleFailedException("prop.modelElementReference !== null"); + } + /* G |- prop.modelElementReference ~> var InstanceReferenceValue element */ + AModelReference _modelElementReference_1 = prop.getModelElementReference(); + InstanceReferenceValue element = null; + Result result = interpretExpressionInternal(G, _trace_, _modelElementReference_1); + checkAssignableTo(result.getFirst(), InstanceReferenceValue.class); + element = (InstanceReferenceValue) result.getFirst(); + + io = element.getReferencedInstanceObject(); + } catch (Exception e) { + previousFailure = extractRuleFailedException(e); + io = this.chooseRootInternal(_trace_, prop, G); + } + } + final AbstractNamedValue namedVal = prop.getProperty(); + PropertyExpression _switchResult = null; + boolean _matched = false; + if (namedVal instanceof Property) { + _matched=true; + PropertyExpression _xtrycatchfinallyexpression = null; + try { + _xtrycatchfinallyexpression = io.getSimplePropertyValue(((Property)namedVal)); + } catch (final Throwable _t) { + if (_t instanceof Exception) { + _xtrycatchfinallyexpression = null; + } else { + throw Exceptions.sneakyThrow(_t); + } + } + _switchResult = _xtrycatchfinallyexpression; + } + if (!_matched) { + if (namedVal instanceof PropertyConstant) { + _matched=true; + _switchResult = ((PropertyConstant)namedVal).getConstantValue(); + } + } + if (!_matched) { + _switchResult = null; + } + final PropertyExpression pexp = _switchResult; + PropertyValue _xifexpression = null; + if ((pexp instanceof PropertyValue)) { + _xifexpression = ((PropertyValue)pexp); + } else { + _xifexpression = null; + } + propVal = _xifexpression; + /* propVal !== null or { fail error 'cannot retrieve property value ' + NodeModelUtils.findActualNodeFor(prop).text + errorPosition(prop) } */ + { + RuleFailedException previousFailure = null; + try { + /* propVal !== null */ + if (!(propVal != null)) { + sneakyThrowRuleFailedException("propVal !== null"); + } + } catch (Exception e_1) { + previousFailure = extractRuleFailedException(e_1); + /* fail error 'cannot retrieve property value ' + NodeModelUtils.findActualNodeFor(prop).text + errorPosition(prop) */ + String _text = NodeModelUtils.findActualNodeFor(prop).getText(); + String _plus = ("cannot retrieve property value " + _text); + String _errorPosition = this.errorPositionInternal(_trace_, prop); + String _plus_1 = (_plus + _errorPosition); + String error = _plus_1; + throwForExplicitFail(error, new ErrorInformation(null, null)); + } + } + return new Result(propVal); + } + + protected Result interpretExpressionImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final IntegerLiteral integer) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleInterpretIntegerLiteral(G, _subtrace_, integer); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("InterpretIntegerLiteral") + stringRepForEnv(G) + " |- " + stringRep(integer) + " ~> " + stringRep(_result_.getFirst()); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleInterpretIntegerLiteral) { + interpretExpressionThrowException(ruleName("InterpretIntegerLiteral") + stringRepForEnv(G) + " |- " + stringRep(integer) + " ~> " + "IntegerLiteral", + INTERPRETINTEGERLITERAL, + e_applyRuleInterpretIntegerLiteral, integer, new ErrorInformation[] {new ErrorInformation(integer)}); + return null; + } + } + + protected Result applyRuleInterpretIntegerLiteral(final RuleEnvironment G, final RuleApplicationTrace _trace_, final IntegerLiteral integer) throws RuleFailedException { + + return new Result(_applyRuleInterpretIntegerLiteral_1(G, integer)); + } + + private IntegerLiteral _applyRuleInterpretIntegerLiteral_1(final RuleEnvironment G, final IntegerLiteral integer) throws RuleFailedException { + IntegerLiteral _xblockexpression = null; + { + final IntegerLiteral intVal = Aadl2Factory.eINSTANCE.createIntegerLiteral(); + intVal.setValue(integer.getValue()); + _xblockexpression = (intVal); + } + return _xblockexpression; + } + + protected Result interpretExpressionImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final RealLiteral real) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleInterpretRealLiteral(G, _subtrace_, real); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("InterpretRealLiteral") + stringRepForEnv(G) + " |- " + stringRep(real) + " ~> " + stringRep(_result_.getFirst()); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleInterpretRealLiteral) { + interpretExpressionThrowException(ruleName("InterpretRealLiteral") + stringRepForEnv(G) + " |- " + stringRep(real) + " ~> " + "RealLiteral", + INTERPRETREALLITERAL, + e_applyRuleInterpretRealLiteral, real, new ErrorInformation[] {new ErrorInformation(real)}); + return null; + } + } + + protected Result applyRuleInterpretRealLiteral(final RuleEnvironment G, final RuleApplicationTrace _trace_, final RealLiteral real) throws RuleFailedException { + + return new Result(_applyRuleInterpretRealLiteral_1(G, real)); + } + + private RealLiteral _applyRuleInterpretRealLiteral_1(final RuleEnvironment G, final RealLiteral real) throws RuleFailedException { + RealLiteral _xblockexpression = null; + { + final RealLiteral realVal = Aadl2Factory.eINSTANCE.createRealLiteral(); + realVal.setValue(real.getValue()); + _xblockexpression = (realVal); + } + return _xblockexpression; + } + + protected Result interpretExpressionImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final StringLiteral string) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleInterpretStringLiteral(G, _subtrace_, string); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("InterpretStringLiteral") + stringRepForEnv(G) + " |- " + stringRep(string) + " ~> " + stringRep(_result_.getFirst()); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleInterpretStringLiteral) { + interpretExpressionThrowException(ruleName("InterpretStringLiteral") + stringRepForEnv(G) + " |- " + stringRep(string) + " ~> " + "StringLiteral", + INTERPRETSTRINGLITERAL, + e_applyRuleInterpretStringLiteral, string, new ErrorInformation[] {new ErrorInformation(string)}); + return null; + } + } + + protected Result applyRuleInterpretStringLiteral(final RuleEnvironment G, final RuleApplicationTrace _trace_, final StringLiteral string) throws RuleFailedException { + + return new Result(_applyRuleInterpretStringLiteral_1(G, string)); + } + + private StringLiteral _applyRuleInterpretStringLiteral_1(final RuleEnvironment G, final StringLiteral string) throws RuleFailedException { + StringLiteral _xblockexpression = null; + { + final StringLiteral stringVal = Aadl2Factory.eINSTANCE.createStringLiteral(); + stringVal.setValue(string.getValue()); + _xblockexpression = (stringVal); + } + return _xblockexpression; + } + + protected Result interpretExpressionImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final BooleanLiteral bool) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleInterpretBooleanLiteral(G, _subtrace_, bool); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("InterpretBooleanLiteral") + stringRepForEnv(G) + " |- " + stringRep(bool) + " ~> " + stringRep(_result_.getFirst()); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleInterpretBooleanLiteral) { + interpretExpressionThrowException(ruleName("InterpretBooleanLiteral") + stringRepForEnv(G) + " |- " + stringRep(bool) + " ~> " + "BooleanLiteral", + INTERPRETBOOLEANLITERAL, + e_applyRuleInterpretBooleanLiteral, bool, new ErrorInformation[] {new ErrorInformation(bool)}); + return null; + } + } + + protected Result applyRuleInterpretBooleanLiteral(final RuleEnvironment G, final RuleApplicationTrace _trace_, final BooleanLiteral bool) throws RuleFailedException { + + return new Result(_applyRuleInterpretBooleanLiteral_1(G, bool)); + } + + private BooleanLiteral _applyRuleInterpretBooleanLiteral_1(final RuleEnvironment G, final BooleanLiteral bool) throws RuleFailedException { + BooleanLiteral _xblockexpression = null; + { + final BooleanLiteral boolVal = Aadl2Factory.eINSTANCE.createBooleanLiteral(); + boolVal.setValue(bool.getValue()); + _xblockexpression = (boolVal); + } + return _xblockexpression; + } + + protected Result interpretExpressionImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final ARange range) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleInterpretRange(G, _subtrace_, range); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("InterpretRange") + stringRepForEnv(G) + " |- " + stringRep(range) + " ~> " + stringRep(_result_.getFirst()); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleInterpretRange) { + interpretExpressionThrowException(ruleName("InterpretRange") + stringRepForEnv(G) + " |- " + stringRep(range) + " ~> " + "PropertyValue", + INTERPRETRANGE, + e_applyRuleInterpretRange, range, new ErrorInformation[] {new ErrorInformation(range)}); + return null; + } + } + + protected Result applyRuleInterpretRange(final RuleEnvironment G, final RuleApplicationTrace _trace_, final ARange range) throws RuleFailedException { + PropertyValue propVal = null; // output parameter + final RangeValue rangeVal = Aadl2Factory.eINSTANCE.createRangeValue(); + /* G |- range.minimum ~> var NumberValue lower */ + PropertyExpression _minimum = range.getMinimum(); + NumberValue lower = null; + Result result = interpretExpressionInternal(G, _trace_, _minimum); + checkAssignableTo(result.getFirst(), NumberValue.class); + lower = (NumberValue) result.getFirst(); + + /* G |- range.maximum ~> var NumberValue upper */ + PropertyExpression _maximum = range.getMaximum(); + NumberValue upper = null; + Result result_1 = interpretExpressionInternal(G, _trace_, _maximum); + checkAssignableTo(result_1.getFirst(), NumberValue.class); + upper = (NumberValue) result_1.getFirst(); + + rangeVal.setMinimum(lower); + rangeVal.setMaximum(upper); + propVal = rangeVal; + return new Result(propVal); + } + + protected Result interpretExpressionImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final PropertyExpression expression) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleNotImplemented(G, _subtrace_, expression); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("NotImplemented") + stringRepForEnv(G) + " |- " + stringRep(expression) + " ~> " + stringRep(_result_.getFirst()); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleNotImplemented) { + interpretExpressionThrowException(ruleName("NotImplemented") + stringRepForEnv(G) + " |- " + stringRep(expression) + " ~> " + "PropertyValue", + NOTIMPLEMENTED, + e_applyRuleNotImplemented, expression, new ErrorInformation[] {new ErrorInformation(expression)}); + return null; + } + } + + protected Result applyRuleNotImplemented(final RuleEnvironment G, final RuleApplicationTrace _trace_, final PropertyExpression expression) throws RuleFailedException { + PropertyValue propVal = null; // output parameter + /* fail error 'not implemented' source expression */ + String error = "not implemented"; + EObject source = expression; + throwForExplicitFail(error, new ErrorInformation(source, null)); + return new Result(propVal); + } + + protected Result equalImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final BooleanLiteral left, final BooleanLiteral right) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleEqualBoolean(G, _subtrace_, left, right); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("EqualBoolean") + stringRepForEnv(G) + " |= " + stringRep(left) + " : " + stringRep(right); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleEqualBoolean) { + equalThrowException(ruleName("EqualBoolean") + stringRepForEnv(G) + " |= " + stringRep(left) + " : " + stringRep(right), + EQUALBOOLEAN, + e_applyRuleEqualBoolean, left, right, new ErrorInformation[] {new ErrorInformation(left), new ErrorInformation(right)}); + return null; + } + } + + protected Result applyRuleEqualBoolean(final RuleEnvironment G, final RuleApplicationTrace _trace_, final BooleanLiteral left, final BooleanLiteral right) throws RuleFailedException { + /* left == right */ + if (!Objects.equals(left, right)) { + sneakyThrowRuleFailedException("left == right"); + } + return new Result(true); + } + + protected Result equalImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final StringLiteral left, final StringLiteral right) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleEqualString(G, _subtrace_, left, right); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("EqualString") + stringRepForEnv(G) + " |= " + stringRep(left) + " : " + stringRep(right); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleEqualString) { + equalThrowException(ruleName("EqualString") + stringRepForEnv(G) + " |= " + stringRep(left) + " : " + stringRep(right), + EQUALSTRING, + e_applyRuleEqualString, left, right, new ErrorInformation[] {new ErrorInformation(left), new ErrorInformation(right)}); + return null; + } + } + + protected Result applyRuleEqualString(final RuleEnvironment G, final RuleApplicationTrace _trace_, final StringLiteral left, final StringLiteral right) throws RuleFailedException { + /* left.equals(right) */ + if (!left.equals(right)) { + sneakyThrowRuleFailedException("left.equals(right)"); + } + return new Result(true); + } + + protected Result equalImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final NumberValue left, final NumberValue right) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleEqualNumber(G, _subtrace_, left, right); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("EqualNumber") + stringRepForEnv(G) + " |= " + stringRep(left) + " : " + stringRep(right); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleEqualNumber) { + equalThrowException(ruleName("EqualNumber") + stringRepForEnv(G) + " |= " + stringRep(left) + " : " + stringRep(right), + EQUALNUMBER, + e_applyRuleEqualNumber, left, right, new ErrorInformation[] {new ErrorInformation(left), new ErrorInformation(right)}); + return null; + } + } + + protected Result applyRuleEqualNumber(final RuleEnvironment G, final RuleApplicationTrace _trace_, final NumberValue left, final NumberValue right) throws RuleFailedException { + int _compareTo = InterpreterUtil.compareTo(left, right); + /* left.compareTo(right) == 0 */ + if (!(_compareTo == 0)) { + sneakyThrowRuleFailedException("left.compareTo(right) == 0"); + } + return new Result(true); + } + + protected Result equalImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final RangeValue left, final RangeValue right) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleEqualRange(G, _subtrace_, left, right); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("EqualRange") + stringRepForEnv(G) + " |= " + stringRep(left) + " : " + stringRep(right); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleEqualRange) { + equalThrowException(ruleName("EqualRange") + stringRepForEnv(G) + " |= " + stringRep(left) + " : " + stringRep(right), + EQUALRANGE, + e_applyRuleEqualRange, left, right, new ErrorInformation[] {new ErrorInformation(left), new ErrorInformation(right)}); + return null; + } + } + + protected Result applyRuleEqualRange(final RuleEnvironment G, final RuleApplicationTrace _trace_, final RangeValue left, final RangeValue right) throws RuleFailedException { + /* G |- left.minimum ~> var NumberValue leftMin */ + PropertyExpression _minimum = left.getMinimum(); + NumberValue leftMin = null; + Result result = interpretExpressionInternal(G, _trace_, _minimum); + checkAssignableTo(result.getFirst(), NumberValue.class); + leftMin = (NumberValue) result.getFirst(); + + /* G |- right.minimum ~> var NumberValue rightMin */ + PropertyExpression _minimum_1 = right.getMinimum(); + NumberValue rightMin = null; + Result result_1 = interpretExpressionInternal(G, _trace_, _minimum_1); + checkAssignableTo(result_1.getFirst(), NumberValue.class); + rightMin = (NumberValue) result_1.getFirst(); + + /* G |- left.maximum ~> var NumberValue leftMax */ + PropertyExpression _maximum = left.getMaximum(); + NumberValue leftMax = null; + Result result_2 = interpretExpressionInternal(G, _trace_, _maximum); + checkAssignableTo(result_2.getFirst(), NumberValue.class); + leftMax = (NumberValue) result_2.getFirst(); + + /* G |- right.maximum ~> var NumberValue rightMax */ + PropertyExpression _maximum_1 = right.getMaximum(); + NumberValue rightMax = null; + Result result_3 = interpretExpressionInternal(G, _trace_, _maximum_1); + checkAssignableTo(result_3.getFirst(), NumberValue.class); + rightMax = (NumberValue) result_3.getFirst(); + + /* leftMin.compareTo(rightMin) == 0 && leftMax.compareTo(rightMax) == 0 */ + if (!((InterpreterUtil.compareTo(leftMin, rightMin) == 0) && (InterpreterUtil.compareTo(leftMax, rightMax) == 0))) { + sneakyThrowRuleFailedException("leftMin.compareTo(rightMin) == 0 && leftMax.compareTo(rightMax) == 0"); + } + return new Result(true); + } + + protected Result equalImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final RecordValue left, final RecordValue right) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleEqualRecord(G, _subtrace_, left, right); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("EqualRecord") + stringRepForEnv(G) + " |= " + stringRep(left) + " : " + stringRep(right); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleEqualRecord) { + equalThrowException(ruleName("EqualRecord") + stringRepForEnv(G) + " |= " + stringRep(left) + " : " + stringRep(right), + EQUALRECORD, + e_applyRuleEqualRecord, left, right, new ErrorInformation[] {new ErrorInformation(left), new ErrorInformation(right)}); + return null; + } + } + + protected Result applyRuleEqualRecord(final RuleEnvironment G, final RuleApplicationTrace _trace_, final RecordValue left, final RecordValue right) throws RuleFailedException { + final Function1 _function = (BasicPropertyAssociation it) -> { + PropertyValue _xblockexpression = null; + { + /* G |- it.value ~> var PropertyValue propVal */ + PropertyExpression _value = it.getValue(); + PropertyValue propVal = null; + Result result = interpretExpressionInternal(G, _trace_, _value); + checkAssignableTo(result.getFirst(), PropertyValue.class); + propVal = (PropertyValue) result.getFirst(); + + _xblockexpression = propVal; + } + return _xblockexpression; + }; + final List leftVals = ListExtensions.map(left.getOwnedFieldValues(), _function); + final Function1 _function_1 = (BasicPropertyAssociation it) -> { + PropertyValue _xblockexpression = null; + { + /* G |- it.value ~> var PropertyValue propVal */ + PropertyExpression _value = it.getValue(); + PropertyValue propVal = null; + Result result = interpretExpressionInternal(G, _trace_, _value); + checkAssignableTo(result.getFirst(), PropertyValue.class); + propVal = (PropertyValue) result.getFirst(); + + _xblockexpression = propVal; + } + return _xblockexpression; + }; + final List rightVals = ListExtensions.map(right.getOwnedFieldValues(), _function_1); + final Iterator rightIter = rightVals.iterator(); + final Function1 _function_2 = (PropertyValue l) -> { + boolean _xblockexpression = false; + { + final PropertyValue r = rightIter.next(); + /* G |= l : r */ + boolean _ruleinvocation = equalSucceeded(G, _trace_, l, r); + _xblockexpression = _ruleinvocation; + } + return Boolean.valueOf(_xblockexpression); + }; + /* leftVals.forall[ l | val r = rightIter.next; G |= l : r ] */ + if (!IterableExtensions.forall(leftVals, _function_2)) { + sneakyThrowRuleFailedException("leftVals.forall[ l | val r = rightIter.next; G |= l : r ]"); + } + return new Result(true); + } + + protected Result equalImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final InstanceReferenceValue left, final InstanceReferenceValue right) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleEqualModelElement(G, _subtrace_, left, right); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("EqualModelElement") + stringRepForEnv(G) + " |= " + stringRep(left) + " : " + stringRep(right); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleEqualModelElement) { + equalThrowException(ruleName("EqualModelElement") + stringRepForEnv(G) + " |= " + stringRep(left) + " : " + stringRep(right), + EQUALMODELELEMENT, + e_applyRuleEqualModelElement, left, right, new ErrorInformation[] {new ErrorInformation(left), new ErrorInformation(right)}); + return null; + } + } + + protected Result applyRuleEqualModelElement(final RuleEnvironment G, final RuleApplicationTrace _trace_, final InstanceReferenceValue left, final InstanceReferenceValue right) throws RuleFailedException { + InstanceObject _referencedInstanceObject = left.getReferencedInstanceObject(); + InstanceObject _referencedInstanceObject_1 = right.getReferencedInstanceObject(); + /* left.referencedInstanceObject == right.referencedInstanceObject */ + if (!Objects.equals(_referencedInstanceObject, _referencedInstanceObject_1)) { + sneakyThrowRuleFailedException("left.referencedInstanceObject == right.referencedInstanceObject"); + } + return new Result(true); + } + + protected Result equalImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final PropertyValue left, final PropertyValue right) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleEqual(G, _subtrace_, left, right); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("Equal") + stringRepForEnv(G) + " |= " + stringRep(left) + " : " + stringRep(right); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleEqual) { + equalThrowException(ruleName("Equal") + stringRepForEnv(G) + " |= " + stringRep(left) + " : " + stringRep(right), + EQUAL, + e_applyRuleEqual, left, right, new ErrorInformation[] {new ErrorInformation(left), new ErrorInformation(right)}); + return null; + } + } + + protected Result applyRuleEqual(final RuleEnvironment G, final RuleApplicationTrace _trace_, final PropertyValue left, final PropertyValue right) throws RuleFailedException { + /* left.sameAs(right) or fail error 'interpreter: property values are not equal' source left */ + { + RuleFailedException previousFailure = null; + try { + boolean _sameAs = left.sameAs(right); + /* left.sameAs(right) */ + if (!_sameAs) { + sneakyThrowRuleFailedException("left.sameAs(right)"); + } + } catch (Exception e) { + previousFailure = extractRuleFailedException(e); + /* fail error 'interpreter: property values are not equal' source left */ + String error = "interpreter: property values are not equal"; + EObject source = left; + throwForExplicitFail(error, new ErrorInformation(source, null)); + } + } + return new Result(true); + } + + protected Result compareImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final NumberValue left, final NumberValue right) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleCompareNumbers(G, _subtrace_, left, right); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("CompareNumbers") + stringRepForEnv(G) + " |> " + stringRep(left) + " : " + stringRep(right); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleCompareNumbers) { + compareThrowException(ruleName("CompareNumbers") + stringRepForEnv(G) + " |> " + stringRep(left) + " : " + stringRep(right), + COMPARENUMBERS, + e_applyRuleCompareNumbers, left, right, new ErrorInformation[] {new ErrorInformation(left), new ErrorInformation(right)}); + return null; + } + } + + protected Result applyRuleCompareNumbers(final RuleEnvironment G, final RuleApplicationTrace _trace_, final NumberValue left, final NumberValue right) throws RuleFailedException { + /* G |> left : right ~> var Integer cmp */ + Integer cmp = null; + Result result = cmpNumInternal(G, _trace_, left, right); + checkAssignableTo(result.getFirst(), Integer.class); + cmp = (Integer) result.getFirst(); + + final Operation op = this.env(G, "op", Operation.class); + boolean _switchResult = false; + if (op != null) { + switch (op) { + case LT: + _switchResult = ((cmp).intValue() < 0); + break; + case LEQ: + _switchResult = ((cmp).intValue() <= 0); + break; + case GT: + _switchResult = ((cmp).intValue() > 0); + break; + case GEQ: + _switchResult = ((cmp).intValue() >= 0); + break; + default: + _switchResult = false; + break; + } + } else { + _switchResult = false; + } + final boolean b = _switchResult; + /* b */ + if (!b) { + sneakyThrowRuleFailedException("b"); + } + return new Result(true); + } + + protected Result compareImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final NumberValue left, final RangeValue right) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleCompareNumberRange(G, _subtrace_, left, right); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("CompareNumberRange") + stringRepForEnv(G) + " |> " + stringRep(left) + " : " + stringRep(right); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleCompareNumberRange) { + compareThrowException(ruleName("CompareNumberRange") + stringRepForEnv(G) + " |> " + stringRep(left) + " : " + stringRep(right), + COMPARENUMBERRANGE, + e_applyRuleCompareNumberRange, left, right, new ErrorInformation[] {new ErrorInformation(left), new ErrorInformation(right)}); + return null; + } + } + + protected Result applyRuleCompareNumberRange(final RuleEnvironment G, final RuleApplicationTrace _trace_, final NumberValue left, final RangeValue right) throws RuleFailedException { + NumberValue rightNum = null; + Operation op = this.env(G, "op", Operation.class); + if (op != null) { + switch (op) { + case LT: + case LEQ: + /* G |- right.minimum ~> rightNum */ + PropertyExpression _minimum = right.getMinimum(); + Result result = interpretExpressionInternal(G, _trace_, _minimum); + checkAssignableTo(result.getFirst(), NumberValue.class); + rightNum = (NumberValue) result.getFirst(); + + break; + case GT: + case GEQ: + /* G |- right.maximum ~> rightNum */ + PropertyExpression _maximum = right.getMaximum(); + Result result_1 = interpretExpressionInternal(G, _trace_, _maximum); + checkAssignableTo(result_1.getFirst(), NumberValue.class); + rightNum = (NumberValue) result_1.getFirst(); + + break; + default: + break; + } + } else { + } + /* G |> left : rightNum */ + compareInternal(G, _trace_, left, rightNum); + return new Result(true); + } + + protected Result compareImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final RangeValue left, final NumberValue right) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleCompareRangeNumber(G, _subtrace_, left, right); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("CompareRangeNumber") + stringRepForEnv(G) + " |> " + stringRep(left) + " : " + stringRep(right); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleCompareRangeNumber) { + compareThrowException(ruleName("CompareRangeNumber") + stringRepForEnv(G) + " |> " + stringRep(left) + " : " + stringRep(right), + COMPARERANGENUMBER, + e_applyRuleCompareRangeNumber, left, right, new ErrorInformation[] {new ErrorInformation(left), new ErrorInformation(right)}); + return null; + } + } + + protected Result applyRuleCompareRangeNumber(final RuleEnvironment G, final RuleApplicationTrace _trace_, final RangeValue left, final NumberValue right) throws RuleFailedException { + NumberValue leftNum = null; + final Operation op = this.env(G, "op", Operation.class); + if (op != null) { + switch (op) { + case LT: + case LEQ: + /* G |- left.maximum ~> leftNum */ + PropertyExpression _maximum = left.getMaximum(); + Result result = interpretExpressionInternal(G, _trace_, _maximum); + checkAssignableTo(result.getFirst(), NumberValue.class); + leftNum = (NumberValue) result.getFirst(); + + break; + case GT: + case GEQ: + /* G |- left.minimum ~> leftNum */ + PropertyExpression _minimum = left.getMinimum(); + Result result_1 = interpretExpressionInternal(G, _trace_, _minimum); + checkAssignableTo(result_1.getFirst(), NumberValue.class); + leftNum = (NumberValue) result_1.getFirst(); + + break; + default: + break; + } + } else { + } + /* G |> leftNum : right */ + compareInternal(G, _trace_, leftNum, right); + return new Result(true); + } + + protected Result compareImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final RangeValue left, final RangeValue right) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleCompareRanges(G, _subtrace_, left, right); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("CompareRanges") + stringRepForEnv(G) + " |> " + stringRep(left) + " : " + stringRep(right); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleCompareRanges) { + compareThrowException(ruleName("CompareRanges") + stringRepForEnv(G) + " |> " + stringRep(left) + " : " + stringRep(right), + COMPARERANGES, + e_applyRuleCompareRanges, left, right, new ErrorInformation[] {new ErrorInformation(left), new ErrorInformation(right)}); + return null; + } + } + + protected Result applyRuleCompareRanges(final RuleEnvironment G, final RuleApplicationTrace _trace_, final RangeValue left, final RangeValue right) throws RuleFailedException { + NumberValue leftNum = null; + NumberValue rightNum = null; + final Operation op = this.env(G, "op", Operation.class); + if (op != null) { + switch (op) { + case LT: + case LEQ: + /* G |- left.maximum ~> leftNum */ + PropertyExpression _maximum = left.getMaximum(); + Result result = interpretExpressionInternal(G, _trace_, _maximum); + checkAssignableTo(result.getFirst(), NumberValue.class); + leftNum = (NumberValue) result.getFirst(); + + /* G |- right.minimum ~> rightNum */ + PropertyExpression _minimum = right.getMinimum(); + Result result_1 = interpretExpressionInternal(G, _trace_, _minimum); + checkAssignableTo(result_1.getFirst(), NumberValue.class); + rightNum = (NumberValue) result_1.getFirst(); + + break; + case GT: + case GEQ: + /* G |- left.minimum ~> leftNum */ + PropertyExpression _minimum_1 = left.getMinimum(); + Result result_2 = interpretExpressionInternal(G, _trace_, _minimum_1); + checkAssignableTo(result_2.getFirst(), NumberValue.class); + leftNum = (NumberValue) result_2.getFirst(); + + /* G |- right.maximum ~> rightNum */ + PropertyExpression _maximum_1 = right.getMaximum(); + Result result_3 = interpretExpressionInternal(G, _trace_, _maximum_1); + checkAssignableTo(result_3.getFirst(), NumberValue.class); + rightNum = (NumberValue) result_3.getFirst(); + + break; + default: + break; + } + } else { + } + /* G |> leftNum : rightNum */ + compareInternal(G, _trace_, leftNum, rightNum); + return new Result(true); + } + + protected Result cmpNumImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final NumberValue left, final NumberValue right) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleCompareToNumber(G, _subtrace_, left, right); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("CompareToNumber") + stringRepForEnv(G) + " |> " + stringRep(left) + " : " + stringRep(right) + " ~> " + stringRep(_result_.getFirst()); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleCompareToNumber) { + cmpNumThrowException(ruleName("CompareToNumber") + stringRepForEnv(G) + " |> " + stringRep(left) + " : " + stringRep(right) + " ~> " + "Integer", + COMPARETONUMBER, + e_applyRuleCompareToNumber, left, right, new ErrorInformation[] {new ErrorInformation(left), new ErrorInformation(right)}); + return null; + } + } + + protected Result applyRuleCompareToNumber(final RuleEnvironment G, final RuleApplicationTrace _trace_, final NumberValue left, final NumberValue right) throws RuleFailedException { + Integer cmp = null; // output parameter + cmp = Integer.valueOf(InterpreterUtil.compareTo(left, right)); + return new Result(cmp); + } +} diff --git a/alisa/org.osate.alisa.common/xsemantics-gen/org/osate/alisa/common/typing/CommonTypeSystem.java b/alisa/org.osate.alisa.common/xsemantics-gen/org/osate/alisa/common/typing/CommonTypeSystem.java new file mode 100644 index 00000000000..f50510eeea5 --- /dev/null +++ b/alisa/org.osate.alisa.common/xsemantics-gen/org/osate/alisa/common/typing/CommonTypeSystem.java @@ -0,0 +1,2410 @@ +package org.osate.alisa.common.typing; + +import com.google.inject.Provider; +import java.util.function.Consumer; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.xsemantics.runtime.ErrorInformation; +import org.eclipse.xsemantics.runtime.Result; +import org.eclipse.xsemantics.runtime.RuleApplicationTrace; +import org.eclipse.xsemantics.runtime.RuleEnvironment; +import org.eclipse.xsemantics.runtime.RuleFailedException; +import org.eclipse.xsemantics.runtime.XsemanticsRuntimeSystem; +import org.eclipse.xtext.util.PolymorphicDispatcher; +import org.eclipse.xtext.xbase.lib.Conversions; +import org.eclipse.xtext.xbase.lib.Functions.Function1; +import org.eclipse.xtext.xbase.lib.IterableExtensions; +import org.osate.aadl2.Aadl2Factory; +import org.osate.aadl2.Aadl2Package; +import org.osate.aadl2.AadlBoolean; +import org.osate.aadl2.AadlInteger; +import org.osate.aadl2.AadlReal; +import org.osate.aadl2.AadlString; +import org.osate.aadl2.AbstractNamedValue; +import org.osate.aadl2.BasicProperty; +import org.osate.aadl2.BooleanLiteral; +import org.osate.aadl2.EnumerationType; +import org.osate.aadl2.IntegerLiteral; +import org.osate.aadl2.ListType; +import org.osate.aadl2.NumberType; +import org.osate.aadl2.Property; +import org.osate.aadl2.PropertyConstant; +import org.osate.aadl2.PropertyExpression; +import org.osate.aadl2.PropertyType; +import org.osate.aadl2.RangeType; +import org.osate.aadl2.RealLiteral; +import org.osate.aadl2.RecordType; +import org.osate.aadl2.ReferenceType; +import org.osate.aadl2.StringLiteral; +import org.osate.aadl2.UnitLiteral; +import org.osate.aadl2.UnitsType; +import org.osate.alisa.common.common.ABinaryOperation; +import org.osate.alisa.common.common.AConditional; +import org.osate.alisa.common.common.AExpression; +import org.osate.alisa.common.common.AFunctionCall; +import org.osate.alisa.common.common.AModelReference; +import org.osate.alisa.common.common.APropertyReference; +import org.osate.alisa.common.common.ARange; +import org.osate.alisa.common.common.AUnaryOperation; +import org.osate.alisa.common.common.AUnitExpression; +import org.osate.alisa.common.common.AVariableDeclaration; +import org.osate.alisa.common.common.AVariableReference; +import org.osate.alisa.common.common.CommonFactory; +import org.osate.alisa.common.common.CommonPackage; +import org.osate.alisa.common.common.ComputeDeclaration; +import org.osate.alisa.common.common.ModelRef; +import org.osate.alisa.common.common.Operation; +import org.osate.alisa.common.common.PropertyRef; +import org.osate.alisa.common.common.TypeRef; +import org.osate.alisa.common.common.ValDeclaration; + +@SuppressWarnings("all") +public class CommonTypeSystem extends XsemanticsRuntimeSystem { + public static final String COMBINENUMERIC = "org.osate.alisa.common.typing.CombineNumeric"; + + public static final String VALDECLARATION = "org.osate.alisa.common.typing.ValDeclaration"; + + public static final String COMPUTEDECLARATION = "org.osate.alisa.common.typing.ComputeDeclaration"; + + public static final String PROPERTYREF = "org.osate.alisa.common.typing.PropertyRef"; + + public static final String TYPEREF = "org.osate.alisa.common.typing.TypeRef"; + + public static final String PROPERTYTYPE = "org.osate.alisa.common.typing.PropertyType"; + + public static final String AEXPRESSION = "org.osate.alisa.common.typing.AExpression"; + + public static final String ABINARYEXPRESSION = "org.osate.alisa.common.typing.ABinaryExpression"; + + public static final String UNARYEXPRESSION = "org.osate.alisa.common.typing.UnaryExpression"; + + public static final String AVARIABLEREFERENCE = "org.osate.alisa.common.typing.AVariableReference"; + + public static final String RANGEEXPRESSION = "org.osate.alisa.common.typing.RangeExpression"; + + public static final String IFEXPRESSION = "org.osate.alisa.common.typing.IfExpression"; + + public static final String FUNCTIONCALL = "org.osate.alisa.common.typing.FunctionCall"; + + public static final String UNITEXPRESSION = "org.osate.alisa.common.typing.UnitExpression"; + + public static final String PROPERTYREFERENCE = "org.osate.alisa.common.typing.PropertyReference"; + + public static final String MODELREFERENCE = "org.osate.alisa.common.typing.ModelReference"; + + public static final String INTEGERLITERAL = "org.osate.alisa.common.typing.IntegerLiteral"; + + public static final String REALLITERAL = "org.osate.alisa.common.typing.RealLiteral"; + + public static final String BOOLEANLITERAL = "org.osate.alisa.common.typing.BooleanLiteral"; + + public static final String STRINGLITERAL = "org.osate.alisa.common.typing.StringLiteral"; + + public static final String SAMEBOOLEAN = "org.osate.alisa.common.typing.SameBoolean"; + + public static final String SAMESTRING = "org.osate.alisa.common.typing.SameString"; + + public static final String SAMEMODELREF = "org.osate.alisa.common.typing.SameModelRef"; + + public static final String SAMEENUMERATION = "org.osate.alisa.common.typing.SameEnumeration"; + + public static final String SAMENUMBER = "org.osate.alisa.common.typing.SameNumber"; + + public static final String SAMERANGE = "org.osate.alisa.common.typing.SameRange"; + + public static final String SAMELIST = "org.osate.alisa.common.typing.SameList"; + + public static final String SAMERECORD = "org.osate.alisa.common.typing.SameRecord"; + + public static final String SAMETYPELIST = "org.osate.alisa.common.typing.SameTypeList"; + + public static final String EXPRESSIONASSIGNABLETOTYPE = "org.osate.alisa.common.typing.ExpressionAssignableToType"; + + public static final String PRIMITIVESTRING = "org.osate.alisa.common.typing.PrimitiveString"; + + public static final String PRIMITIVEBOOLEAN = "org.osate.alisa.common.typing.PrimitiveBoolean"; + + public static final String PRIMITIVENUMBER = "org.osate.alisa.common.typing.PrimitiveNumber"; + + public static final String MODELREF = "org.osate.alisa.common.typing.ModelRef"; + + public static final String MODELREF1 = "org.osate.alisa.common.typing.ModelRef1"; + + public static final String RANGE = "org.osate.alisa.common.typing.Range"; + + public static final String NOTCOMPATIBLE = "org.osate.alisa.common.typing.NotCompatible"; + + private PolymorphicDispatcher combineNumericDispatcher; + + private PolymorphicDispatcher> typeDispatcher; + + private PolymorphicDispatcher> assignableDispatcher; + + private PolymorphicDispatcher> compatibleDispatcher; + + private PolymorphicDispatcher> sameTypeDispatcher; + + private PolymorphicDispatcher> sameTypesDispatcher; + + public CommonTypeSystem() { + init(); + } + + public void init() { + typeDispatcher = buildPolymorphicDispatcher1( + "typeImpl", 3, "|-", ":"); + assignableDispatcher = buildPolymorphicDispatcher1( + "assignableImpl", 4, "|-", "|>"); + compatibleDispatcher = buildPolymorphicDispatcher1( + "compatibleImpl", 4, "|-", "<:"); + sameTypeDispatcher = buildPolymorphicDispatcher1( + "sameTypeImpl", 4, "|-", "~~"); + sameTypesDispatcher = buildPolymorphicDispatcher1( + "sameTypesImpl", 4, "|=", "~~"); + combineNumericDispatcher = buildPolymorphicDispatcher( + "combineNumericImpl", 3); + } + + public NumberType combineNumeric(final NumberType left, final NumberType right) throws RuleFailedException { + return combineNumeric(null, left, right); + } + + public NumberType combineNumeric(final RuleApplicationTrace _trace_, final NumberType left, final NumberType right) throws RuleFailedException { + try { + return combineNumericInternal(_trace_, left, right); + } catch (Exception _e_combineNumeric) { + throw extractRuleFailedException(_e_combineNumeric); + } + } + + public Result type(final EObject o) { + return type(new RuleEnvironment(), null, o); + } + + public Result type(final RuleEnvironment _environment_, final EObject o) { + return type(_environment_, null, o); + } + + public Result type(final RuleEnvironment _environment_, final RuleApplicationTrace _trace_, final EObject o) { + try { + return typeInternal(_environment_, _trace_, o); + } catch (Exception _e_type) { + return resultForFailure(_e_type); + } + } + + public Result assignable(final AExpression exp, final PropertyType target) { + return assignable(new RuleEnvironment(), null, exp, target); + } + + public Result assignable(final RuleEnvironment _environment_, final AExpression exp, final PropertyType target) { + return assignable(_environment_, null, exp, target); + } + + public Result assignable(final RuleEnvironment _environment_, final RuleApplicationTrace _trace_, final AExpression exp, final PropertyType target) { + try { + return assignableInternal(_environment_, _trace_, exp, target); + } catch (Exception _e_assignable) { + return resultForFailure(_e_assignable); + } + } + + public Boolean assignableSucceeded(final AExpression exp, final PropertyType target) { + return assignableSucceeded(new RuleEnvironment(), null, exp, target); + } + + public Boolean assignableSucceeded(final RuleEnvironment _environment_, final AExpression exp, final PropertyType target) { + return assignableSucceeded(_environment_, null, exp, target); + } + + public Boolean assignableSucceeded(final RuleEnvironment _environment_, final RuleApplicationTrace _trace_, final AExpression exp, final PropertyType target) { + try { + assignableInternal(_environment_, _trace_, exp, target); + return true; + } catch (Exception _e_assignable) { + return false; + } + } + + public Result compatible(final PropertyType left, final PropertyType right) { + return compatible(new RuleEnvironment(), null, left, right); + } + + public Result compatible(final RuleEnvironment _environment_, final PropertyType left, final PropertyType right) { + return compatible(_environment_, null, left, right); + } + + public Result compatible(final RuleEnvironment _environment_, final RuleApplicationTrace _trace_, final PropertyType left, final PropertyType right) { + try { + return compatibleInternal(_environment_, _trace_, left, right); + } catch (Exception _e_compatible) { + return resultForFailure(_e_compatible); + } + } + + public Boolean compatibleSucceeded(final PropertyType left, final PropertyType right) { + return compatibleSucceeded(new RuleEnvironment(), null, left, right); + } + + public Boolean compatibleSucceeded(final RuleEnvironment _environment_, final PropertyType left, final PropertyType right) { + return compatibleSucceeded(_environment_, null, left, right); + } + + public Boolean compatibleSucceeded(final RuleEnvironment _environment_, final RuleApplicationTrace _trace_, final PropertyType left, final PropertyType right) { + try { + compatibleInternal(_environment_, _trace_, left, right); + return true; + } catch (Exception _e_compatible) { + return false; + } + } + + public Result sameType(final PropertyType left, final PropertyType right) { + return sameType(new RuleEnvironment(), null, left, right); + } + + public Result sameType(final RuleEnvironment _environment_, final PropertyType left, final PropertyType right) { + return sameType(_environment_, null, left, right); + } + + public Result sameType(final RuleEnvironment _environment_, final RuleApplicationTrace _trace_, final PropertyType left, final PropertyType right) { + try { + return sameTypeInternal(_environment_, _trace_, left, right); + } catch (Exception _e_sameType) { + return resultForFailure(_e_sameType); + } + } + + public Boolean sameTypeSucceeded(final PropertyType left, final PropertyType right) { + return sameTypeSucceeded(new RuleEnvironment(), null, left, right); + } + + public Boolean sameTypeSucceeded(final RuleEnvironment _environment_, final PropertyType left, final PropertyType right) { + return sameTypeSucceeded(_environment_, null, left, right); + } + + public Boolean sameTypeSucceeded(final RuleEnvironment _environment_, final RuleApplicationTrace _trace_, final PropertyType left, final PropertyType right) { + try { + sameTypeInternal(_environment_, _trace_, left, right); + return true; + } catch (Exception _e_sameType) { + return false; + } + } + + public Result sameTypes(final EList left, final EList right) { + return sameTypes(new RuleEnvironment(), null, left, right); + } + + public Result sameTypes(final RuleEnvironment _environment_, final EList left, final EList right) { + return sameTypes(_environment_, null, left, right); + } + + public Result sameTypes(final RuleEnvironment _environment_, final RuleApplicationTrace _trace_, final EList left, final EList right) { + try { + return sameTypesInternal(_environment_, _trace_, left, right); + } catch (Exception _e_sameTypes) { + return resultForFailure(_e_sameTypes); + } + } + + public Boolean sameTypesSucceeded(final EList left, final EList right) { + return sameTypesSucceeded(new RuleEnvironment(), null, left, right); + } + + public Boolean sameTypesSucceeded(final RuleEnvironment _environment_, final EList left, final EList right) { + return sameTypesSucceeded(_environment_, null, left, right); + } + + public Boolean sameTypesSucceeded(final RuleEnvironment _environment_, final RuleApplicationTrace _trace_, final EList left, final EList right) { + try { + sameTypesInternal(_environment_, _trace_, left, right); + return true; + } catch (Exception _e_sameTypes) { + return false; + } + } + + public Result checkValDecls(final ValDeclaration valDecl) { + return checkValDecls(null, valDecl); + } + + public Result checkValDecls(final RuleApplicationTrace _trace_, final ValDeclaration valDecl) { + try { + return checkValDeclsInternal(_trace_, valDecl); + } catch (Exception _e_CheckValDecls) { + return resultForFailure(_e_CheckValDecls); + } + } + + protected Result checkValDeclsInternal(final RuleApplicationTrace _trace_, final ValDeclaration valDecl) throws RuleFailedException { + /* empty |- valDecl.value : var PropertyType valueType */ + PropertyExpression _value = valDecl.getValue(); + PropertyType valueType = null; + Result result = typeInternal(emptyEnvironment(), _trace_, _value); + checkAssignableTo(result.getFirst(), PropertyType.class); + valueType = (PropertyType) result.getFirst(); + + PropertyType _type = valDecl.getType(); + boolean _tripleNotEquals = (_type != null); + if (_tripleNotEquals) { + /* empty |- valDecl : var PropertyType valType */ + PropertyType valType = null; + Result result_1 = typeInternal(emptyEnvironment(), _trace_, valDecl); + checkAssignableTo(result_1.getFirst(), PropertyType.class); + valType = (PropertyType) result_1.getFirst(); + + /* empty |- valueType <: valType or { fail error 'types not compatible: cannot assign ' + stringRep(valueType) + ' to ' + stringRep(valType) source valDecl feature CommonPackage.eINSTANCE.valDeclaration_Value } */ + { + RuleFailedException previousFailure = null; + try { + /* empty |- valueType <: valType */ + compatibleInternal(emptyEnvironment(), _trace_, valueType, valType); + } catch (Exception e) { + previousFailure = extractRuleFailedException(e); + /* fail error 'types not compatible: cannot assign ' + stringRep(valueType) + ' to ' + stringRep(valType) source valDecl feature CommonPackage.eINSTANCE.valDeclaration_Value */ + String _stringRep = this.stringRep(valueType); + String _plus = ("types not compatible: cannot assign " + _stringRep); + String _plus_1 = (_plus + " to "); + String _stringRep_1 = this.stringRep(valType); + String _plus_2 = (_plus_1 + _stringRep_1); + String error = _plus_2; + EObject source = valDecl; + EReference _valDeclaration_Value = CommonPackage.eINSTANCE.getValDeclaration_Value(); + EStructuralFeature feature = _valDeclaration_Value; + throwForExplicitFail(error, new ErrorInformation(source, feature)); + } + } + } + return new Result(true); + } + + public Result checkExpressions(final PropertyExpression exp) { + return checkExpressions(null, exp); + } + + public Result checkExpressions(final RuleApplicationTrace _trace_, final PropertyExpression exp) { + try { + return checkExpressionsInternal(_trace_, exp); + } catch (Exception _e_CheckExpressions) { + return resultForFailure(_e_CheckExpressions); + } + } + + protected Result checkExpressionsInternal(final RuleApplicationTrace _trace_, final PropertyExpression exp) throws RuleFailedException { + /* empty |- exp : var PropertyType type */ + PropertyType type = null; + Result result = typeInternal(emptyEnvironment(), _trace_, exp); + checkAssignableTo(result.getFirst(), PropertyType.class); + type = (PropertyType) result.getFirst(); + + return new Result(true); + } + + protected NumberType combineNumericInternal(final RuleApplicationTrace _trace_, final NumberType left, final NumberType right) { + try { + checkParamsNotNull(left, right); + return combineNumericDispatcher.invoke(_trace_, left, right); + } catch (Exception _e_combineNumeric) { + sneakyThrowRuleFailedException(_e_combineNumeric); + return null; + } + } + + protected void combineNumericThrowException(final String _error, final String _issue, final Exception _ex, final NumberType left, final NumberType right, final ErrorInformation[] _errorInformations) throws RuleFailedException { + throwRuleFailedException(_error, _issue, _ex, _errorInformations); + } + + protected Result typeInternal(final RuleEnvironment _environment_, final RuleApplicationTrace _trace_, final EObject o) { + try { + checkParamsNotNull(o); + return typeDispatcher.invoke(_environment_, _trace_, o); + } catch (Exception _e_type) { + sneakyThrowRuleFailedException(_e_type); + return null; + } + } + + protected void typeThrowException(final String _error, final String _issue, final Exception _ex, final EObject o, final ErrorInformation[] _errorInformations) throws RuleFailedException { + throwRuleFailedException(_error, _issue, _ex, _errorInformations); + } + + protected Result assignableInternal(final RuleEnvironment _environment_, final RuleApplicationTrace _trace_, final AExpression exp, final PropertyType target) { + try { + checkParamsNotNull(exp, target); + return assignableDispatcher.invoke(_environment_, _trace_, exp, target); + } catch (Exception _e_assignable) { + sneakyThrowRuleFailedException(_e_assignable); + return null; + } + } + + protected void assignableThrowException(final String _error, final String _issue, final Exception _ex, final AExpression exp, final PropertyType target, final ErrorInformation[] _errorInformations) throws RuleFailedException { + String _stringRep = this.stringRep(exp); + String _plus = (_stringRep + " cannot be assigned to "); + String _stringRep_1 = this.stringRep(target); + String _plus_1 = (_plus + _stringRep_1); + String error = _plus_1; + EObject source = exp; + throwRuleFailedException(error, + _issue, _ex, new ErrorInformation(source, null)); + } + + protected Result compatibleInternal(final RuleEnvironment _environment_, final RuleApplicationTrace _trace_, final PropertyType left, final PropertyType right) { + try { + checkParamsNotNull(left, right); + return compatibleDispatcher.invoke(_environment_, _trace_, left, right); + } catch (Exception _e_compatible) { + sneakyThrowRuleFailedException(_e_compatible); + return null; + } + } + + protected void compatibleThrowException(final String _error, final String _issue, final Exception _ex, final PropertyType left, final PropertyType right, final ErrorInformation[] _errorInformations) throws RuleFailedException { + throwRuleFailedException(_error, _issue, _ex, _errorInformations); + } + + protected Result sameTypeInternal(final RuleEnvironment _environment_, final RuleApplicationTrace _trace_, final PropertyType left, final PropertyType right) { + try { + checkParamsNotNull(left, right); + return sameTypeDispatcher.invoke(_environment_, _trace_, left, right); + } catch (Exception _e_sameType) { + sneakyThrowRuleFailedException(_e_sameType); + return null; + } + } + + protected void sameTypeThrowException(final String _error, final String _issue, final Exception _ex, final PropertyType left, final PropertyType right, final ErrorInformation[] _errorInformations) throws RuleFailedException { + throwRuleFailedException(_error, _issue, _ex, _errorInformations); + } + + protected Result sameTypesInternal(final RuleEnvironment _environment_, final RuleApplicationTrace _trace_, final EList left, final EList right) { + try { + checkParamsNotNull(left, right); + return sameTypesDispatcher.invoke(_environment_, _trace_, left, right); + } catch (Exception _e_sameTypes) { + sneakyThrowRuleFailedException(_e_sameTypes); + return null; + } + } + + protected void sameTypesThrowException(final String _error, final String _issue, final Exception _ex, final EList left, final EList right, final ErrorInformation[] _errorInformations) throws RuleFailedException { + throwRuleFailedException(_error, _issue, _ex, _errorInformations); + } + + protected NumberType combineNumericImpl(final RuleApplicationTrace _trace_, final NumberType left, final NumberType right) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final NumberType _result_ = applyAuxFunCombineNumeric(_subtrace_, left, right); + addToTrace(_trace_, new Provider() { + public Object get() { + return auxFunName("combineNumeric") + "(" + stringRep(left) + ", " + stringRep(right)+ ")" + " = " + stringRep(_result_); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyAuxFunCombineNumeric) { + combineNumericThrowException(auxFunName("combineNumeric") + "(" + stringRep(left) + ", " + stringRep(right)+ ")", + COMBINENUMERIC, + e_applyAuxFunCombineNumeric, left, right, new ErrorInformation[] {new ErrorInformation(left), new ErrorInformation(right)}); + return null; + } + } + + protected NumberType applyAuxFunCombineNumeric(final RuleApplicationTrace _trace_, final NumberType left, final NumberType right) throws RuleFailedException { + NumberType _xblockexpression = null; + { + NumberType _xifexpression = null; + if (((left instanceof AadlInteger) && (right instanceof AadlInteger))) { + _xifexpression = Aadl2Factory.eINSTANCE.createAadlInteger(); + } else { + _xifexpression = Aadl2Factory.eINSTANCE.createAadlReal(); + } + final NumberType result = _xifexpression; + UnitsType _xifexpression_1 = null; + UnitsType _unitsType = left.getUnitsType(); + boolean _tripleNotEquals = (_unitsType != null); + if (_tripleNotEquals) { + _xifexpression_1 = left.getUnitsType(); + } else { + _xifexpression_1 = right.getUnitsType(); + } + result.setReferencedUnitsType(_xifexpression_1); + _xblockexpression = (result); + } + return _xblockexpression; + } + + protected Result typeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final ValDeclaration valDecl) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleValDeclaration(G, _subtrace_, valDecl); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("ValDeclaration") + stringRepForEnv(G) + " |- " + stringRep(valDecl) + " : " + stringRep(_result_.getFirst()); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleValDeclaration) { + typeThrowException(ruleName("ValDeclaration") + stringRepForEnv(G) + " |- " + stringRep(valDecl) + " : " + "PropertyType", + VALDECLARATION, + e_applyRuleValDeclaration, valDecl, new ErrorInformation[] {new ErrorInformation(valDecl)}); + return null; + } + } + + protected Result applyRuleValDeclaration(final RuleEnvironment G, final RuleApplicationTrace _trace_, final ValDeclaration valDecl) throws RuleFailedException { + PropertyType type = null; // output parameter + final PropertyType declared = valDecl.getType(); + /* { declared !== null && !valDecl.range G |- declared : type } or { declared !== null && valDecl.range var PropertyType numeric G |- declared : numeric if (numeric instanceof NumberType) { val rt = Aadl2Factory.eINSTANCE.createRangeType rt.ownedNumberType = numeric type = rt } else { fail error 'typing: ranges must be numeric' source declared } } or { declared === null G |- valDecl.value : type } */ + { + RuleFailedException previousFailure = null; + try { + /* declared !== null && !valDecl.range */ + if (!((declared != null) && (!valDecl.isRange()))) { + sneakyThrowRuleFailedException("declared !== null && !valDecl.range"); + } + /* G |- declared : type */ + Result result = typeInternal(G, _trace_, declared); + checkAssignableTo(result.getFirst(), PropertyType.class); + type = (PropertyType) result.getFirst(); + + } catch (Exception e) { + previousFailure = extractRuleFailedException(e); + /* { declared !== null && valDecl.range var PropertyType numeric G |- declared : numeric if (numeric instanceof NumberType) { val rt = Aadl2Factory.eINSTANCE.createRangeType rt.ownedNumberType = numeric type = rt } else { fail error 'typing: ranges must be numeric' source declared } } or { declared === null G |- valDecl.value : type } */ + { + try { + /* declared !== null && valDecl.range */ + if (!((declared != null) && valDecl.isRange())) { + sneakyThrowRuleFailedException("declared !== null && valDecl.range"); + } + PropertyType numeric = null; + /* G |- declared : numeric */ + Result result_1 = typeInternal(G, _trace_, declared); + checkAssignableTo(result_1.getFirst(), PropertyType.class); + numeric = (PropertyType) result_1.getFirst(); + + if ((numeric instanceof NumberType)) { + final RangeType rt = Aadl2Factory.eINSTANCE.createRangeType(); + rt.setOwnedNumberType(((NumberType)numeric)); + type = rt; + } else { + /* fail error 'typing: ranges must be numeric' source declared */ + String error = "typing: ranges must be numeric"; + EObject source = declared; + throwForExplicitFail(error, new ErrorInformation(source, null)); + } + } catch (Exception e_1) { + previousFailure = extractRuleFailedException(e_1); + /* declared === null */ + if (!(declared == null)) { + sneakyThrowRuleFailedException("declared === null"); + } + /* G |- valDecl.value : type */ + PropertyExpression _value = valDecl.getValue(); + Result result_2 = typeInternal(G, _trace_, _value); + checkAssignableTo(result_2.getFirst(), PropertyType.class); + type = (PropertyType) result_2.getFirst(); + + } + } + } + } + return new Result(type); + } + + protected Result typeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final ComputeDeclaration valDecl) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleComputeDeclaration(G, _subtrace_, valDecl); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("ComputeDeclaration") + stringRepForEnv(G) + " |- " + stringRep(valDecl) + " : " + stringRep(_result_.getFirst()); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleComputeDeclaration) { + typeThrowException(ruleName("ComputeDeclaration") + stringRepForEnv(G) + " |- " + stringRep(valDecl) + " : " + "PropertyType", + COMPUTEDECLARATION, + e_applyRuleComputeDeclaration, valDecl, new ErrorInformation[] {new ErrorInformation(valDecl)}); + return null; + } + } + + protected Result applyRuleComputeDeclaration(final RuleEnvironment G, final RuleApplicationTrace _trace_, final ComputeDeclaration valDecl) throws RuleFailedException { + PropertyType type = null; // output parameter + final PropertyType declared = valDecl.getType(); + /* declared !== null */ + if (!(declared != null)) { + sneakyThrowRuleFailedException("declared !== null"); + } + /* G |- declared : type */ + Result result = typeInternal(G, _trace_, declared); + checkAssignableTo(result.getFirst(), PropertyType.class); + type = (PropertyType) result.getFirst(); + + return new Result(type); + } + + protected Result typeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final PropertyRef propRef) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRulePropertyRef(G, _subtrace_, propRef); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("PropertyRef") + stringRepForEnv(G) + " |- " + stringRep(propRef) + " : " + stringRep(_result_.getFirst()); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRulePropertyRef) { + typeThrowException(ruleName("PropertyRef") + stringRepForEnv(G) + " |- " + stringRep(propRef) + " : " + "PropertyType", + PROPERTYREF, + e_applyRulePropertyRef, propRef, new ErrorInformation[] {new ErrorInformation(propRef)}); + return null; + } + } + + protected Result applyRulePropertyRef(final RuleEnvironment G, final RuleApplicationTrace _trace_, final PropertyRef propRef) throws RuleFailedException { + + return new Result(_applyRulePropertyRef_1(G, propRef)); + } + + private PropertyType _applyRulePropertyRef_1(final RuleEnvironment G, final PropertyRef propRef) throws RuleFailedException { + PropertyType _propertyType = propRef.getRef().getPropertyType(); + return _propertyType; + } + + protected Result typeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final TypeRef typeRef) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleTypeRef(G, _subtrace_, typeRef); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("TypeRef") + stringRepForEnv(G) + " |- " + stringRep(typeRef) + " : " + stringRep(_result_.getFirst()); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleTypeRef) { + typeThrowException(ruleName("TypeRef") + stringRepForEnv(G) + " |- " + stringRep(typeRef) + " : " + "PropertyType", + TYPEREF, + e_applyRuleTypeRef, typeRef, new ErrorInformation[] {new ErrorInformation(typeRef)}); + return null; + } + } + + protected Result applyRuleTypeRef(final RuleEnvironment G, final RuleApplicationTrace _trace_, final TypeRef typeRef) throws RuleFailedException { + + return new Result(_applyRuleTypeRef_1(G, typeRef)); + } + + private PropertyType _applyRuleTypeRef_1(final RuleEnvironment G, final TypeRef typeRef) throws RuleFailedException { + PropertyType _ref = typeRef.getRef(); + return _ref; + } + + protected Result typeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final PropertyType propType) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRulePropertyType(G, _subtrace_, propType); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("PropertyType") + stringRepForEnv(G) + " |- " + stringRep(propType) + " : " + stringRep(_result_.getFirst()); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRulePropertyType) { + typeThrowException(ruleName("PropertyType") + stringRepForEnv(G) + " |- " + stringRep(propType) + " : " + "PropertyType", + PROPERTYTYPE, + e_applyRulePropertyType, propType, new ErrorInformation[] {new ErrorInformation(propType)}); + return null; + } + } + + protected Result applyRulePropertyType(final RuleEnvironment G, final RuleApplicationTrace _trace_, final PropertyType propType) throws RuleFailedException { + + return new Result(_applyRulePropertyType_1(G, propType)); + } + + private PropertyType _applyRulePropertyType_1(final RuleEnvironment G, final PropertyType propType) throws RuleFailedException { + return propType; + } + + protected Result typeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final PropertyExpression param) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleAExpression(G, _subtrace_, param); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("AExpression") + stringRepForEnv(G) + " |- " + stringRep(param) + " : " + stringRep(_result_.getFirst()); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleAExpression) { + aExpressionThrowException(e_applyRuleAExpression, param); + return null; + } + } + + protected Result applyRuleAExpression(final RuleEnvironment G, final RuleApplicationTrace _trace_, final PropertyExpression param) throws RuleFailedException { + PropertyType type = null; // output parameter + /* fail */ + throwForExplicitFail(); + return new Result(type); + } + + private void aExpressionThrowException(final Exception e_applyRuleAExpression, final PropertyExpression param) throws RuleFailedException { + String _stringRep = this.stringRep(param); + String _plus = ("typing: unhandled case" + _stringRep); + String error = _plus; + EObject source = param; + throwRuleFailedException(error, + AEXPRESSION, e_applyRuleAExpression, new ErrorInformation(source, null)); + } + + protected Result typeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final ABinaryOperation binary) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleABinaryExpression(G, _subtrace_, binary); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("ABinaryExpression") + stringRepForEnv(G) + " |- " + stringRep(binary) + " : " + stringRep(_result_.getFirst()); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleABinaryExpression) { + typeThrowException(ruleName("ABinaryExpression") + stringRepForEnv(G) + " |- " + stringRep(binary) + " : " + "PropertyType", + ABINARYEXPRESSION, + e_applyRuleABinaryExpression, binary, new ErrorInformation[] {new ErrorInformation(binary)}); + return null; + } + } + + protected Result applyRuleABinaryExpression(final RuleEnvironment G, final RuleApplicationTrace _trace_, final ABinaryOperation binary) throws RuleFailedException { + PropertyType type = null; // output parameter + /* G |- binary.left : var PropertyType leftType */ + PropertyExpression _left = binary.getLeft(); + PropertyType leftType = null; + Result result = typeInternal(G, _trace_, _left); + checkAssignableTo(result.getFirst(), PropertyType.class); + leftType = (PropertyType) result.getFirst(); + + /* G |- binary.right : var PropertyType rightType */ + PropertyExpression _right = binary.getRight(); + PropertyType rightType = null; + Result result_1 = typeInternal(G, _trace_, _right); + checkAssignableTo(result_1.getFirst(), PropertyType.class); + rightType = (PropertyType) result_1.getFirst(); + + final Operation op = binary.getOperator(); + if (op != null) { + switch (op) { + case OR: + case ALT_OR: + case AND: + case ALT_AND: + if ((!(leftType instanceof AadlBoolean))) { + /* fail error 'typing: operand must be boolean' source binary.left */ + String error = "typing: operand must be boolean"; + PropertyExpression _left_1 = binary.getLeft(); + EObject source = _left_1; + throwForExplicitFail(error, new ErrorInformation(source, null)); + } + if ((!(rightType instanceof AadlBoolean))) { + /* fail error 'typing: operand must be boolean' source binary.right */ + String error_1 = "typing: operand must be boolean"; + PropertyExpression _right_1 = binary.getRight(); + EObject source_1 = _right_1; + throwForExplicitFail(error_1, new ErrorInformation(source_1, null)); + } + type = Aadl2Factory.eINSTANCE.createAadlBoolean(); + break; + case EQ: + case NEQ: + /* G |- leftType ~~ rightType or { fail error 'typing: cannot compare ' + stringRep(leftType) + ' and ' + stringRep(rightType) source binary } */ + { + RuleFailedException previousFailure = null; + try { + /* G |- leftType ~~ rightType */ + sameTypeInternal(G, _trace_, leftType, rightType); + } catch (Exception e) { + previousFailure = extractRuleFailedException(e); + /* fail error 'typing: cannot compare ' + stringRep(leftType) + ' and ' + stringRep(rightType) source binary */ + String _stringRep = this.stringRep(leftType); + String _plus = ("typing: cannot compare " + _stringRep); + String _plus_1 = (_plus + " and "); + String _stringRep_1 = this.stringRep(rightType); + String _plus_2 = (_plus_1 + _stringRep_1); + String error_2 = _plus_2; + EObject source_2 = binary; + throwForExplicitFail(error_2, new ErrorInformation(source_2, null)); + } + } + type = Aadl2Factory.eINSTANCE.createAadlBoolean(); + break; + case LT: + case LEQ: + case GT: + case GEQ: + case IN: + case PLUS: + case MINUS: + case MULT: + case DIV: + if ((!((leftType instanceof NumberType) || (leftType instanceof RangeType)))) { + /* fail error 'typing: operand must be numeric or a range' source binary.left */ + String error_3 = "typing: operand must be numeric or a range"; + PropertyExpression _left_2 = binary.getLeft(); + EObject source_3 = _left_2; + throwForExplicitFail(error_3, new ErrorInformation(source_3, null)); + } + if ((!((rightType instanceof NumberType) || (rightType instanceof RangeType)))) { + /* fail error 'typing: operand must be numeric or a range' source binary.right */ + String error_4 = "typing: operand must be numeric or a range"; + PropertyExpression _right_2 = binary.getRight(); + EObject source_4 = _right_2; + throwForExplicitFail(error_4, new ErrorInformation(source_4, null)); + } + if (op != null) { + switch (op) { + case PLUS: + case MULT: + if ((!(((leftType instanceof RangeType) && (rightType instanceof RangeType)) || ((leftType instanceof NumberType) && (rightType instanceof NumberType))))) { + /* fail error 'typing: operands must be both numeric or both ranges' source binary */ + String error_5 = "typing: operands must be both numeric or both ranges"; + EObject source_5 = binary; + throwForExplicitFail(error_5, new ErrorInformation(source_5, null)); + } + break; + case IN: + if ((!(rightType instanceof RangeType))) { + /* fail error 'typing: operand must be a range' source binary.right */ + String error_6 = "typing: operand must be a range"; + PropertyExpression _right_3 = binary.getRight(); + EObject source_6 = _right_3; + throwForExplicitFail(error_6, new ErrorInformation(source_6, null)); + } + break; + case DIV: + case MINUS: + if ((!(leftType instanceof NumberType))) { + /* fail error 'typing: operand must be numeric' source binary.left */ + String error_7 = "typing: operand must be numeric"; + PropertyExpression _left_3 = binary.getLeft(); + EObject source_7 = _left_3; + throwForExplicitFail(error_7, new ErrorInformation(source_7, null)); + } else { + if ((!(rightType instanceof NumberType))) { + /* fail error 'typing: operand must be numeric' source binary.right */ + String error_8 = "typing: operand must be numeric"; + PropertyExpression _right_4 = binary.getRight(); + EObject source_8 = _right_4; + throwForExplicitFail(error_8, new ErrorInformation(source_8, null)); + } + } + break; + default: + break; + } + } else { + } + NumberType _xifexpression = null; + if ((leftType instanceof RangeType)) { + _xifexpression = ((RangeType)leftType).getNumberType(); + } else { + _xifexpression = ((NumberType) leftType); + } + final NumberType leftNum = _xifexpression; + NumberType _xifexpression_1 = null; + if ((rightType instanceof RangeType)) { + _xifexpression_1 = ((RangeType)rightType).getNumberType(); + } else { + _xifexpression_1 = ((NumberType) rightType); + } + final NumberType rightNum = _xifexpression_1; + if (op != null) { + switch (op) { + case LT: + case LEQ: + case GT: + case GEQ: + case IN: + /* G |- leftNum ~~ rightNum or { fail error 'typing: arguments have different unit types' source binary } */ + { + RuleFailedException previousFailure = null; + try { + /* G |- leftNum ~~ rightNum */ + sameTypeInternal(G, _trace_, leftNum, rightNum); + } catch (Exception e_1) { + previousFailure = extractRuleFailedException(e_1); + /* fail error 'typing: arguments have different unit types' source binary */ + String error_9 = "typing: arguments have different unit types"; + EObject source_9 = binary; + throwForExplicitFail(error_9, new ErrorInformation(source_9, null)); + } + } + type = Aadl2Factory.eINSTANCE.createAadlBoolean(); + break; + case PLUS: + case MINUS: + /* G |- leftNum ~~ rightNum or { fail error 'typing: arguments have different unit types' source binary } */ + { + RuleFailedException previousFailure = null; + try { + /* G |- leftNum ~~ rightNum */ + sameTypeInternal(G, _trace_, leftNum, rightNum); + } catch (Exception e_2) { + previousFailure = extractRuleFailedException(e_2); + /* fail error 'typing: arguments have different unit types' source binary */ + String error_10 = "typing: arguments have different unit types"; + EObject source_10 = binary; + throwForExplicitFail(error_10, new ErrorInformation(source_10, null)); + } + } + type = this.combineNumericInternal(_trace_, leftNum, rightNum); + break; + case MULT: + if (((leftNum.getUnitsType() != null) && (rightNum.getUnitsType() != null))) { + /* fail error 'typing: only one operand may have a unit' source binary */ + String error_11 = "typing: only one operand may have a unit"; + EObject source_11 = binary; + throwForExplicitFail(error_11, new ErrorInformation(source_11, null)); + } + type = this.combineNumericInternal(_trace_, leftNum, rightNum); + break; + case DIV: + final AadlReal t = Aadl2Factory.eINSTANCE.createAadlReal(); + if (((leftNum.getUnitsType() != null) && (rightNum.getUnitsType() != null))) { + /* G |- leftNum ~~ rightNum or { fail error 'typing: arguments have different unit types' source binary } */ + { + RuleFailedException previousFailure = null; + try { + /* G |- leftNum ~~ rightNum */ + sameTypeInternal(G, _trace_, leftNum, rightNum); + } catch (Exception e_3) { + previousFailure = extractRuleFailedException(e_3); + /* fail error 'typing: arguments have different unit types' source binary */ + String error_12 = "typing: arguments have different unit types"; + EObject source_12 = binary; + throwForExplicitFail(error_12, new ErrorInformation(source_12, null)); + } + } + } else { + UnitsType _unitsType = rightNum.getUnitsType(); + boolean _tripleNotEquals = (_unitsType != null); + if (_tripleNotEquals) { + /* fail error 'typing: argument must have a unit when dividing by a number with unit' source binary.left */ + String error_13 = "typing: argument must have a unit when dividing by a number with unit"; + PropertyExpression _left_4 = binary.getLeft(); + EObject source_13 = _left_4; + throwForExplicitFail(error_13, new ErrorInformation(source_13, null)); + } else { + t.setReferencedUnitsType(leftNum.getUnitsType()); + } + } + type = t; + break; + default: + /* fail error 'typing: unhandled binary operator encountered' source binary */ + String error_14 = "typing: unhandled binary operator encountered"; + EObject source_14 = binary; + throwForExplicitFail(error_14, new ErrorInformation(source_14, null)); + break; + } + } else { + /* fail error 'typing: unhandled binary operator encountered' source binary */ + String error_14 = "typing: unhandled binary operator encountered"; + EObject source_14 = binary; + throwForExplicitFail(error_14, new ErrorInformation(source_14, null)); + } + break; + case INTDIV: + case MOD: + if ((!(leftType instanceof AadlInteger))) { + /* fail error 'typing: argument must be an integer' source binary.left */ + String error_15 = "typing: argument must be an integer"; + PropertyExpression _left_5 = binary.getLeft(); + EObject source_15 = _left_5; + throwForExplicitFail(error_15, new ErrorInformation(source_15, null)); + } + if ((!(rightType instanceof AadlInteger))) { + /* fail error 'typing: argument must be an integer' source binary.right */ + String error_16 = "typing: argument must be an integer"; + PropertyExpression _right_5 = binary.getRight(); + EObject source_16 = _right_5; + throwForExplicitFail(error_16, new ErrorInformation(source_16, null)); + } + final NumberType leftNum_1 = ((NumberType) leftType); + final NumberType rightNum_1 = ((NumberType) rightType); + final AadlInteger t_1 = Aadl2Factory.eINSTANCE.createAadlInteger(); + if (((leftNum_1.getUnitsType() != null) && (rightNum_1.getUnitsType() != null))) { + /* G |- leftNum ~~ rightNum or { fail error 'typing: arguments have different unit types' source binary } */ + { + RuleFailedException previousFailure = null; + try { + /* G |- leftNum ~~ rightNum */ + sameTypeInternal(G, _trace_, leftNum_1, rightNum_1); + } catch (Exception e_4) { + previousFailure = extractRuleFailedException(e_4); + /* fail error 'typing: arguments have different unit types' source binary */ + String error_17 = "typing: arguments have different unit types"; + EObject source_17 = binary; + throwForExplicitFail(error_17, new ErrorInformation(source_17, null)); + } + } + } else { + UnitsType _unitsType_1 = rightNum_1.getUnitsType(); + boolean _tripleNotEquals_1 = (_unitsType_1 != null); + if (_tripleNotEquals_1) { + /* fail error 'typing: argument must have a unit when dividing by a number with unit' source binary.left */ + String error_18 = "typing: argument must have a unit when dividing by a number with unit"; + PropertyExpression _left_6 = binary.getLeft(); + EObject source_18 = _left_6; + throwForExplicitFail(error_18, new ErrorInformation(source_18, null)); + } else { + t_1.setReferencedUnitsType(leftNum_1.getUnitsType()); + } + } + type = t_1; + break; + default: + /* fail error 'typing: unhandled binary operator encountered' source binary */ + String error_19 = "typing: unhandled binary operator encountered"; + EObject source_19 = binary; + throwForExplicitFail(error_19, new ErrorInformation(source_19, null)); + break; + } + } else { + /* fail error 'typing: unhandled binary operator encountered' source binary */ + String error_19 = "typing: unhandled binary operator encountered"; + EObject source_19 = binary; + throwForExplicitFail(error_19, new ErrorInformation(source_19, null)); + } + return new Result(type); + } + + protected Result typeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final AUnaryOperation unary) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleUnaryExpression(G, _subtrace_, unary); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("UnaryExpression") + stringRepForEnv(G) + " |- " + stringRep(unary) + " : " + stringRep(_result_.getFirst()); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleUnaryExpression) { + typeThrowException(ruleName("UnaryExpression") + stringRepForEnv(G) + " |- " + stringRep(unary) + " : " + "PropertyType", + UNARYEXPRESSION, + e_applyRuleUnaryExpression, unary, new ErrorInformation[] {new ErrorInformation(unary)}); + return null; + } + } + + protected Result applyRuleUnaryExpression(final RuleEnvironment G, final RuleApplicationTrace _trace_, final AUnaryOperation unary) throws RuleFailedException { + PropertyType type = null; // output parameter + /* G |- unary.operand : var PropertyType opType */ + PropertyExpression _operand = unary.getOperand(); + PropertyType opType = null; + Result result = typeInternal(G, _trace_, _operand); + checkAssignableTo(result.getFirst(), PropertyType.class); + opType = (PropertyType) result.getFirst(); + + Operation _operator = unary.getOperator(); + if (_operator != null) { + switch (_operator) { + case PLUS: + case MINUS: + if ((opType instanceof NumberType)) { + type = opType; + } else { + /* fail error 'typing: operand is not numeric' source unary */ + String error = "typing: operand is not numeric"; + EObject source = unary; + throwForExplicitFail(error, new ErrorInformation(source, null)); + } + break; + case NOT: + type = Aadl2Factory.eINSTANCE.createAadlBoolean(); + break; + default: + /* fail error 'typing: unhandled unary operator encountered' source unary */ + String error_1 = "typing: unhandled unary operator encountered"; + EObject source_1 = unary; + throwForExplicitFail(error_1, new ErrorInformation(source_1, null)); + break; + } + } else { + /* fail error 'typing: unhandled unary operator encountered' source unary */ + String error_1 = "typing: unhandled unary operator encountered"; + EObject source_1 = unary; + throwForExplicitFail(error_1, new ErrorInformation(source_1, null)); + } + return new Result(type); + } + + protected Result typeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final AVariableReference vRef) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleAVariableReference(G, _subtrace_, vRef); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("AVariableReference") + stringRepForEnv(G) + " |- " + stringRep(vRef) + " : " + stringRep(_result_.getFirst()); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleAVariableReference) { + typeThrowException(ruleName("AVariableReference") + stringRepForEnv(G) + " |- " + stringRep(vRef) + " : " + "PropertyType", + AVARIABLEREFERENCE, + e_applyRuleAVariableReference, vRef, new ErrorInformation[] {new ErrorInformation(vRef)}); + return null; + } + } + + protected Result applyRuleAVariableReference(final RuleEnvironment G, final RuleApplicationTrace _trace_, final AVariableReference vRef) throws RuleFailedException { + PropertyType type = null; // output parameter + /* G |- vRef.variable : type */ + AVariableDeclaration _variable = vRef.getVariable(); + Result result = typeInternal(G, _trace_, _variable); + checkAssignableTo(result.getFirst(), PropertyType.class); + type = (PropertyType) result.getFirst(); + + return new Result(type); + } + + protected Result typeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final ARange rangeExp) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleRangeExpression(G, _subtrace_, rangeExp); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("RangeExpression") + stringRepForEnv(G) + " |- " + stringRep(rangeExp) + " : " + stringRep(_result_.getFirst()); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleRangeExpression) { + typeThrowException(ruleName("RangeExpression") + stringRepForEnv(G) + " |- " + stringRep(rangeExp) + " : " + "PropertyType", + RANGEEXPRESSION, + e_applyRuleRangeExpression, rangeExp, new ErrorInformation[] {new ErrorInformation(rangeExp)}); + return null; + } + } + + protected Result applyRuleRangeExpression(final RuleEnvironment G, final RuleApplicationTrace _trace_, final ARange rangeExp) throws RuleFailedException { + PropertyType type = null; // output parameter + /* G |- rangeExp.minimum : var PropertyType minType */ + PropertyExpression _minimum = rangeExp.getMinimum(); + PropertyType minType = null; + Result result = typeInternal(G, _trace_, _minimum); + checkAssignableTo(result.getFirst(), PropertyType.class); + minType = (PropertyType) result.getFirst(); + + /* G |- rangeExp.maximum : var PropertyType maxType */ + PropertyExpression _maximum = rangeExp.getMaximum(); + PropertyType maxType = null; + Result result_1 = typeInternal(G, _trace_, _maximum); + checkAssignableTo(result_1.getFirst(), PropertyType.class); + maxType = (PropertyType) result_1.getFirst(); + + if ((!(minType instanceof NumberType))) { + /* fail error 'typing: lower bound must be numeric' source rangeExp.minimum */ + String error = "typing: lower bound must be numeric"; + PropertyExpression _minimum_1 = rangeExp.getMinimum(); + EObject source = _minimum_1; + throwForExplicitFail(error, new ErrorInformation(source, null)); + } + if ((!(maxType instanceof NumberType))) { + /* fail error 'typing: upper bound must be numeric' source rangeExp.maximum */ + String error_1 = "typing: upper bound must be numeric"; + PropertyExpression _maximum_1 = rangeExp.getMaximum(); + EObject source_1 = _maximum_1; + throwForExplicitFail(error_1, new ErrorInformation(source_1, null)); + } + /* G |- minType ~~ maxType or { fail error "typing: lower and upper bound have different units" source rangeExp } */ + { + RuleFailedException previousFailure = null; + try { + /* G |- minType ~~ maxType */ + sameTypeInternal(G, _trace_, minType, maxType); + } catch (Exception e) { + previousFailure = extractRuleFailedException(e); + /* fail error "typing: lower and upper bound have different units" source rangeExp */ + String error_2 = "typing: lower and upper bound have different units"; + EObject source_2 = rangeExp; + throwForExplicitFail(error_2, new ErrorInformation(source_2, null)); + } + } + final RangeType range = Aadl2Factory.eINSTANCE.createRangeType(); + if (((minType instanceof AadlReal) || (maxType instanceof AadlReal))) { + range.createOwnedNumberType(Aadl2Package.eINSTANCE.getAadlReal()); + } else { + range.createOwnedNumberType(Aadl2Package.eINSTANCE.getAadlInteger()); + } + NumberType _numberType = range.getNumberType(); + _numberType.setReferencedUnitsType(((NumberType) minType).getUnitsType()); + type = range; + return new Result(type); + } + + protected Result typeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final AConditional ifExp) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleIfExpression(G, _subtrace_, ifExp); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("IfExpression") + stringRepForEnv(G) + " |- " + stringRep(ifExp) + " : " + stringRep(_result_.getFirst()); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleIfExpression) { + typeThrowException(ruleName("IfExpression") + stringRepForEnv(G) + " |- " + stringRep(ifExp) + " : " + "PropertyType", + IFEXPRESSION, + e_applyRuleIfExpression, ifExp, new ErrorInformation[] {new ErrorInformation(ifExp)}); + return null; + } + } + + protected Result applyRuleIfExpression(final RuleEnvironment G, final RuleApplicationTrace _trace_, final AConditional ifExp) throws RuleFailedException { + PropertyType type = null; // output parameter + /* G |- ifExp.^if : var PropertyType ifType */ + PropertyExpression _if = ifExp.getIf(); + PropertyType ifType = null; + Result result = typeInternal(G, _trace_, _if); + checkAssignableTo(result.getFirst(), PropertyType.class); + ifType = (PropertyType) result.getFirst(); + + /* G |- ifExp.^then : var PropertyType thenType */ + PropertyExpression _then = ifExp.getThen(); + PropertyType thenType = null; + Result result_1 = typeInternal(G, _trace_, _then); + checkAssignableTo(result_1.getFirst(), PropertyType.class); + thenType = (PropertyType) result_1.getFirst(); + + /* G |- ifExp.^else : var PropertyType elseType */ + PropertyExpression _else = ifExp.getElse(); + PropertyType elseType = null; + Result result_2 = typeInternal(G, _trace_, _else); + checkAssignableTo(result_2.getFirst(), PropertyType.class); + elseType = (PropertyType) result_2.getFirst(); + + if ((!(ifType instanceof AadlBoolean))) { + /* fail error 'typing: condition must be boolean' source ifExp.^if */ + String error = "typing: condition must be boolean"; + PropertyExpression _if_1 = ifExp.getIf(); + EObject source = _if_1; + throwForExplicitFail(error, new ErrorInformation(source, null)); + } + /* G |- thenType ~~ elseType or { fail error 'typing: then and else part must have the same type' source ifExp } */ + { + RuleFailedException previousFailure = null; + try { + /* G |- thenType ~~ elseType */ + sameTypeInternal(G, _trace_, thenType, elseType); + } catch (Exception e) { + previousFailure = extractRuleFailedException(e); + /* fail error 'typing: then and else part must have the same type' source ifExp */ + String error_1 = "typing: then and else part must have the same type"; + EObject source_1 = ifExp; + throwForExplicitFail(error_1, new ErrorInformation(source_1, null)); + } + } + if ((thenType instanceof NumberType)) { + type = this.combineNumericInternal(_trace_, ((NumberType)thenType), ((NumberType) elseType)); + } else { + type = thenType; + } + return new Result(type); + } + + protected Result typeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final AFunctionCall call) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleFunctionCall(G, _subtrace_, call); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("FunctionCall") + stringRepForEnv(G) + " |- " + stringRep(call) + " : " + stringRep(_result_.getFirst()); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleFunctionCall) { + typeThrowException(ruleName("FunctionCall") + stringRepForEnv(G) + " |- " + stringRep(call) + " : " + "PropertyType", + FUNCTIONCALL, + e_applyRuleFunctionCall, call, new ErrorInformation[] {new ErrorInformation(call)}); + return null; + } + } + + protected Result applyRuleFunctionCall(final RuleEnvironment G, final RuleApplicationTrace _trace_, final AFunctionCall call) throws RuleFailedException { + PropertyType type = null; // output parameter + String _function = call.getFunction(); + if (_function != null) { + switch (_function) { + case "min": + case "max": + /* call.arguments.size >= 1 or { fail error call.function + ' must have at least one argument' source call } */ + { + RuleFailedException previousFailure = null; + try { + int _size = call.getArguments().size(); + boolean _greaterEqualsThan = (_size >= 1); + /* call.arguments.size >= 1 */ + if (!_greaterEqualsThan) { + sneakyThrowRuleFailedException("call.arguments.size >= 1"); + } + } catch (Exception e) { + previousFailure = extractRuleFailedException(e); + /* fail error call.function + ' must have at least one argument' source call */ + String _function_1 = call.getFunction(); + String _plus = (_function_1 + " must have at least one argument"); + String error = _plus; + EObject source = call; + throwForExplicitFail(error, new ErrorInformation(source, null)); + } + } + UnitsType _xblockexpression = null; + { + /* G |- call.arguments.get(0) : var PropertyType t */ + PropertyExpression _get = call.getArguments().get(0); + PropertyType t = null; + Result result = typeInternal(G, _trace_, _get); + checkAssignableTo(result.getFirst(), PropertyType.class); + t = (PropertyType) result.getFirst(); + + UnitsType _xifexpression = null; + if ((t instanceof NumberType)) { + _xifexpression = ((NumberType)t).getUnitsType(); + } else { + UnitsType _xifexpression_1 = null; + if ((t instanceof RangeType)) { + _xifexpression_1 = ((RangeType)t).getNumberType().getUnitsType(); + } + _xifexpression = _xifexpression_1; + } + _xblockexpression = (_xifexpression); + } + final UnitsType unitsType = _xblockexpression; + final Consumer _function_2 = (PropertyExpression arg) -> { + /* G |- arg : var PropertyType argType */ + PropertyType argType = null; + Result result = typeInternal(G, _trace_, arg); + checkAssignableTo(result.getFirst(), PropertyType.class); + argType = (PropertyType) result.getFirst(); + + boolean _matched = false; + if (argType instanceof AadlReal) { + _matched=true; + UnitsType _unitsType = ((AadlReal)argType).getUnitsType(); + boolean _tripleNotEquals = (_unitsType != unitsType); + if (_tripleNotEquals) { + /* fail error 'typing: all arguments must have the same units type' source arg */ + String error_1 = "typing: all arguments must have the same units type"; + EObject source_1 = arg; + throwForExplicitFail(error_1, new ErrorInformation(source_1, null)); + } + } + if (!_matched) { + if (argType instanceof AadlInteger) { + _matched=true; + UnitsType _unitsType = ((AadlInteger)argType).getUnitsType(); + boolean _tripleNotEquals = (_unitsType != unitsType); + if (_tripleNotEquals) { + /* fail error 'typing: all arguments must have the same units type' source arg */ + String error_1 = "typing: all arguments must have the same units type"; + EObject source_1 = arg; + throwForExplicitFail(error_1, new ErrorInformation(source_1, null)); + } + } + } + if (!_matched) { + if (argType instanceof RangeType) { + _matched=true; + UnitsType _unitsType = ((RangeType)argType).getNumberType().getUnitsType(); + boolean _tripleNotEquals = (_unitsType != unitsType); + if (_tripleNotEquals) { + /* fail error 'typing: all arguments must have the same units type' source arg */ + String error_1 = "typing: all arguments must have the same units type"; + EObject source_1 = arg; + throwForExplicitFail(error_1, new ErrorInformation(source_1, null)); + } + } + } + if (!_matched) { + /* fail error 'typing: argument must be numeric or a range' source arg */ + String error_1 = "typing: argument must be numeric or a range"; + EObject source_1 = arg; + throwForExplicitFail(error_1, new ErrorInformation(source_1, null)); + } + }; + call.getArguments().forEach(_function_2); + final Function1 _function_3 = (PropertyExpression arg) -> { + boolean _xblockexpression_1 = false; + { + /* G |- arg : var PropertyType argType */ + PropertyType argType = null; + Result result = typeInternal(G, _trace_, arg); + checkAssignableTo(result.getFirst(), PropertyType.class); + argType = (PropertyType) result.getFirst(); + + boolean _switchResult_1 = false; + boolean _matched = false; + if (argType instanceof AadlReal) { + _matched=true; + _switchResult_1 = false; + } + if (!_matched) { + if (argType instanceof AadlInteger) { + _matched=true; + _switchResult_1 = true; + } + } + if (!_matched) { + if (argType instanceof RangeType) { + _matched=true; + NumberType _numberType = ((RangeType)argType).getNumberType(); + _switchResult_1 = (_numberType instanceof AadlInteger); + } + } + if (!_matched) { + _switchResult_1 = false; + } + _xblockexpression_1 = _switchResult_1; + } + return Boolean.valueOf(_xblockexpression_1); + }; + final boolean allInt = IterableExtensions.forall(call.getArguments(), _function_3); + NumberType _xifexpression = null; + if (allInt) { + _xifexpression = Aadl2Factory.eINSTANCE.createAadlInteger(); + } else { + _xifexpression = Aadl2Factory.eINSTANCE.createAadlReal(); + } + type = _xifexpression; + ((NumberType) type).setReferencedUnitsType(unitsType); + break; + case "abs": + /* call.arguments.size === 1 or { fail error 'abs must have one argument' source call } */ + { + RuleFailedException previousFailure = null; + try { + int _size_1 = call.getArguments().size(); + boolean _tripleEquals = (_size_1 == 1); + /* call.arguments.size === 1 */ + if (!_tripleEquals) { + sneakyThrowRuleFailedException("call.arguments.size === 1"); + } + } catch (Exception e_1) { + previousFailure = extractRuleFailedException(e_1); + /* fail error 'abs must have one argument' source call */ + String error_1 = "abs must have one argument"; + EObject source_1 = call; + throwForExplicitFail(error_1, new ErrorInformation(source_1, null)); + } + } + final PropertyExpression arg = call.getArguments().get(0); + /* G |- arg : var PropertyType argType */ + PropertyType argType = null; + Result result = typeInternal(G, _trace_, arg); + checkAssignableTo(result.getFirst(), PropertyType.class); + argType = (PropertyType) result.getFirst(); + + if ((!(argType instanceof NumberType))) { + /* fail error 'typing: argument must be numeric' source arg */ + String error_2 = "typing: argument must be numeric"; + EObject source_2 = arg; + throwForExplicitFail(error_2, new ErrorInformation(source_2, null)); + } + type = argType; + break; + case "floor": + case "ceil": + case "round": + /* call.arguments.size === 1 or { fail error 'abs must have one argument' source call } */ + { + RuleFailedException previousFailure = null; + try { + int _size_2 = call.getArguments().size(); + boolean _tripleEquals_1 = (_size_2 == 1); + /* call.arguments.size === 1 */ + if (!_tripleEquals_1) { + sneakyThrowRuleFailedException("call.arguments.size === 1"); + } + } catch (Exception e_2) { + previousFailure = extractRuleFailedException(e_2); + /* fail error 'abs must have one argument' source call */ + String error_3 = "abs must have one argument"; + EObject source_3 = call; + throwForExplicitFail(error_3, new ErrorInformation(source_3, null)); + } + } + final PropertyExpression arg_1 = call.getArguments().get(0); + /* G |- arg : var PropertyType argType */ + PropertyType argType_1 = null; + Result result_1 = typeInternal(G, _trace_, arg_1); + checkAssignableTo(result_1.getFirst(), PropertyType.class); + argType_1 = (PropertyType) result_1.getFirst(); + + if ((argType_1 instanceof NumberType)) { + type = Aadl2Factory.eINSTANCE.createAadlInteger(); + ((NumberType) type).setReferencedUnitsType(((NumberType)argType_1).getUnitsType()); + } else { + /* fail error 'typing: argument must be numeric' source arg */ + String error_4 = "typing: argument must be numeric"; + EObject source_4 = arg_1; + throwForExplicitFail(error_4, new ErrorInformation(source_4, null)); + } + break; + default: + String _methodExists = InterpreterUtil.instance.methodExists(call.getFunction()); + boolean _tripleNotEquals = (_methodExists != null); + if (_tripleNotEquals) { + /* fail error 'unsupported function: ' + call.function source call */ + String _function_4 = call.getFunction(); + String _plus_1 = ("unsupported function: " + _function_4); + String error_5 = _plus_1; + EObject source_5 = call; + throwForExplicitFail(error_5, new ErrorInformation(source_5, null)); + } + break; + } + } else { + String _methodExists = InterpreterUtil.instance.methodExists(call.getFunction()); + boolean _tripleNotEquals = (_methodExists != null); + if (_tripleNotEquals) { + /* fail error 'unsupported function: ' + call.function source call */ + String _function_4 = call.getFunction(); + String _plus_1 = ("unsupported function: " + _function_4); + String error_5 = _plus_1; + EObject source_5 = call; + throwForExplicitFail(error_5, new ErrorInformation(source_5, null)); + } + } + return new Result(type); + } + + protected Result typeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final AUnitExpression unitExp) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleUnitExpression(G, _subtrace_, unitExp); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("UnitExpression") + stringRepForEnv(G) + " |- " + stringRep(unitExp) + " : " + stringRep(_result_.getFirst()); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleUnitExpression) { + typeThrowException(ruleName("UnitExpression") + stringRepForEnv(G) + " |- " + stringRep(unitExp) + " : " + "PropertyType", + UNITEXPRESSION, + e_applyRuleUnitExpression, unitExp, new ErrorInformation[] {new ErrorInformation(unitExp)}); + return null; + } + } + + protected Result applyRuleUnitExpression(final RuleEnvironment G, final RuleApplicationTrace _trace_, final AUnitExpression unitExp) throws RuleFailedException { + PropertyType type = null; // output parameter + /* G |- unitExp.expression : var PropertyType expType */ + PropertyExpression _expression = unitExp.getExpression(); + PropertyType expType = null; + Result result = typeInternal(G, _trace_, _expression); + checkAssignableTo(result.getFirst(), PropertyType.class); + expType = (PropertyType) result.getFirst(); + + UnitLiteral _unit = unitExp.getUnit(); + boolean _tripleEquals = (_unit == null); + if (_tripleEquals) { + type = expType; + } else { + if ((unitExp.isConvert() || unitExp.isDrop())) { + EObject _eContainer = unitExp.getUnit().eContainer(); + final UnitsType targetType = ((UnitsType) _eContainer); + if ((expType instanceof NumberType)) { + UnitsType _unitsType = ((NumberType)expType).getUnitsType(); + boolean _tripleEquals_1 = (_unitsType == null); + if (_tripleEquals_1) { + /* fail error 'typing: expression has no unit' source unitExp.expression */ + String error = "typing: expression has no unit"; + PropertyExpression _expression_1 = unitExp.getExpression(); + EObject source = _expression_1; + throwForExplicitFail(error, new ErrorInformation(source, null)); + } + /* G |- expType.unitsType ~~ targetType or { fail error 'typing: cannot convert ' + stringRep(expType) + ' to ' + stringRep(targetType) source CommonPackage.eINSTANCE.AUnitExpression_Convert } */ + { + RuleFailedException previousFailure = null; + try { + /* G |- expType.unitsType ~~ targetType */ + UnitsType _unitsType_1 = ((NumberType)expType).getUnitsType(); + sameTypeInternal(G, _trace_, _unitsType_1, targetType); + } catch (Exception e) { + previousFailure = extractRuleFailedException(e); + /* fail error 'typing: cannot convert ' + stringRep(expType) + ' to ' + stringRep(targetType) source CommonPackage.eINSTANCE.AUnitExpression_Convert */ + String _stringRep = this.stringRep(expType); + String _plus = ("typing: cannot convert " + _stringRep); + String _plus_1 = (_plus + " to "); + String _stringRep_1 = this.stringRep(targetType); + String _plus_2 = (_plus_1 + _stringRep_1); + String error_1 = _plus_2; + EAttribute _aUnitExpression_Convert = CommonPackage.eINSTANCE.getAUnitExpression_Convert(); + EObject source_1 = _aUnitExpression_Convert; + throwForExplicitFail(error_1, new ErrorInformation(source_1, null)); + } + } + NumberType _xifexpression = null; + if ((expType instanceof AadlInteger)) { + _xifexpression = Aadl2Factory.eINSTANCE.createAadlInteger(); + } else { + _xifexpression = Aadl2Factory.eINSTANCE.createAadlReal(); + } + final NumberType result_1 = _xifexpression; + boolean _isConvert = unitExp.isConvert(); + if (_isConvert) { + EObject _eContainer_1 = unitExp.getUnit().eContainer(); + result_1.setReferencedUnitsType(((UnitsType) _eContainer_1)); + } + type = result_1; + } else { + /* fail error 'typing: can only convert unit of a numeric type' source unitExp feature CommonPackage.eINSTANCE.AUnitExpression_Convert */ + String error_2 = "typing: can only convert unit of a numeric type"; + EObject source_2 = unitExp; + EAttribute _aUnitExpression_Convert_1 = CommonPackage.eINSTANCE.getAUnitExpression_Convert(); + EStructuralFeature feature = _aUnitExpression_Convert_1; + throwForExplicitFail(error_2, new ErrorInformation(source_2, feature)); + } + } else { + if ((expType instanceof NumberType)) { + UnitsType _unitsType_2 = ((NumberType)expType).getUnitsType(); + boolean _tripleNotEquals = (_unitsType_2 != null); + if (_tripleNotEquals) { + /* fail error 'typing: expression already has a unit' source unitExp.expression */ + String error_3 = "typing: expression already has a unit"; + PropertyExpression _expression_2 = unitExp.getExpression(); + EObject source_3 = _expression_2; + throwForExplicitFail(error_3, new ErrorInformation(source_3, null)); + } + NumberType _xifexpression_1 = null; + if ((expType instanceof AadlInteger)) { + _xifexpression_1 = Aadl2Factory.eINSTANCE.createAadlInteger(); + } else { + _xifexpression_1 = Aadl2Factory.eINSTANCE.createAadlReal(); + } + final NumberType result_2 = _xifexpression_1; + EObject _eContainer_2 = unitExp.getUnit().eContainer(); + result_2.setReferencedUnitsType(((UnitsType) _eContainer_2)); + type = result_2; + } else { + /* fail error 'typing: can only assign unit to a numeric type' source unitExp feature CommonPackage.eINSTANCE.AUnitExpression_Unit */ + String error_4 = "typing: can only assign unit to a numeric type"; + EObject source_4 = unitExp; + EReference _aUnitExpression_Unit = CommonPackage.eINSTANCE.getAUnitExpression_Unit(); + EStructuralFeature feature_1 = _aUnitExpression_Unit; + throwForExplicitFail(error_4, new ErrorInformation(source_4, feature_1)); + } + } + } + return new Result(type); + } + + protected Result typeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final APropertyReference ref) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRulePropertyReference(G, _subtrace_, ref); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("PropertyReference") + stringRepForEnv(G) + " |- " + stringRep(ref) + " : " + stringRep(_result_.getFirst()); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRulePropertyReference) { + typeThrowException(ruleName("PropertyReference") + stringRepForEnv(G) + " |- " + stringRep(ref) + " : " + "PropertyType", + PROPERTYREFERENCE, + e_applyRulePropertyReference, ref, new ErrorInformation[] {new ErrorInformation(ref)}); + return null; + } + } + + protected Result applyRulePropertyReference(final RuleEnvironment G, final RuleApplicationTrace _trace_, final APropertyReference ref) throws RuleFailedException { + + return new Result(_applyRulePropertyReference_1(G, ref)); + } + + private PropertyType _applyRulePropertyReference_1(final RuleEnvironment G, final APropertyReference ref) throws RuleFailedException { + PropertyType _xblockexpression = null; + { + final AbstractNamedValue namedValue = ref.getProperty(); + PropertyType _switchResult = null; + boolean _matched = false; + if (namedValue instanceof PropertyConstant) { + _matched=true; + _switchResult = ((PropertyConstant)namedValue).getPropertyType(); + } + if (!_matched) { + if (namedValue instanceof Property) { + _matched=true; + _switchResult = ((Property)namedValue).getPropertyType(); + } + } + if (!_matched) { + /* fail */ + throwForExplicitFail(); + } + _xblockexpression = (_switchResult); + } + return _xblockexpression; + } + + protected Result typeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final AModelReference ref) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleModelReference(G, _subtrace_, ref); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("ModelReference") + stringRepForEnv(G) + " |- " + stringRep(ref) + " : " + stringRep(_result_.getFirst()); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleModelReference) { + typeThrowException(ruleName("ModelReference") + stringRepForEnv(G) + " |- " + stringRep(ref) + " : " + "ModelRef", + MODELREFERENCE, + e_applyRuleModelReference, ref, new ErrorInformation[] {new ErrorInformation(ref)}); + return null; + } + } + + protected Result applyRuleModelReference(final RuleEnvironment G, final RuleApplicationTrace _trace_, final AModelReference ref) throws RuleFailedException { + + return new Result(_applyRuleModelReference_1(G, ref)); + } + + private ModelRef _applyRuleModelReference_1(final RuleEnvironment G, final AModelReference ref) throws RuleFailedException { + ModelRef _createModelRef = CommonFactory.eINSTANCE.createModelRef(); + return _createModelRef; + } + + protected Result typeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final IntegerLiteral value) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleIntegerLiteral(G, _subtrace_, value); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("IntegerLiteral") + stringRepForEnv(G) + " |- " + stringRep(value) + " : " + stringRep(_result_.getFirst()); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleIntegerLiteral) { + typeThrowException(ruleName("IntegerLiteral") + stringRepForEnv(G) + " |- " + stringRep(value) + " : " + "AadlInteger", + INTEGERLITERAL, + e_applyRuleIntegerLiteral, value, new ErrorInformation[] {new ErrorInformation(value)}); + return null; + } + } + + protected Result applyRuleIntegerLiteral(final RuleEnvironment G, final RuleApplicationTrace _trace_, final IntegerLiteral value) throws RuleFailedException { + + return new Result(_applyRuleIntegerLiteral_1(G, value)); + } + + private AadlInteger _applyRuleIntegerLiteral_1(final RuleEnvironment G, final IntegerLiteral value) throws RuleFailedException { + AadlInteger _createAadlInteger = Aadl2Factory.eINSTANCE.createAadlInteger(); + return _createAadlInteger; + } + + protected Result typeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final RealLiteral value) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleRealLiteral(G, _subtrace_, value); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("RealLiteral") + stringRepForEnv(G) + " |- " + stringRep(value) + " : " + stringRep(_result_.getFirst()); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleRealLiteral) { + typeThrowException(ruleName("RealLiteral") + stringRepForEnv(G) + " |- " + stringRep(value) + " : " + "AadlReal", + REALLITERAL, + e_applyRuleRealLiteral, value, new ErrorInformation[] {new ErrorInformation(value)}); + return null; + } + } + + protected Result applyRuleRealLiteral(final RuleEnvironment G, final RuleApplicationTrace _trace_, final RealLiteral value) throws RuleFailedException { + + return new Result(_applyRuleRealLiteral_1(G, value)); + } + + private AadlReal _applyRuleRealLiteral_1(final RuleEnvironment G, final RealLiteral value) throws RuleFailedException { + AadlReal _createAadlReal = Aadl2Factory.eINSTANCE.createAadlReal(); + return _createAadlReal; + } + + protected Result typeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final BooleanLiteral bool) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleBooleanLiteral(G, _subtrace_, bool); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("BooleanLiteral") + stringRepForEnv(G) + " |- " + stringRep(bool) + " : " + stringRep(_result_.getFirst()); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleBooleanLiteral) { + typeThrowException(ruleName("BooleanLiteral") + stringRepForEnv(G) + " |- " + stringRep(bool) + " : " + "AadlBoolean", + BOOLEANLITERAL, + e_applyRuleBooleanLiteral, bool, new ErrorInformation[] {new ErrorInformation(bool)}); + return null; + } + } + + protected Result applyRuleBooleanLiteral(final RuleEnvironment G, final RuleApplicationTrace _trace_, final BooleanLiteral bool) throws RuleFailedException { + + return new Result(_applyRuleBooleanLiteral_1(G, bool)); + } + + private AadlBoolean _applyRuleBooleanLiteral_1(final RuleEnvironment G, final BooleanLiteral bool) throws RuleFailedException { + AadlBoolean _createAadlBoolean = Aadl2Factory.eINSTANCE.createAadlBoolean(); + return _createAadlBoolean; + } + + protected Result typeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final StringLiteral str) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleStringLiteral(G, _subtrace_, str); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("StringLiteral") + stringRepForEnv(G) + " |- " + stringRep(str) + " : " + stringRep(_result_.getFirst()); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleStringLiteral) { + typeThrowException(ruleName("StringLiteral") + stringRepForEnv(G) + " |- " + stringRep(str) + " : " + "AadlString", + STRINGLITERAL, + e_applyRuleStringLiteral, str, new ErrorInformation[] {new ErrorInformation(str)}); + return null; + } + } + + protected Result applyRuleStringLiteral(final RuleEnvironment G, final RuleApplicationTrace _trace_, final StringLiteral str) throws RuleFailedException { + + return new Result(_applyRuleStringLiteral_1(G, str)); + } + + private AadlString _applyRuleStringLiteral_1(final RuleEnvironment G, final StringLiteral str) throws RuleFailedException { + AadlString _createAadlString = Aadl2Factory.eINSTANCE.createAadlString(); + return _createAadlString; + } + + protected Result sameTypeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final AadlBoolean l, final AadlBoolean r) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleSameBoolean(G, _subtrace_, l, r); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("sameBoolean") + stringRepForEnv(G) + " |- " + stringRep(l) + " ~~ " + stringRep(r); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleSameBoolean) { + sameTypeThrowException(ruleName("sameBoolean") + stringRepForEnv(G) + " |- " + stringRep(l) + " ~~ " + stringRep(r), + SAMEBOOLEAN, + e_applyRuleSameBoolean, l, r, new ErrorInformation[] {new ErrorInformation(l), new ErrorInformation(r)}); + return null; + } + } + + protected Result applyRuleSameBoolean(final RuleEnvironment G, final RuleApplicationTrace _trace_, final AadlBoolean l, final AadlBoolean r) throws RuleFailedException { + + return new Result(true); + } + + protected Result sameTypeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final AadlString l, final AadlString r) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleSameString(G, _subtrace_, l, r); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("sameString") + stringRepForEnv(G) + " |- " + stringRep(l) + " ~~ " + stringRep(r); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleSameString) { + sameTypeThrowException(ruleName("sameString") + stringRepForEnv(G) + " |- " + stringRep(l) + " ~~ " + stringRep(r), + SAMESTRING, + e_applyRuleSameString, l, r, new ErrorInformation[] {new ErrorInformation(l), new ErrorInformation(r)}); + return null; + } + } + + protected Result applyRuleSameString(final RuleEnvironment G, final RuleApplicationTrace _trace_, final AadlString l, final AadlString r) throws RuleFailedException { + + return new Result(true); + } + + protected Result sameTypeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final ModelRef l, final ModelRef r) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleSameModelRef(G, _subtrace_, l, r); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("sameModelRef") + stringRepForEnv(G) + " |- " + stringRep(l) + " ~~ " + stringRep(r); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleSameModelRef) { + sameTypeThrowException(ruleName("sameModelRef") + stringRepForEnv(G) + " |- " + stringRep(l) + " ~~ " + stringRep(r), + SAMEMODELREF, + e_applyRuleSameModelRef, l, r, new ErrorInformation[] {new ErrorInformation(l), new ErrorInformation(r)}); + return null; + } + } + + protected Result applyRuleSameModelRef(final RuleEnvironment G, final RuleApplicationTrace _trace_, final ModelRef l, final ModelRef r) throws RuleFailedException { + + return new Result(true); + } + + protected Result sameTypeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final EnumerationType left, final EnumerationType right) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleSameEnumeration(G, _subtrace_, left, right); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("sameEnumeration") + stringRepForEnv(G) + " |- " + stringRep(left) + " ~~ " + stringRep(right); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleSameEnumeration) { + sameTypeThrowException(ruleName("sameEnumeration") + stringRepForEnv(G) + " |- " + stringRep(left) + " ~~ " + stringRep(right), + SAMEENUMERATION, + e_applyRuleSameEnumeration, left, right, new ErrorInformation[] {new ErrorInformation(left), new ErrorInformation(right)}); + return null; + } + } + + protected Result applyRuleSameEnumeration(final RuleEnvironment G, final RuleApplicationTrace _trace_, final EnumerationType left, final EnumerationType right) throws RuleFailedException { + /* left.qualifiedName().equals(right.qualifiedName()) */ + if (!left.qualifiedName().equals(right.qualifiedName())) { + sneakyThrowRuleFailedException("left.qualifiedName().equals(right.qualifiedName())"); + } + return new Result(true); + } + + protected Result sameTypeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final NumberType left, final NumberType right) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleSameNumber(G, _subtrace_, left, right); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("sameNumber") + stringRepForEnv(G) + " |- " + stringRep(left) + " ~~ " + stringRep(right); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleSameNumber) { + sameTypeThrowException(ruleName("sameNumber") + stringRepForEnv(G) + " |- " + stringRep(left) + " ~~ " + stringRep(right), + SAMENUMBER, + e_applyRuleSameNumber, left, right, new ErrorInformation[] {new ErrorInformation(left), new ErrorInformation(right)}); + return null; + } + } + + protected Result applyRuleSameNumber(final RuleEnvironment G, final RuleApplicationTrace _trace_, final NumberType left, final NumberType right) throws RuleFailedException { + /* { left.unitsType === null && right.unitsType === null } or { left.unitsType !== null && right.unitsType !== null G |- left.unitsType ~~ right.unitsType } */ + { + RuleFailedException previousFailure = null; + try { + /* left.unitsType === null && right.unitsType === null */ + if (!((left.getUnitsType() == null) && (right.getUnitsType() == null))) { + sneakyThrowRuleFailedException("left.unitsType === null && right.unitsType === null"); + } + } catch (Exception e) { + previousFailure = extractRuleFailedException(e); + /* left.unitsType !== null && right.unitsType !== null */ + if (!((left.getUnitsType() != null) && (right.getUnitsType() != null))) { + sneakyThrowRuleFailedException("left.unitsType !== null && right.unitsType !== null"); + } + /* G |- left.unitsType ~~ right.unitsType */ + UnitsType _unitsType = left.getUnitsType(); + UnitsType _unitsType_1 = right.getUnitsType(); + sameTypeInternal(G, _trace_, _unitsType, _unitsType_1); + } + } + return new Result(true); + } + + protected Result sameTypeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final RangeType left, final RangeType right) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleSameRange(G, _subtrace_, left, right); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("sameRange") + stringRepForEnv(G) + " |- " + stringRep(left) + " ~~ " + stringRep(right); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleSameRange) { + sameTypeThrowException(ruleName("sameRange") + stringRepForEnv(G) + " |- " + stringRep(left) + " ~~ " + stringRep(right), + SAMERANGE, + e_applyRuleSameRange, left, right, new ErrorInformation[] {new ErrorInformation(left), new ErrorInformation(right)}); + return null; + } + } + + protected Result applyRuleSameRange(final RuleEnvironment G, final RuleApplicationTrace _trace_, final RangeType left, final RangeType right) throws RuleFailedException { + /* G |- left.numberType ~~ right.numberType */ + NumberType _numberType = left.getNumberType(); + NumberType _numberType_1 = right.getNumberType(); + sameTypeInternal(G, _trace_, _numberType, _numberType_1); + return new Result(true); + } + + protected Result sameTypeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final ListType left, final ListType right) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleSameList(G, _subtrace_, left, right); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("sameList") + stringRepForEnv(G) + " |- " + stringRep(left) + " ~~ " + stringRep(right); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleSameList) { + sameTypeThrowException(ruleName("sameList") + stringRepForEnv(G) + " |- " + stringRep(left) + " ~~ " + stringRep(right), + SAMELIST, + e_applyRuleSameList, left, right, new ErrorInformation[] {new ErrorInformation(left), new ErrorInformation(right)}); + return null; + } + } + + protected Result applyRuleSameList(final RuleEnvironment G, final RuleApplicationTrace _trace_, final ListType left, final ListType right) throws RuleFailedException { + /* G |- left.elementType ~~ right.elementType */ + PropertyType _elementType = left.getElementType(); + PropertyType _elementType_1 = right.getElementType(); + sameTypeInternal(G, _trace_, _elementType, _elementType_1); + return new Result(true); + } + + protected Result sameTypeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final RecordType left, final RecordType right) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleSameRecord(G, _subtrace_, left, right); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("sameRecord") + stringRepForEnv(G) + " |- " + stringRep(left) + " ~~ " + stringRep(right); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleSameRecord) { + sameTypeThrowException(ruleName("sameRecord") + stringRepForEnv(G) + " |- " + stringRep(left) + " ~~ " + stringRep(right), + SAMERECORD, + e_applyRuleSameRecord, left, right, new ErrorInformation[] {new ErrorInformation(left), new ErrorInformation(right)}); + return null; + } + } + + protected Result applyRuleSameRecord(final RuleEnvironment G, final RuleApplicationTrace _trace_, final RecordType left, final RecordType right) throws RuleFailedException { + /* G |= left.ownedFields ~~ right.ownedFields */ + EList _ownedFields = left.getOwnedFields(); + EList _ownedFields_1 = right.getOwnedFields(); + sameTypesInternal(G, _trace_, _ownedFields, _ownedFields_1); + return new Result(true); + } + + protected Result sameTypesImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final EList left, final EList right) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleSameTypeList(G, _subtrace_, left, right); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("sameTypeList") + stringRepForEnv(G) + " |= " + stringRep(left) + " ~~ " + stringRep(right); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleSameTypeList) { + sameTypesThrowException(ruleName("sameTypeList") + stringRepForEnv(G) + " |= " + stringRep(left) + " ~~ " + stringRep(right), + SAMETYPELIST, + e_applyRuleSameTypeList, left, right, new ErrorInformation[] {}); + return null; + } + } + + protected Result applyRuleSameTypeList(final RuleEnvironment G, final RuleApplicationTrace _trace_, final EList left, final EList right) throws RuleFailedException { + int _length = ((Object[])Conversions.unwrapArray(left, Object.class)).length; + int _length_1 = ((Object[])Conversions.unwrapArray(right, Object.class)).length; + boolean _tripleNotEquals = (_length != _length_1); + /* left.length !== right.length */ + if (!_tripleNotEquals) { + sneakyThrowRuleFailedException("left.length !== right.length"); + } + for (int i = 0; (i < ((Object[])Conversions.unwrapArray(left, Object.class)).length); i++) { + final BasicProperty l = left.get(i); + final BasicProperty r = right.get(i); + boolean _equals = l.getName().equals(r.getName()); + /* l.name.equals(r.name) */ + if (!_equals) { + sneakyThrowRuleFailedException("l.name.equals(r.name)"); + } + boolean _isList = l.isList(); + boolean _isList_1 = r.isList(); + boolean _tripleEquals = (Boolean.valueOf(_isList) == Boolean.valueOf(_isList_1)); + /* l.isList() === r.isList() */ + if (!_tripleEquals) { + sneakyThrowRuleFailedException("l.isList() === r.isList()"); + } + /* G |- l.propertyType ~~ r.propertyType */ + PropertyType _propertyType = l.getPropertyType(); + PropertyType _propertyType_1 = r.getPropertyType(); + sameTypeInternal(G, _trace_, _propertyType, _propertyType_1); + } + return new Result(true); + } + + protected Result assignableImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final AExpression exp, final PropertyType type) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleExpressionAssignableToType(G, _subtrace_, exp, type); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("ExpressionAssignableToType") + stringRepForEnv(G) + " |- " + stringRep(exp) + " |> " + stringRep(type); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleExpressionAssignableToType) { + assignableThrowException(ruleName("ExpressionAssignableToType") + stringRepForEnv(G) + " |- " + stringRep(exp) + " |> " + stringRep(type), + EXPRESSIONASSIGNABLETOTYPE, + e_applyRuleExpressionAssignableToType, exp, type, new ErrorInformation[] {new ErrorInformation(exp), new ErrorInformation(type)}); + return null; + } + } + + protected Result applyRuleExpressionAssignableToType(final RuleEnvironment G, final RuleApplicationTrace _trace_, final AExpression exp, final PropertyType type) throws RuleFailedException { + PropertyType expType = null; + /* G |- exp : expType */ + Result result = typeInternal(G, _trace_, exp); + checkAssignableTo(result.getFirst(), PropertyType.class); + expType = (PropertyType) result.getFirst(); + + /* G |- expType <: type or { fail error previousFailure.issue source exp } */ + { + RuleFailedException previousFailure = null; + try { + /* G |- expType <: type */ + compatibleInternal(G, _trace_, expType, type); + } catch (Exception e) { + previousFailure = extractRuleFailedException(e); + /* fail error previousFailure.issue source exp */ + String _issue = previousFailure.getIssue(); + String error = _issue; + EObject source = exp; + throwForExplicitFail(error, new ErrorInformation(source, null)); + } + } + return new Result(true); + } + + protected Result compatibleImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final AadlString left, final AadlString right) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRulePrimitiveString(G, _subtrace_, left, right); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("PrimitiveString") + stringRepForEnv(G) + " |- " + stringRep(left) + " <: " + stringRep(right); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRulePrimitiveString) { + compatibleThrowException(ruleName("PrimitiveString") + stringRepForEnv(G) + " |- " + stringRep(left) + " <: " + stringRep(right), + PRIMITIVESTRING, + e_applyRulePrimitiveString, left, right, new ErrorInformation[] {new ErrorInformation(left), new ErrorInformation(right)}); + return null; + } + } + + protected Result applyRulePrimitiveString(final RuleEnvironment G, final RuleApplicationTrace _trace_, final AadlString left, final AadlString right) throws RuleFailedException { + + return new Result(true); + } + + protected Result compatibleImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final AadlBoolean left, final AadlBoolean right) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRulePrimitiveBoolean(G, _subtrace_, left, right); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("PrimitiveBoolean") + stringRepForEnv(G) + " |- " + stringRep(left) + " <: " + stringRep(right); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRulePrimitiveBoolean) { + compatibleThrowException(ruleName("PrimitiveBoolean") + stringRepForEnv(G) + " |- " + stringRep(left) + " <: " + stringRep(right), + PRIMITIVEBOOLEAN, + e_applyRulePrimitiveBoolean, left, right, new ErrorInformation[] {new ErrorInformation(left), new ErrorInformation(right)}); + return null; + } + } + + protected Result applyRulePrimitiveBoolean(final RuleEnvironment G, final RuleApplicationTrace _trace_, final AadlBoolean left, final AadlBoolean right) throws RuleFailedException { + + return new Result(true); + } + + protected Result compatibleImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final NumberType left, final NumberType right) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRulePrimitiveNumber(G, _subtrace_, left, right); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("PrimitiveNumber") + stringRepForEnv(G) + " |- " + stringRep(left) + " <: " + stringRep(right); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRulePrimitiveNumber) { + compatibleThrowException(ruleName("PrimitiveNumber") + stringRepForEnv(G) + " |- " + stringRep(left) + " <: " + stringRep(right), + PRIMITIVENUMBER, + e_applyRulePrimitiveNumber, left, right, new ErrorInformation[] {new ErrorInformation(left), new ErrorInformation(right)}); + return null; + } + } + + protected Result applyRulePrimitiveNumber(final RuleEnvironment G, final RuleApplicationTrace _trace_, final NumberType left, final NumberType right) throws RuleFailedException { + UnitsType _unitsType = left.getUnitsType(); + UnitsType _unitsType_1 = right.getUnitsType(); + boolean _tripleEquals = (_unitsType == _unitsType_1); + /* left.unitsType === right.unitsType */ + if (!_tripleEquals) { + sneakyThrowRuleFailedException("left.unitsType === right.unitsType"); + } + /* left instanceof AadlInteger || right instanceof AadlReal */ + if (!((left instanceof AadlInteger) || (right instanceof AadlReal))) { + sneakyThrowRuleFailedException("left instanceof AadlInteger || right instanceof AadlReal"); + } + return new Result(true); + } + + protected Result compatibleImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final ModelRef left, final ModelRef right) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleModelRef(G, _subtrace_, left, right); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("ModelRef") + stringRepForEnv(G) + " |- " + stringRep(left) + " <: " + stringRep(right); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleModelRef) { + compatibleThrowException(ruleName("ModelRef") + stringRepForEnv(G) + " |- " + stringRep(left) + " <: " + stringRep(right), + MODELREF, + e_applyRuleModelRef, left, right, new ErrorInformation[] {new ErrorInformation(left), new ErrorInformation(right)}); + return null; + } + } + + protected Result applyRuleModelRef(final RuleEnvironment G, final RuleApplicationTrace _trace_, final ModelRef left, final ModelRef right) throws RuleFailedException { + + return new Result(true); + } + + protected Result compatibleImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final ModelRef left, final ReferenceType right) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleModelRef1(G, _subtrace_, left, right); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("ModelRef1") + stringRepForEnv(G) + " |- " + stringRep(left) + " <: " + stringRep(right); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleModelRef1) { + compatibleThrowException(ruleName("ModelRef1") + stringRepForEnv(G) + " |- " + stringRep(left) + " <: " + stringRep(right), + MODELREF1, + e_applyRuleModelRef1, left, right, new ErrorInformation[] {new ErrorInformation(left), new ErrorInformation(right)}); + return null; + } + } + + protected Result applyRuleModelRef1(final RuleEnvironment G, final RuleApplicationTrace _trace_, final ModelRef left, final ReferenceType right) throws RuleFailedException { + + return new Result(true); + } + + protected Result compatibleImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final RangeType left, final RangeType right) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleRange(G, _subtrace_, left, right); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("Range") + stringRepForEnv(G) + " |- " + stringRep(left) + " <: " + stringRep(right); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleRange) { + compatibleThrowException(ruleName("Range") + stringRepForEnv(G) + " |- " + stringRep(left) + " <: " + stringRep(right), + RANGE, + e_applyRuleRange, left, right, new ErrorInformation[] {new ErrorInformation(left), new ErrorInformation(right)}); + return null; + } + } + + protected Result applyRuleRange(final RuleEnvironment G, final RuleApplicationTrace _trace_, final RangeType left, final RangeType right) throws RuleFailedException { + /* G |- left ~~ right */ + sameTypeInternal(G, _trace_, left, right); + return new Result(true); + } + + protected Result compatibleImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final PropertyType left, final PropertyType right) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleNotCompatible(G, _subtrace_, left, right); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("NotCompatible") + stringRepForEnv(G) + " |- " + stringRep(left) + " <: " + stringRep(right); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleNotCompatible) { + compatibleThrowException(ruleName("NotCompatible") + stringRepForEnv(G) + " |- " + stringRep(left) + " <: " + stringRep(right), + NOTCOMPATIBLE, + e_applyRuleNotCompatible, left, right, new ErrorInformation[] {new ErrorInformation(left), new ErrorInformation(right)}); + return null; + } + } + + protected Result applyRuleNotCompatible(final RuleEnvironment G, final RuleApplicationTrace _trace_, final PropertyType left, final PropertyType right) throws RuleFailedException { + /* fail */ + throwForExplicitFail(); + return new Result(true); + } +} diff --git a/alisa/org.osate.alisa.common/xsemantics-gen/org/osate/alisa/common/typing/validation/.gitignore b/alisa/org.osate.alisa.common/xsemantics-gen/org/osate/alisa/common/typing/validation/.gitignore index cdbb9a7c980..af3878821d7 100644 --- a/alisa/org.osate.alisa.common/xsemantics-gen/org/osate/alisa/common/typing/validation/.gitignore +++ b/alisa/org.osate.alisa.common/xsemantics-gen/org/osate/alisa/common/typing/validation/.gitignore @@ -1,4 +1,2 @@ -/CommonTypeSystemValidator.java -/CommonInterpreterValidator.java /.CommonTypeSystemValidator.java._trace /.CommonInterpreterValidator.java._trace diff --git a/alisa/org.osate.alisa.common/xsemantics-gen/org/osate/alisa/common/typing/validation/CommonInterpreterValidator.java b/alisa/org.osate.alisa.common/xsemantics-gen/org/osate/alisa/common/typing/validation/CommonInterpreterValidator.java new file mode 100644 index 00000000000..20650a15da3 --- /dev/null +++ b/alisa/org.osate.alisa.common/xsemantics-gen/org/osate/alisa/common/typing/validation/CommonInterpreterValidator.java @@ -0,0 +1,19 @@ +package org.osate.alisa.common.typing.validation; + +import com.google.inject.Inject; +import org.eclipse.xsemantics.runtime.validation.XsemanticsValidatorErrorGenerator; +import org.eclipse.xtext.validation.AbstractDeclarativeValidator; +import org.osate.alisa.common.typing.CommonInterpreter; + +@SuppressWarnings("all") +public class CommonInterpreterValidator extends AbstractDeclarativeValidator { + @Inject + protected XsemanticsValidatorErrorGenerator errorGenerator; + + @Inject + protected CommonInterpreter xsemanticsSystem; + + protected CommonInterpreter getXsemanticsSystem() { + return this.xsemanticsSystem; + } +} diff --git a/alisa/org.osate.alisa.common/xsemantics-gen/org/osate/alisa/common/typing/validation/CommonTypeSystemValidator.java b/alisa/org.osate.alisa.common/xsemantics-gen/org/osate/alisa/common/typing/validation/CommonTypeSystemValidator.java new file mode 100644 index 00000000000..26b9ea45144 --- /dev/null +++ b/alisa/org.osate.alisa.common/xsemantics-gen/org/osate/alisa/common/typing/validation/CommonTypeSystemValidator.java @@ -0,0 +1,36 @@ +package org.osate.alisa.common.typing.validation; + +import com.google.inject.Inject; +import org.eclipse.xsemantics.runtime.validation.XsemanticsValidatorErrorGenerator; +import org.eclipse.xtext.validation.Check; +import org.osate.aadl2.PropertyExpression; +import org.osate.alisa.common.common.ValDeclaration; +import org.osate.alisa.common.typing.CommonTypeSystem; +import org.osate.alisa.common.validation.AbstractCommonValidator; + +@SuppressWarnings("all") +public class CommonTypeSystemValidator extends AbstractCommonValidator { + @Inject + protected XsemanticsValidatorErrorGenerator errorGenerator; + + @Inject + protected CommonTypeSystem xsemanticsSystem; + + protected CommonTypeSystem getXsemanticsSystem() { + return this.xsemanticsSystem; + } + + @Check + public void checkValDecls(final ValDeclaration valDecl) { + errorGenerator.generateErrors(this, + getXsemanticsSystem().checkValDecls(valDecl), + valDecl); + } + + @Check + public void checkExpressions(final PropertyExpression exp) { + errorGenerator.generateErrors(this, + getXsemanticsSystem().checkExpressions(exp), + exp); + } +} diff --git a/alisa/org.osate.verify/pom.xml b/alisa/org.osate.verify/pom.xml index c68c853ca0e..e549d1b1b67 100644 --- a/alisa/org.osate.verify/pom.xml +++ b/alisa/org.osate.verify/pom.xml @@ -15,15 +15,4 @@ 5.2.3-SNAPSHOT eclipse-plugin - - - - org.eclipse.xtext - xtext-maven-plugin - ${xtext.version} - - - - - diff --git a/alisa/org.osate.verify/xsemantics-gen/org/osate/verify/typing/.gitignore b/alisa/org.osate.verify/xsemantics-gen/org/osate/verify/typing/.gitignore index 6d8d3d41463..315442f2cfb 100644 --- a/alisa/org.osate.verify/xsemantics-gen/org/osate/verify/typing/.gitignore +++ b/alisa/org.osate.verify/xsemantics-gen/org/osate/verify/typing/.gitignore @@ -1,2 +1 @@ /.VerifyTypeSystem.java._trace -/VerifyTypeSystem.java diff --git a/alisa/org.osate.verify/xsemantics-gen/org/osate/verify/typing/VerifyTypeSystem.java b/alisa/org.osate.verify/xsemantics-gen/org/osate/verify/typing/VerifyTypeSystem.java new file mode 100644 index 00000000000..41f827c9da7 --- /dev/null +++ b/alisa/org.osate.verify/xsemantics-gen/org/osate/verify/typing/VerifyTypeSystem.java @@ -0,0 +1,809 @@ +package org.osate.verify.typing; + +import com.google.inject.Provider; +import java.util.Iterator; +import java.util.List; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.EStructuralFeature; +import org.eclipse.xsemantics.runtime.ErrorInformation; +import org.eclipse.xsemantics.runtime.Result; +import org.eclipse.xsemantics.runtime.RuleApplicationTrace; +import org.eclipse.xsemantics.runtime.RuleEnvironment; +import org.eclipse.xsemantics.runtime.RuleFailedException; +import org.eclipse.xtext.util.PolymorphicDispatcher; +import org.osate.aadl2.NumberType; +import org.osate.aadl2.Property; +import org.osate.aadl2.PropertyExpression; +import org.osate.aadl2.PropertyType; +import org.osate.aadl2.UnitLiteral; +import org.osate.aadl2.UnitsType; +import org.osate.alisa.common.common.ComputeDeclaration; +import org.osate.alisa.common.typing.CommonTypeSystem; +import org.osate.verify.verify.ComputeRef; +import org.osate.verify.verify.FormalParameter; +import org.osate.verify.verify.VerificationActivity; +import org.osate.verify.verify.VerificationMethod; +import org.osate.verify.verify.VerifyPackage; + +@SuppressWarnings("all") +public class VerifyTypeSystem extends CommonTypeSystem { + public static final String TYPEFORMALPARAMETER = "org.osate.verify.typing.TypeFormalParameter"; + + public static final String ARGUMENTSEQUENCE = "org.osate.verify.typing.ArgumentSequence"; + + public static final String ARGUMENT = "org.osate.verify.typing.Argument"; + + public static final String RETURNSEQUENCE = "org.osate.verify.typing.ReturnSequence"; + + public static final String RETURN = "org.osate.verify.typing.Return"; + + public static final String PROPERTYVALUES = "org.osate.verify.typing.PropertyValues"; + + private PolymorphicDispatcher> assignArgumentDispatcher; + + private PolymorphicDispatcher> assignReturnDispatcher; + + private PolymorphicDispatcher> assignArgumentsDispatcher; + + private PolymorphicDispatcher> assignReturnsDispatcher; + + private PolymorphicDispatcher> assignPropertiesDispatcher; + + public VerifyTypeSystem() { + init(); + } + + @Override + public void init() { + super.init(); + assignArgumentDispatcher = buildPolymorphicDispatcher1( + "assignArgumentImpl", 4, "|-", "<-"); + assignReturnDispatcher = buildPolymorphicDispatcher1( + "assignReturnImpl", 4, "|-", "-->"); + assignArgumentsDispatcher = buildPolymorphicDispatcher1( + "assignArgumentsImpl", 5, "|-", "~>", "<<"); + assignReturnsDispatcher = buildPolymorphicDispatcher1( + "assignReturnsImpl", 5, "|-", "~>", ">>"); + assignPropertiesDispatcher = buildPolymorphicDispatcher1( + "assignPropertiesImpl", 5, "||-", "~>", "<<"); + } + + public Result assignArgument(final FormalParameter formal, final PropertyExpression actual) { + return assignArgument(new RuleEnvironment(), null, formal, actual); + } + + public Result assignArgument(final RuleEnvironment _environment_, final FormalParameter formal, final PropertyExpression actual) { + return assignArgument(_environment_, null, formal, actual); + } + + public Result assignArgument(final RuleEnvironment _environment_, final RuleApplicationTrace _trace_, final FormalParameter formal, final PropertyExpression actual) { + try { + return assignArgumentInternal(_environment_, _trace_, formal, actual); + } catch (Exception _e_assignArgument) { + return resultForFailure(_e_assignArgument); + } + } + + public Boolean assignArgumentSucceeded(final FormalParameter formal, final PropertyExpression actual) { + return assignArgumentSucceeded(new RuleEnvironment(), null, formal, actual); + } + + public Boolean assignArgumentSucceeded(final RuleEnvironment _environment_, final FormalParameter formal, final PropertyExpression actual) { + return assignArgumentSucceeded(_environment_, null, formal, actual); + } + + public Boolean assignArgumentSucceeded(final RuleEnvironment _environment_, final RuleApplicationTrace _trace_, final FormalParameter formal, final PropertyExpression actual) { + try { + assignArgumentInternal(_environment_, _trace_, formal, actual); + return true; + } catch (Exception _e_assignArgument) { + return false; + } + } + + public Result assignReturn(final FormalParameter ret, final ComputeRef compute) { + return assignReturn(new RuleEnvironment(), null, ret, compute); + } + + public Result assignReturn(final RuleEnvironment _environment_, final FormalParameter ret, final ComputeRef compute) { + return assignReturn(_environment_, null, ret, compute); + } + + public Result assignReturn(final RuleEnvironment _environment_, final RuleApplicationTrace _trace_, final FormalParameter ret, final ComputeRef compute) { + try { + return assignReturnInternal(_environment_, _trace_, ret, compute); + } catch (Exception _e_assignReturn) { + return resultForFailure(_e_assignReturn); + } + } + + public Boolean assignReturnSucceeded(final FormalParameter ret, final ComputeRef compute) { + return assignReturnSucceeded(new RuleEnvironment(), null, ret, compute); + } + + public Boolean assignReturnSucceeded(final RuleEnvironment _environment_, final FormalParameter ret, final ComputeRef compute) { + return assignReturnSucceeded(_environment_, null, ret, compute); + } + + public Boolean assignReturnSucceeded(final RuleEnvironment _environment_, final RuleApplicationTrace _trace_, final FormalParameter ret, final ComputeRef compute) { + try { + assignReturnInternal(_environment_, _trace_, ret, compute); + return true; + } catch (Exception _e_assignReturn) { + return false; + } + } + + public Result assignArguments(final VerificationActivity owner, final List formals, final List actuals) { + return assignArguments(new RuleEnvironment(), null, owner, formals, actuals); + } + + public Result assignArguments(final RuleEnvironment _environment_, final VerificationActivity owner, final List formals, final List actuals) { + return assignArguments(_environment_, null, owner, formals, actuals); + } + + public Result assignArguments(final RuleEnvironment _environment_, final RuleApplicationTrace _trace_, final VerificationActivity owner, final List formals, final List actuals) { + try { + return assignArgumentsInternal(_environment_, _trace_, owner, formals, actuals); + } catch (Exception _e_assignArguments) { + return resultForFailure(_e_assignArguments); + } + } + + public Boolean assignArgumentsSucceeded(final VerificationActivity owner, final List formals, final List actuals) { + return assignArgumentsSucceeded(new RuleEnvironment(), null, owner, formals, actuals); + } + + public Boolean assignArgumentsSucceeded(final RuleEnvironment _environment_, final VerificationActivity owner, final List formals, final List actuals) { + return assignArgumentsSucceeded(_environment_, null, owner, formals, actuals); + } + + public Boolean assignArgumentsSucceeded(final RuleEnvironment _environment_, final RuleApplicationTrace _trace_, final VerificationActivity owner, final List formals, final List actuals) { + try { + assignArgumentsInternal(_environment_, _trace_, owner, formals, actuals); + return true; + } catch (Exception _e_assignArguments) { + return false; + } + } + + public Result assignReturns(final VerificationActivity owner, final List returns, final List computes) { + return assignReturns(new RuleEnvironment(), null, owner, returns, computes); + } + + public Result assignReturns(final RuleEnvironment _environment_, final VerificationActivity owner, final List returns, final List computes) { + return assignReturns(_environment_, null, owner, returns, computes); + } + + public Result assignReturns(final RuleEnvironment _environment_, final RuleApplicationTrace _trace_, final VerificationActivity owner, final List returns, final List computes) { + try { + return assignReturnsInternal(_environment_, _trace_, owner, returns, computes); + } catch (Exception _e_assignReturns) { + return resultForFailure(_e_assignReturns); + } + } + + public Boolean assignReturnsSucceeded(final VerificationActivity owner, final List returns, final List computes) { + return assignReturnsSucceeded(new RuleEnvironment(), null, owner, returns, computes); + } + + public Boolean assignReturnsSucceeded(final RuleEnvironment _environment_, final VerificationActivity owner, final List returns, final List computes) { + return assignReturnsSucceeded(_environment_, null, owner, returns, computes); + } + + public Boolean assignReturnsSucceeded(final RuleEnvironment _environment_, final RuleApplicationTrace _trace_, final VerificationActivity owner, final List returns, final List computes) { + try { + assignReturnsInternal(_environment_, _trace_, owner, returns, computes); + return true; + } catch (Exception _e_assignReturns) { + return false; + } + } + + public Result assignProperties(final VerificationActivity owner, final List properties, final List values) { + return assignProperties(new RuleEnvironment(), null, owner, properties, values); + } + + public Result assignProperties(final RuleEnvironment _environment_, final VerificationActivity owner, final List properties, final List values) { + return assignProperties(_environment_, null, owner, properties, values); + } + + public Result assignProperties(final RuleEnvironment _environment_, final RuleApplicationTrace _trace_, final VerificationActivity owner, final List properties, final List values) { + try { + return assignPropertiesInternal(_environment_, _trace_, owner, properties, values); + } catch (Exception _e_assignProperties) { + return resultForFailure(_e_assignProperties); + } + } + + public Boolean assignPropertiesSucceeded(final VerificationActivity owner, final List properties, final List values) { + return assignPropertiesSucceeded(new RuleEnvironment(), null, owner, properties, values); + } + + public Boolean assignPropertiesSucceeded(final RuleEnvironment _environment_, final VerificationActivity owner, final List properties, final List values) { + return assignPropertiesSucceeded(_environment_, null, owner, properties, values); + } + + public Boolean assignPropertiesSucceeded(final RuleEnvironment _environment_, final RuleApplicationTrace _trace_, final VerificationActivity owner, final List properties, final List values) { + try { + assignPropertiesInternal(_environment_, _trace_, owner, properties, values); + return true; + } catch (Exception _e_assignProperties) { + return false; + } + } + + public Result checkVerificationMethodParams(final FormalParameter formal) { + return checkVerificationMethodParams(null, formal); + } + + public Result checkVerificationMethodParams(final RuleApplicationTrace _trace_, final FormalParameter formal) { + try { + return checkVerificationMethodParamsInternal(_trace_, formal); + } catch (Exception _e_CheckVerificationMethodParams) { + return resultForFailure(_e_CheckVerificationMethodParams); + } + } + + protected Result checkVerificationMethodParamsInternal(final RuleApplicationTrace _trace_, final FormalParameter formal) throws RuleFailedException { + /* empty |-formal : var PropertyType type */ + PropertyType type = null; + Result result = typeInternal(emptyEnvironment(), _trace_, formal); + checkAssignableTo(result.getFirst(), PropertyType.class); + type = (PropertyType) result.getFirst(); + + return new Result(true); + } + + public Result checkActivityArguments(final VerificationActivity activity) { + return checkActivityArguments(null, activity); + } + + public Result checkActivityArguments(final RuleApplicationTrace _trace_, final VerificationActivity activity) { + try { + return checkActivityArgumentsInternal(_trace_, activity); + } catch (Exception _e_CheckActivityArguments) { + return resultForFailure(_e_CheckActivityArguments); + } + } + + protected Result checkActivityArgumentsInternal(final RuleApplicationTrace _trace_, final VerificationActivity activity) throws RuleFailedException { + final VerificationMethod method = activity.getMethod(); + /* empty |- activity ~> method.formals << activity.actuals */ + EList _formals = method.getFormals(); + EList _actuals = activity.getActuals(); + assignArgumentsInternal(emptyEnvironment(), _trace_, activity, _formals, _actuals); + return new Result(true); + } + + public Result checkActivityReturns(final VerificationActivity activity) { + return checkActivityReturns(null, activity); + } + + public Result checkActivityReturns(final RuleApplicationTrace _trace_, final VerificationActivity activity) { + try { + return checkActivityReturnsInternal(_trace_, activity); + } catch (Exception _e_CheckActivityReturns) { + return resultForFailure(_e_CheckActivityReturns); + } + } + + protected Result checkActivityReturnsInternal(final RuleApplicationTrace _trace_, final VerificationActivity activity) throws RuleFailedException { + final VerificationMethod method = activity.getMethod(); + /* empty |- activity ~> method.results >> activity.computes */ + EList _results = method.getResults(); + EList _computes = activity.getComputes(); + assignReturnsInternal(emptyEnvironment(), _trace_, activity, _results, _computes); + return new Result(true); + } + + public Result checkPropertyTypes(final VerificationActivity activity) { + return checkPropertyTypes(null, activity); + } + + public Result checkPropertyTypes(final RuleApplicationTrace _trace_, final VerificationActivity activity) { + try { + return checkPropertyTypesInternal(_trace_, activity); + } catch (Exception _e_CheckPropertyTypes) { + return resultForFailure(_e_CheckPropertyTypes); + } + } + + protected Result checkPropertyTypesInternal(final RuleApplicationTrace _trace_, final VerificationActivity activity) throws RuleFailedException { + final VerificationMethod method = activity.getMethod(); + /* empty ||- activity ~> method.properties << activity.propertyValues */ + EList _properties = method.getProperties(); + EList _propertyValues = activity.getPropertyValues(); + assignPropertiesInternal(emptyEnvironment(), _trace_, activity, _properties, _propertyValues); + return new Result(true); + } + + protected Result assignArgumentInternal(final RuleEnvironment _environment_, final RuleApplicationTrace _trace_, final FormalParameter formal, final PropertyExpression actual) { + try { + checkParamsNotNull(formal, actual); + return assignArgumentDispatcher.invoke(_environment_, _trace_, formal, actual); + } catch (Exception _e_assignArgument) { + sneakyThrowRuleFailedException(_e_assignArgument); + return null; + } + } + + protected void assignArgumentThrowException(final String _error, final String _issue, final Exception _ex, final FormalParameter formal, final PropertyExpression actual, final ErrorInformation[] _errorInformations) throws RuleFailedException { + throwRuleFailedException(_error, _issue, _ex, _errorInformations); + } + + protected Result assignReturnInternal(final RuleEnvironment _environment_, final RuleApplicationTrace _trace_, final FormalParameter ret, final ComputeRef compute) { + try { + checkParamsNotNull(ret, compute); + return assignReturnDispatcher.invoke(_environment_, _trace_, ret, compute); + } catch (Exception _e_assignReturn) { + sneakyThrowRuleFailedException(_e_assignReturn); + return null; + } + } + + protected void assignReturnThrowException(final String _error, final String _issue, final Exception _ex, final FormalParameter ret, final ComputeRef compute, final ErrorInformation[] _errorInformations) throws RuleFailedException { + throwRuleFailedException(_error, _issue, _ex, _errorInformations); + } + + protected Result assignArgumentsInternal(final RuleEnvironment _environment_, final RuleApplicationTrace _trace_, final VerificationActivity owner, final List formals, final List actuals) { + try { + checkParamsNotNull(owner, formals, actuals); + return assignArgumentsDispatcher.invoke(_environment_, _trace_, owner, formals, actuals); + } catch (Exception _e_assignArguments) { + sneakyThrowRuleFailedException(_e_assignArguments); + return null; + } + } + + protected void assignArgumentsThrowException(final String _error, final String _issue, final Exception _ex, final VerificationActivity owner, final List formals, final List actuals, final ErrorInformation[] _errorInformations) throws RuleFailedException { + throwRuleFailedException(_error, _issue, _ex, _errorInformations); + } + + protected Result assignReturnsInternal(final RuleEnvironment _environment_, final RuleApplicationTrace _trace_, final VerificationActivity owner, final List returns, final List computes) { + try { + checkParamsNotNull(owner, returns, computes); + return assignReturnsDispatcher.invoke(_environment_, _trace_, owner, returns, computes); + } catch (Exception _e_assignReturns) { + sneakyThrowRuleFailedException(_e_assignReturns); + return null; + } + } + + protected void assignReturnsThrowException(final String _error, final String _issue, final Exception _ex, final VerificationActivity owner, final List returns, final List computes, final ErrorInformation[] _errorInformations) throws RuleFailedException { + throwRuleFailedException(_error, _issue, _ex, _errorInformations); + } + + protected Result assignPropertiesInternal(final RuleEnvironment _environment_, final RuleApplicationTrace _trace_, final VerificationActivity owner, final List properties, final List values) { + try { + checkParamsNotNull(owner, properties, values); + return assignPropertiesDispatcher.invoke(_environment_, _trace_, owner, properties, values); + } catch (Exception _e_assignProperties) { + sneakyThrowRuleFailedException(_e_assignProperties); + return null; + } + } + + protected void assignPropertiesThrowException(final String _error, final String _issue, final Exception _ex, final VerificationActivity owner, final List properties, final List values, final ErrorInformation[] _errorInformations) throws RuleFailedException { + throwRuleFailedException(_error, _issue, _ex, _errorInformations); + } + + protected Result typeImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final FormalParameter param) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleTypeFormalParameter(G, _subtrace_, param); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("TypeFormalParameter") + stringRepForEnv(G) + " |- " + stringRep(param) + " : " + stringRep(_result_.getFirst()); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleTypeFormalParameter) { + typeThrowException(ruleName("TypeFormalParameter") + stringRepForEnv(G) + " |- " + stringRep(param) + " : " + "PropertyType", + TYPEFORMALPARAMETER, + e_applyRuleTypeFormalParameter, param, new ErrorInformation[] {new ErrorInformation(param)}); + return null; + } + } + + protected Result applyRuleTypeFormalParameter(final RuleEnvironment G, final RuleApplicationTrace _trace_, final FormalParameter param) throws RuleFailedException { + PropertyType expType = null; // output parameter + final PropertyType declared = param.getType(); + /* declared !== null */ + if (!(declared != null)) { + sneakyThrowRuleFailedException("declared !== null"); + } + /* G |- declared : expType */ + Result result = typeInternal(G, _trace_, declared); + checkAssignableTo(result.getFirst(), PropertyType.class); + expType = (PropertyType) result.getFirst(); + + UnitLiteral _unit = param.getUnit(); + boolean _tripleNotEquals = (_unit != null); + if (_tripleNotEquals) { + EObject _eContainer = param.getUnit().eContainer(); + final UnitsType targetType = ((UnitsType) _eContainer); + /* expType instanceof NumberType or fail error 'typing: can only convert unit of a numeric type' source param */ + { + RuleFailedException previousFailure = null; + try { + } catch (Exception e) { + previousFailure = extractRuleFailedException(e); + /* fail error 'typing: can only convert unit of a numeric type' source param */ + String error = "typing: can only convert unit of a numeric type"; + EObject source = param; + throwForExplicitFail(error, new ErrorInformation(source, null)); + } + } + final NumberType numType = ((NumberType) expType); + /* numType.unitsType !== null or fail error 'typing: parameter type has no unit' source param */ + { + RuleFailedException previousFailure = null; + try { + UnitsType _unitsType = numType.getUnitsType(); + boolean _tripleNotEquals_1 = (_unitsType != null); + /* numType.unitsType !== null */ + if (!_tripleNotEquals_1) { + sneakyThrowRuleFailedException("numType.unitsType !== null"); + } + } catch (Exception e_1) { + previousFailure = extractRuleFailedException(e_1); + /* fail error 'typing: parameter type has no unit' source param */ + String error_1 = "typing: parameter type has no unit"; + EObject source_1 = param; + throwForExplicitFail(error_1, new ErrorInformation(source_1, null)); + } + } + /* G |- numType.unitsType ~~ targetType or fail error 'typing: cannot convert ' + stringRep(numType) + ' to ' + stringRep(targetType) source param */ + { + RuleFailedException previousFailure = null; + try { + /* G |- numType.unitsType ~~ targetType */ + UnitsType _unitsType_1 = numType.getUnitsType(); + sameTypeInternal(G, _trace_, _unitsType_1, targetType); + } catch (Exception e_2) { + previousFailure = extractRuleFailedException(e_2); + /* fail error 'typing: cannot convert ' + stringRep(numType) + ' to ' + stringRep(targetType) source param */ + String _stringRep = this.stringRep(numType); + String _plus = ("typing: cannot convert " + _stringRep); + String _plus_1 = (_plus + " to "); + String _stringRep_1 = this.stringRep(targetType); + String _plus_2 = (_plus_1 + _stringRep_1); + String error_2 = _plus_2; + EObject source_2 = param; + throwForExplicitFail(error_2, new ErrorInformation(source_2, null)); + } + } + } + return new Result(expType); + } + + protected Result assignArgumentsImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final VerificationActivity owner, final List formals, final EList actuals) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleArgumentSequence(G, _subtrace_, owner, formals, actuals); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("ArgumentSequence") + stringRepForEnv(G) + " |- " + stringRep(owner) + " ~> " + stringRep(formals) + " << " + stringRep(actuals); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleArgumentSequence) { + assignArgumentsThrowException(ruleName("ArgumentSequence") + stringRepForEnv(G) + " |- " + stringRep(owner) + " ~> " + stringRep(formals) + " << " + stringRep(actuals), + ARGUMENTSEQUENCE, + e_applyRuleArgumentSequence, owner, formals, actuals, new ErrorInformation[] {new ErrorInformation(owner)}); + return null; + } + } + + protected Result applyRuleArgumentSequence(final RuleEnvironment G, final RuleApplicationTrace _trace_, final VerificationActivity owner, final List formals, final EList actuals) throws RuleFailedException { + /* actuals.size == formals.size or fail error 'expected ' + formals.size + ' arguments, but got ' + actuals.size source owner */ + { + RuleFailedException previousFailure = null; + try { + int _size = actuals.size(); + int _size_1 = formals.size(); + boolean _equals = (_size == _size_1); + /* actuals.size == formals.size */ + if (!_equals) { + sneakyThrowRuleFailedException("actuals.size == formals.size"); + } + } catch (Exception e) { + previousFailure = extractRuleFailedException(e); + /* fail error 'expected ' + formals.size + ' arguments, but got ' + actuals.size source owner */ + int _size_2 = formals.size(); + String _plus = ("expected " + Integer.valueOf(_size_2)); + String _plus_1 = (_plus + " arguments, but got "); + int _size_3 = actuals.size(); + String _plus_2 = (_plus_1 + Integer.valueOf(_size_3)); + String error = _plus_2; + EObject source = owner; + throwForExplicitFail(error, new ErrorInformation(source, null)); + } + } + final Iterator aIter = actuals.iterator(); + final Iterator fIter = formals.iterator(); + while ((aIter.hasNext() && fIter.hasNext())) { + final PropertyExpression actual = aIter.next(); + final FormalParameter formal = fIter.next(); + /* G |- formal <- actual */ + assignArgumentInternal(G, _trace_, formal, actual); + } + return new Result(true); + } + + protected Result assignArgumentImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final FormalParameter formal, final PropertyExpression actual) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleArgument(G, _subtrace_, formal, actual); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("Argument") + stringRepForEnv(G) + " |- " + stringRep(formal) + " <- " + stringRep(actual); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleArgument) { + assignArgumentThrowException(ruleName("Argument") + stringRepForEnv(G) + " |- " + stringRep(formal) + " <- " + stringRep(actual), + ARGUMENT, + e_applyRuleArgument, formal, actual, new ErrorInformation[] {new ErrorInformation(formal), new ErrorInformation(actual)}); + return null; + } + } + + protected Result applyRuleArgument(final RuleEnvironment G, final RuleApplicationTrace _trace_, final FormalParameter formal, final PropertyExpression actual) throws RuleFailedException { + /* G |- actual : var PropertyType actualType */ + PropertyType actualType = null; + Result result = typeInternal(G, _trace_, actual); + checkAssignableTo(result.getFirst(), PropertyType.class); + actualType = (PropertyType) result.getFirst(); + + PropertyType formalType = null; + /* G |- formal : formalType or { } */ + { + RuleFailedException previousFailure = null; + try { + /* G |- formal : formalType */ + Result result_1 = typeInternal(G, _trace_, formal); + checkAssignableTo(result_1.getFirst(), PropertyType.class); + formalType = (PropertyType) result_1.getFirst(); + + } catch (Exception e) { + previousFailure = extractRuleFailedException(e); + } + } + if ((formalType != null)) { + /* G |- formalType <: actualType or fail error 'typing: ' + stringRep(actualType) + 'cannot be assigned to ' + stringRep(formalType) source actual */ + { + RuleFailedException previousFailure = null; + try { + /* G |- formalType <: actualType */ + compatibleInternal(G, _trace_, formalType, actualType); + } catch (Exception e_1) { + previousFailure = extractRuleFailedException(e_1); + /* fail error 'typing: ' + stringRep(actualType) + 'cannot be assigned to ' + stringRep(formalType) source actual */ + String _stringRep = this.stringRep(actualType); + String _plus = ("typing: " + _stringRep); + String _plus_1 = (_plus + "cannot be assigned to "); + String _stringRep_1 = this.stringRep(formalType); + String _plus_2 = (_plus_1 + _stringRep_1); + String error = _plus_2; + EObject source = actual; + throwForExplicitFail(error, new ErrorInformation(source, null)); + } + } + } + return new Result(true); + } + + protected Result assignReturnsImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final VerificationActivity owner, final List returns, final List computeRefs) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleReturnSequence(G, _subtrace_, owner, returns, computeRefs); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("ReturnSequence") + stringRepForEnv(G) + " |- " + stringRep(owner) + " ~> " + stringRep(returns) + " >> " + stringRep(computeRefs); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleReturnSequence) { + assignReturnsThrowException(ruleName("ReturnSequence") + stringRepForEnv(G) + " |- " + stringRep(owner) + " ~> " + stringRep(returns) + " >> " + stringRep(computeRefs), + RETURNSEQUENCE, + e_applyRuleReturnSequence, owner, returns, computeRefs, new ErrorInformation[] {new ErrorInformation(owner)}); + return null; + } + } + + protected Result applyRuleReturnSequence(final RuleEnvironment G, final RuleApplicationTrace _trace_, final VerificationActivity owner, final List returns, final List computeRefs) throws RuleFailedException { + /* computeRefs.size == returns.size or fail error 'expected ' + returns.size + ' return values, but got ' + computeRefs.size feature VerifyPackage.eINSTANCE.verificationActivity_Computes source owner */ + { + RuleFailedException previousFailure = null; + try { + int _size = computeRefs.size(); + int _size_1 = returns.size(); + boolean _equals = (_size == _size_1); + /* computeRefs.size == returns.size */ + if (!_equals) { + sneakyThrowRuleFailedException("computeRefs.size == returns.size"); + } + } catch (Exception e) { + previousFailure = extractRuleFailedException(e); + /* fail error 'expected ' + returns.size + ' return values, but got ' + computeRefs.size feature VerifyPackage.eINSTANCE.verificationActivity_Computes source owner */ + int _size_2 = returns.size(); + String _plus = ("expected " + Integer.valueOf(_size_2)); + String _plus_1 = (_plus + " return values, but got "); + int _size_3 = computeRefs.size(); + String _plus_2 = (_plus_1 + Integer.valueOf(_size_3)); + String error = _plus_2; + EObject source = owner; + EReference _verificationActivity_Computes = VerifyPackage.eINSTANCE.getVerificationActivity_Computes(); + EStructuralFeature feature = _verificationActivity_Computes; + throwForExplicitFail(error, new ErrorInformation(source, feature)); + } + } + final Iterator cIter = computeRefs.iterator(); + final Iterator rIter = returns.iterator(); + while ((cIter.hasNext() && rIter.hasNext())) { + final ComputeRef computeRef = cIter.next(); + final FormalParameter ret = rIter.next(); + /* G |- ret --> computeRef */ + assignReturnInternal(G, _trace_, ret, computeRef); + } + return new Result(true); + } + + protected Result assignReturnImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final FormalParameter ret, final ComputeRef computeRef) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRuleReturn(G, _subtrace_, ret, computeRef); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("Return") + stringRepForEnv(G) + " |- " + stringRep(ret) + " --> " + stringRep(computeRef); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRuleReturn) { + assignReturnThrowException(ruleName("Return") + stringRepForEnv(G) + " |- " + stringRep(ret) + " --> " + stringRep(computeRef), + RETURN, + e_applyRuleReturn, ret, computeRef, new ErrorInformation[] {new ErrorInformation(ret), new ErrorInformation(computeRef)}); + return null; + } + } + + protected Result applyRuleReturn(final RuleEnvironment G, final RuleApplicationTrace _trace_, final FormalParameter ret, final ComputeRef computeRef) throws RuleFailedException { + ComputeDeclaration _compute = computeRef.getCompute(); + boolean _tripleNotEquals = (_compute != null); + if (_tripleNotEquals) { + /* G |- computeRef.compute : var PropertyType computeType */ + ComputeDeclaration _compute_1 = computeRef.getCompute(); + PropertyType computeType = null; + Result result = typeInternal(G, _trace_, _compute_1); + checkAssignableTo(result.getFirst(), PropertyType.class); + computeType = (PropertyType) result.getFirst(); + + PropertyType retType = null; + /* G |- ret : retType or { } */ + { + RuleFailedException previousFailure = null; + try { + /* G |- ret : retType */ + Result result_1 = typeInternal(G, _trace_, ret); + checkAssignableTo(result_1.getFirst(), PropertyType.class); + retType = (PropertyType) result_1.getFirst(); + + } catch (Exception e) { + previousFailure = extractRuleFailedException(e); + } + } + if ((retType != null)) { + /* G |- computeType <: retType or fail error 'typing: ' + stringRep(retType) + 'cannot be assigned to ' + stringRep(computeType) source computeRef */ + { + RuleFailedException previousFailure = null; + try { + /* G |- computeType <: retType */ + compatibleInternal(G, _trace_, computeType, retType); + } catch (Exception e_1) { + previousFailure = extractRuleFailedException(e_1); + /* fail error 'typing: ' + stringRep(retType) + 'cannot be assigned to ' + stringRep(computeType) source computeRef */ + String _stringRep = this.stringRep(retType); + String _plus = ("typing: " + _stringRep); + String _plus_1 = (_plus + "cannot be assigned to "); + String _stringRep_1 = this.stringRep(computeType); + String _plus_2 = (_plus_1 + _stringRep_1); + String error = _plus_2; + EObject source = computeRef; + throwForExplicitFail(error, new ErrorInformation(source, null)); + } + } + } + } + return new Result(true); + } + + protected Result assignPropertiesImpl(final RuleEnvironment G, final RuleApplicationTrace _trace_, final VerificationActivity owner, final List properties, final List values) throws RuleFailedException { + try { + final RuleApplicationTrace _subtrace_ = newTrace(_trace_); + final Result _result_ = applyRulePropertyValues(G, _subtrace_, owner, properties, values); + addToTrace(_trace_, new Provider() { + public Object get() { + return ruleName("PropertyValues") + stringRepForEnv(G) + " ||- " + stringRep(owner) + " ~> " + stringRep(properties) + " << " + stringRep(values); + } + }); + addAsSubtrace(_trace_, _subtrace_); + return _result_; + } catch (Exception e_applyRulePropertyValues) { + assignPropertiesThrowException(ruleName("PropertyValues") + stringRepForEnv(G) + " ||- " + stringRep(owner) + " ~> " + stringRep(properties) + " << " + stringRep(values), + PROPERTYVALUES, + e_applyRulePropertyValues, owner, properties, values, new ErrorInformation[] {new ErrorInformation(owner)}); + return null; + } + } + + protected Result applyRulePropertyValues(final RuleEnvironment G, final RuleApplicationTrace _trace_, final VerificationActivity owner, final List properties, final List values) throws RuleFailedException { + /* properties.size == values.size or fail error 'expected ' + properties.size + ' property values, but got ' + values.size feature VerifyPackage.eINSTANCE.verificationActivity_PropertyValues source owner */ + { + RuleFailedException previousFailure = null; + try { + int _size = properties.size(); + int _size_1 = values.size(); + boolean _equals = (_size == _size_1); + /* properties.size == values.size */ + if (!_equals) { + sneakyThrowRuleFailedException("properties.size == values.size"); + } + } catch (Exception e) { + previousFailure = extractRuleFailedException(e); + /* fail error 'expected ' + properties.size + ' property values, but got ' + values.size feature VerifyPackage.eINSTANCE.verificationActivity_PropertyValues source owner */ + int _size_2 = properties.size(); + String _plus = ("expected " + Integer.valueOf(_size_2)); + String _plus_1 = (_plus + " property values, but got "); + int _size_3 = values.size(); + String _plus_2 = (_plus_1 + Integer.valueOf(_size_3)); + String error = _plus_2; + EObject source = owner; + EReference _verificationActivity_PropertyValues = VerifyPackage.eINSTANCE.getVerificationActivity_PropertyValues(); + EStructuralFeature feature = _verificationActivity_PropertyValues; + throwForExplicitFail(error, new ErrorInformation(source, feature)); + } + } + final Iterator pIter = properties.iterator(); + final Iterator vIter = values.iterator(); + while ((pIter.hasNext() && vIter.hasNext())) { + final Property property = pIter.next(); + final PropertyExpression value = vIter.next(); + final PropertyType left = property.getPropertyType(); + /* G |- value : var PropertyType right */ + PropertyType right = null; + Result result = typeInternal(G, _trace_, value); + checkAssignableTo(result.getFirst(), PropertyType.class); + right = (PropertyType) result.getFirst(); + + /* G |- left <: right or fail error 'typing: ' + stringRep(right) + 'cannot be assigned to ' + stringRep(left) source value */ + { + RuleFailedException previousFailure = null; + try { + /* G |- left <: right */ + compatibleInternal(G, _trace_, left, right); + } catch (Exception e_1) { + previousFailure = extractRuleFailedException(e_1); + /* fail error 'typing: ' + stringRep(right) + 'cannot be assigned to ' + stringRep(left) source value */ + String _stringRep = this.stringRep(right); + String _plus_3 = ("typing: " + _stringRep); + String _plus_4 = (_plus_3 + "cannot be assigned to "); + String _stringRep_1 = this.stringRep(left); + String _plus_5 = (_plus_4 + _stringRep_1); + String error_1 = _plus_5; + EObject source_1 = value; + throwForExplicitFail(error_1, new ErrorInformation(source_1, null)); + } + } + } + return new Result(true); + } +} diff --git a/alisa/org.osate.verify/xsemantics-gen/org/osate/verify/typing/validation/.gitignore b/alisa/org.osate.verify/xsemantics-gen/org/osate/verify/typing/validation/.gitignore index f2d49515c82..cb4b8cb9567 100644 --- a/alisa/org.osate.verify/xsemantics-gen/org/osate/verify/typing/validation/.gitignore +++ b/alisa/org.osate.verify/xsemantics-gen/org/osate/verify/typing/validation/.gitignore @@ -1,2 +1 @@ /.VerifyTypeSystemValidator.java._trace -/VerifyTypeSystemValidator.java diff --git a/alisa/org.osate.verify/xsemantics-gen/org/osate/verify/typing/validation/VerifyTypeSystemValidator.java b/alisa/org.osate.verify/xsemantics-gen/org/osate/verify/typing/validation/VerifyTypeSystemValidator.java new file mode 100644 index 00000000000..702fa3fb0fc --- /dev/null +++ b/alisa/org.osate.verify/xsemantics-gen/org/osate/verify/typing/validation/VerifyTypeSystemValidator.java @@ -0,0 +1,47 @@ +package org.osate.verify.typing.validation; + +import com.google.inject.Inject; +import org.eclipse.xtext.validation.Check; +import org.osate.alisa.common.typing.validation.CommonTypeSystemValidator; +import org.osate.verify.typing.VerifyTypeSystem; +import org.osate.verify.verify.FormalParameter; +import org.osate.verify.verify.VerificationActivity; + +@SuppressWarnings("all") +public class VerifyTypeSystemValidator extends CommonTypeSystemValidator { + @Inject + protected VerifyTypeSystem xsemanticsSystem; + + @Override + protected VerifyTypeSystem getXsemanticsSystem() { + return this.xsemanticsSystem; + } + + @Check + public void checkVerificationMethodParams(final FormalParameter formal) { + errorGenerator.generateErrors(this, + getXsemanticsSystem().checkVerificationMethodParams(formal), + formal); + } + + @Check + public void checkActivityArguments(final VerificationActivity activity) { + errorGenerator.generateErrors(this, + getXsemanticsSystem().checkActivityArguments(activity), + activity); + } + + @Check + public void checkActivityReturns(final VerificationActivity activity) { + errorGenerator.generateErrors(this, + getXsemanticsSystem().checkActivityReturns(activity), + activity); + } + + @Check + public void checkPropertyTypes(final VerificationActivity activity) { + errorGenerator.generateErrors(this, + getXsemanticsSystem().checkPropertyTypes(activity), + activity); + } +} diff --git a/ba/org.osate.xtext.aadl2.ba/pom.xml b/ba/org.osate.xtext.aadl2.ba/pom.xml index 44a012deea5..8ff83f54900 100644 --- a/ba/org.osate.xtext.aadl2.ba/pom.xml +++ b/ba/org.osate.xtext.aadl2.ba/pom.xml @@ -15,12 +15,4 @@ 1.0.0-SNAPSHOT eclipse-plugin - - - - org.eclipse.xtext - xtext-maven-plugin - - - diff --git a/core/org.osate.ui/pom.xml b/core/org.osate.ui/pom.xml index a94910f4e9d..6c43a84b5b0 100644 --- a/core/org.osate.ui/pom.xml +++ b/core/org.osate.ui/pom.xml @@ -23,8 +23,8 @@ 2.5 diff --git a/ge/osate-ge.experimental.releng/pom.xml b/ge/osate-ge.experimental.releng/pom.xml index 51f7a253b81..5243e3906a1 100644 --- a/ge/osate-ge.experimental.releng/pom.xml +++ b/ge/osate-ge.experimental.releng/pom.xml @@ -38,10 +38,8 @@ censes only apply to the Third Party Software and not any other portion of this 2.3.2 2.12.0 2.9.0 - 1.12.1 2.12.0 2.9.0 - 1.12.1 http://osate-build.sei.cmu.edu/download/osate/stable/${osate.stable.version}/updates/ http://download.eclipse.org/releases/oxygen/201712201001/ @@ -157,12 +155,6 @@ censes only apply to the Third Party Software and not any other portion of this ** - - xsemantics-gen - - **/.gitignore - - @@ -176,7 +168,6 @@ censes only apply to the Third Party Software and not any other portion of this compile - process-sources ${basedir}/xtend-gen @@ -204,37 +195,6 @@ censes only apply to the Third Party Software and not any other portion of this - - org.eclipse.xtext - xtext-maven-plugin - ${xtext.version} - - - - generate - - - - - - - it.xsemantics.dsl.XsemanticsStandaloneSetup - - - ${basedir}/xsemantics-gen - - - - - - - - net.sf.xsemantics - it.xsemantics.dsl - ${xsemantics.version} - - - org.eclipse.tycho tycho-packaging-plugin diff --git a/releng/org.osate.build.main/pom.xml b/releng/org.osate.build.main/pom.xml index 0a9699025a2..bc4cf2ec175 100644 --- a/releng/org.osate.build.main/pom.xml +++ b/releng/org.osate.build.main/pom.xml @@ -11,7 +11,6 @@ 4.0.13 2025-12 2.39.0 - 1.24.0 17.0.2 UTF-8 2.20.0-SNAPSHOT @@ -422,12 +421,6 @@ .gitignore - - xsemantics-gen - - **/.gitignore - - @@ -553,50 +546,6 @@ - - org.eclipse.xtext - xtext-maven-plugin - ${xtext.version} - - - - generate - - generate-sources - - - - true - 21 - 21 - - ${basedir}/src - - - - org.eclipse.xsemantics.dsl.XsemanticsStandaloneSetup - - - ${basedir}/xsemantics-gen - - - - - - - - - org.eclipse.xtext - org.eclipse.xtext.xbase.lib - ${xtext.version} - - - org.eclipse.xsemantics - org.eclipse.xsemantics.dsl - ${xsemantics.version} - - - com.ruleoftech markdown-page-generator-plugin