diff --git a/README.adoc b/README.adoc index 953f88b6d..6ae762c28 100644 --- a/README.adoc +++ b/README.adoc @@ -20,7 +20,7 @@ The project provides a configuration file for the https://wiki.eclipse.org/Eclip image:installer-advanced.png[switch to advanced mode] 4. In the Products window, select "Eclipse Modeling Tools" with: - * Product Version: 2025-03 + * Product Version: 2025-12 * Java VM: Java 21 5. On the next page (Projects window), to the right of the text box, click the "+" to the add the Sysml2 project as user project. In the dialog, choose Catalog: Github Projects and browse the file system to select the setup file from the local git repository. @@ -44,13 +44,13 @@ image:oomph-projects.png[oomph projects] ==== Manual installation -1. Install Eclipse 2025-03 (4.35). +1. Install Eclipse 2025-12 (4.38). * Install the “Eclipse Modeling Tools” package. - ** `https://www.eclipse.org/downloads/packages/release/2025-03/r/eclipse-modeling-tools` + ** `https://www.eclipse.org/downloads/packages/release/2025-12/r/eclipse-modeling-tools` * Install additional release packages in Eclipse. ** Select Help > Install New Software. - ** Enter the update site URL `http://download.eclipse.org/releases/2025-03`. + ** Enter the update site URL `http://download.eclipse.org/releases/2025-12`. ** Install “Xtext Complete SDK” (under General Purpose Tools) and "QVT Operational SDK" (under Modeling). * (Optional) For PlantUML visualization, install PlantUML-Eclipse with SysMLv2 extensions. @@ -139,7 +139,7 @@ Set up a Java code template as follows: ---- /** * SysML 2 Pilot Implementation - * Copyright (C) 2025 + * Copyright (C) 2026 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -162,7 +162,7 @@ Set up a Java code template as follows: === For existing code * When modifying existing code created by someone in a different organization, add a new copyright line, without changing anything else in the header. -* When modifying existing code for the first time in a new year, add the year as the latest year in the appropriate copy right line. (E.g., in 2025, "Copyright (C) 2024" becomes "Copyright (C) 2024-2025" and in 2026 it becomes "Copyright (C) 2024-2026".) +* When modifying existing code for the first time in a new year, add the year as the latest year in the appropriate copy right line. (E.g., in 2026, "Copyright (C) 2024" becomes "Copyright (C) 2024-2026" and in 2027 it becomes "Copyright (C) 2024-2027".) === Sources * https://www.gnu.org/licenses/gpl-3.0.en.html[GNU GPL v3.0 - How to Apply These Terms to Your New Programs] diff --git a/org.omg.kerml.expressions.xtext.ide/META-INF/MANIFEST.MF b/org.omg.kerml.expressions.xtext.ide/META-INF/MANIFEST.MF index 466257544..8bea3f863 100644 --- a/org.omg.kerml.expressions.xtext.ide/META-INF/MANIFEST.MF +++ b/org.omg.kerml.expressions.xtext.ide/META-INF/MANIFEST.MF @@ -4,7 +4,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: org.omg.kerml.xtext.ide Bundle-RequiredExecutionEnvironment: JavaSE-21 Bundle-Vendor: SysML v2 Submission Team -Bundle-Version: 0.56.0.qualifier +Bundle-Version: 0.57.0.qualifier Bundle-SymbolicName: org.omg.kerml.expressions.xtext.ide; singleton:=true Bundle-ActivationPolicy: lazy Require-Bundle: org.omg.kerml.expressions.xtext, diff --git a/org.omg.kerml.expressions.xtext.ui/META-INF/MANIFEST.MF b/org.omg.kerml.expressions.xtext.ui/META-INF/MANIFEST.MF index 8c493babd..b02196385 100644 --- a/org.omg.kerml.expressions.xtext.ui/META-INF/MANIFEST.MF +++ b/org.omg.kerml.expressions.xtext.ui/META-INF/MANIFEST.MF @@ -4,7 +4,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: org.omg.kerml.xtext.ui Bundle-RequiredExecutionEnvironment: JavaSE-21 Bundle-Vendor: SysML v2 Submission Team -Bundle-Version: 0.56.0.qualifier +Bundle-Version: 0.57.0.qualifier Bundle-SymbolicName: org.omg.kerml.expressions.xtext.ui; singleton:=true Bundle-ActivationPolicy: lazy Require-Bundle: org.omg.kerml.expressions.xtext, diff --git a/org.omg.kerml.expressions.xtext/META-INF/MANIFEST.MF b/org.omg.kerml.expressions.xtext/META-INF/MANIFEST.MF index 7d69ada7b..707d45f73 100644 --- a/org.omg.kerml.expressions.xtext/META-INF/MANIFEST.MF +++ b/org.omg.kerml.expressions.xtext/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Automatic-Module-Name: org.omg.kerml.expressions.xtext Bundle-ManifestVersion: 2 Bundle-Name: org.omg.kerml.xtext Bundle-RequiredExecutionEnvironment: JavaSE-21 -Bundle-Version: 0.56.0.qualifier +Bundle-Version: 0.57.0.qualifier Bundle-SymbolicName: org.omg.kerml.expressions.xtext; singleton:=true Bundle-ActivationPolicy: lazy Require-Bundle: org.eclipse.xtext, diff --git a/org.omg.kerml.owl.ide/META-INF/MANIFEST.MF b/org.omg.kerml.owl.ide/META-INF/MANIFEST.MF index 8b77aa2f1..33c4935de 100644 --- a/org.omg.kerml.owl.ide/META-INF/MANIFEST.MF +++ b/org.omg.kerml.owl.ide/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: org.omg.kerml.owl.ide Bundle-RequiredExecutionEnvironment: JavaSE-21 Bundle-Vendor: My Company -Bundle-Version: 0.56.0.qualifier +Bundle-Version: 0.57.0.qualifier Bundle-SymbolicName: org.omg.kerml.owl.ide;singleton:=true Bundle-ActivationPolicy: lazy Require-Bundle: org.omg.kerml.owl, diff --git a/org.omg.kerml.owl.ui/META-INF/MANIFEST.MF b/org.omg.kerml.owl.ui/META-INF/MANIFEST.MF index 2fa06623d..1b190e6ee 100644 --- a/org.omg.kerml.owl.ui/META-INF/MANIFEST.MF +++ b/org.omg.kerml.owl.ui/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: org.omg.kerml.owl.ui Bundle-RequiredExecutionEnvironment: JavaSE-21 Bundle-Vendor: My Company -Bundle-Version: 0.56.0.qualifier +Bundle-Version: 0.57.0.qualifier Bundle-SymbolicName: org.omg.kerml.owl.ui;singleton:=true Bundle-ActivationPolicy: lazy Require-Bundle: org.omg.kerml.owl, diff --git a/org.omg.kerml.owl/META-INF/MANIFEST.MF b/org.omg.kerml.owl/META-INF/MANIFEST.MF index 21e262d25..935a727e4 100644 --- a/org.omg.kerml.owl/META-INF/MANIFEST.MF +++ b/org.omg.kerml.owl/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: org.omg.sysml.owl Bundle-RequiredExecutionEnvironment: JavaSE-21 Bundle-Vendor: My Company -Bundle-Version: 0.56.0.qualifier +Bundle-Version: 0.57.0.qualifier Bundle-SymbolicName: org.omg.kerml.owl;singleton:=true Bundle-ActivationPolicy: lazy Require-Bundle: org.eclipse.xtext, diff --git a/org.omg.kerml.xpect.tests/META-INF/MANIFEST.MF b/org.omg.kerml.xpect.tests/META-INF/MANIFEST.MF index 423992813..f9be466d0 100644 --- a/org.omg.kerml.xpect.tests/META-INF/MANIFEST.MF +++ b/org.omg.kerml.xpect.tests/META-INF/MANIFEST.MF @@ -4,7 +4,7 @@ Bundle-Name: org.omg.kerml.xpect.tests Bundle-RequiredExecutionEnvironment: JavaSE-21 Bundle-SymbolicName: org.omg.kerml.xpect.tests;singleton:=true Bundle-Vendor: SysML v2 Submission Team -Bundle-Version: 0.56.0.qualifier +Bundle-Version: 0.57.0.qualifier Require-Bundle: org.eclipse.core.runtime, org.eclipse.xpect.xtext.lib;bundle-version="[0.3.0,0.4.0)", org.eclipse.xpect.xtext.xbase.lib;bundle-version="[0.3.0,0.4.0)", diff --git a/org.omg.kerml.xpect.tests/src/org/omg/kerml/xpect/tests/validation/Feature_nonunique_invalid.kerml.xt b/org.omg.kerml.xpect.tests/src/org/omg/kerml/xpect/tests/validation/Feature_nonunique_invalid.kerml.xt new file mode 100644 index 000000000..253784cd5 --- /dev/null +++ b/org.omg.kerml.xpect.tests/src/org/omg/kerml/xpect/tests/validation/Feature_nonunique_invalid.kerml.xt @@ -0,0 +1,29 @@ +//* +XPECT_SETUP org.omg.kerml.xpect.tests.validation.KerMLValidationTest + ResourceSet { + ThisFile {} + File {from ="/library/Base.kerml"} + } + Workspace { + JavaProject { + SrcFolder { + ThisFile {} + File {from ="/library/Base.kerml"} + } + } + } +END_SETUP +*/ +package Feature_nonunique_invalid { + classifier A { + feature x; // "unique" by default + } + classifier B specializes A { + // XPECT errors --> "Subsetting/redefining feature cannot be nonunique if subsetted/redefined feature is unique" at "x" + feature x1 nonunique subsets x; + } + classifier C specializes A { + // XPECT errors --> "Subsetting/redefining feature cannot be nonunique if subsetted/redefined feature is unique" at "x" + feature x2 nonunique redefines x; + } +} \ No newline at end of file diff --git a/org.omg.kerml.xtext.ide/META-INF/MANIFEST.MF b/org.omg.kerml.xtext.ide/META-INF/MANIFEST.MF index 6a249a3e4..48294428a 100644 --- a/org.omg.kerml.xtext.ide/META-INF/MANIFEST.MF +++ b/org.omg.kerml.xtext.ide/META-INF/MANIFEST.MF @@ -4,7 +4,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: org.omg.kerml.xtext.ide Bundle-RequiredExecutionEnvironment: JavaSE-21 Bundle-Vendor: SysML v2 Submission Team -Bundle-Version: 0.56.0.qualifier +Bundle-Version: 0.57.0.qualifier Bundle-SymbolicName: org.omg.kerml.xtext.ide; singleton:=true Bundle-ActivationPolicy: lazy Require-Bundle: org.omg.kerml.xtext, diff --git a/org.omg.kerml.xtext.ui/META-INF/MANIFEST.MF b/org.omg.kerml.xtext.ui/META-INF/MANIFEST.MF index e52d71aa9..1b5e2740d 100644 --- a/org.omg.kerml.xtext.ui/META-INF/MANIFEST.MF +++ b/org.omg.kerml.xtext.ui/META-INF/MANIFEST.MF @@ -4,7 +4,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: org.omg.kerml.xtext.ui Bundle-RequiredExecutionEnvironment: JavaSE-21 Bundle-Vendor: SysML v2 Submission Team -Bundle-Version: 0.56.0.qualifier +Bundle-Version: 0.57.0.qualifier Bundle-SymbolicName: org.omg.kerml.xtext.ui; singleton:=true Bundle-ActivationPolicy: lazy Require-Bundle: org.omg.kerml.xtext, diff --git a/org.omg.kerml.xtext/META-INF/MANIFEST.MF b/org.omg.kerml.xtext/META-INF/MANIFEST.MF index 79e80901c..f3a7db63a 100644 --- a/org.omg.kerml.xtext/META-INF/MANIFEST.MF +++ b/org.omg.kerml.xtext/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Automatic-Module-Name: org.omg.kerml.xtext Bundle-ManifestVersion: 2 Bundle-Name: org.omg.kerml.xtext Bundle-RequiredExecutionEnvironment: JavaSE-21 -Bundle-Version: 0.56.0.qualifier +Bundle-Version: 0.57.0.qualifier Bundle-SymbolicName: org.omg.kerml.xtext; singleton:=true Bundle-ActivationPolicy: lazy Require-Bundle: org.eclipse.xtext, diff --git a/org.omg.kerml.xtext/src/org/omg/kerml/xtext/scoping/KerMLLinker.java b/org.omg.kerml.xtext/src/org/omg/kerml/xtext/scoping/KerMLLinker.java index a54a99cca..585ed9028 100644 --- a/org.omg.kerml.xtext/src/org/omg/kerml/xtext/scoping/KerMLLinker.java +++ b/org.omg.kerml.xtext/src/org/omg/kerml/xtext/scoping/KerMLLinker.java @@ -1,6 +1,6 @@ /***************************************************************************** * SysML 2 Pilot Implementation - * Copyright (c) 2020-2021, 2024 Model Driven Solutions, Inc. + * Copyright (c) 2020-2021, 2024, 2026 Model Driven Solutions, Inc. * Copyright (c) 2024 Budapest University of Technology and Economics * * This program is free software: you can redistribute it and/or modify @@ -47,14 +47,6 @@ public class KerMLLinker extends LazyLinker { @Inject private OnChangeEvictingCache cache; - @Override - protected void clearReferences(EObject obj) { - super.clearReferences(obj); - if (obj instanceof Element) { - ElementUtil.clean((Element)obj); - } - } - @Override protected void clearReference(EObject obj, EReference ref) { if ( @@ -72,10 +64,10 @@ protected void clearReference(EObject obj, EReference ref) { @Override protected void doLinkModel(EObject model, IDiagnosticConsumer consumer) { super.doLinkModel(model, consumer); - postProcessAllCrossReferences(model); + postProcessAll(model); } - protected void postProcessAllCrossReferences(EObject model) { + protected void postProcessAll(EObject model) { cache.execWithoutCacheClear(model.eResource(), new IUnitOfWork.Void() { @Override public void process(Resource state) throws Exception { diff --git a/org.omg.kerml.xtext/src/org/omg/kerml/xtext/validation/KerMLValidator.xtend b/org.omg.kerml.xtext/src/org/omg/kerml/xtext/validation/KerMLValidator.xtend index 0983b6864..085e791a5 100644 --- a/org.omg.kerml.xtext/src/org/omg/kerml/xtext/validation/KerMLValidator.xtend +++ b/org.omg.kerml.xtext/src/org/omg/kerml/xtext/validation/KerMLValidator.xtend @@ -1,7 +1,7 @@ /***************************************************************************** * SysML 2 Pilot Implementation * Copyright (c) 2018 IncQuery Labs Ltd. - * Copyright (c) 2018-2025 Model Driven Solutions, Inc. + * Copyright (c) 2018-2026 Model Driven Solutions, Inc. * Copyright (c) 2020 California Institute of Technology/Jet Propulsion Laboratory * * This program is free software: you can redistribute it and/or modify @@ -103,6 +103,10 @@ import java.util.Collections import java.util.HashMap import java.util.Set import java.util.Map +import org.omg.sysml.lang.sysml.EndFeatureMembership +import org.omg.sysml.lang.sysml.CollectExpression +import org.omg.sysml.lang.sysml.SelectExpression +import org.omg.sysml.lang.sysml.IndexExpression /** * This class contains custom validation rules. @@ -160,6 +164,9 @@ class KerMLValidator extends AbstractKerMLValidator { public static val INVALID_CLASSIFIER_MULTIPLICITY_DOMAIN = "validateClassifierMultiplicityDomain" public static val INVALID_CLASSIFIER_MULTIPLICITY_DOMAIN_MSG = "Multiplicity must not have a featuring type" + + public static val INVALID_END_FEATURE_MEMBERSHIP_IS_END = "validateEndFeatureMembershpIsEnd" + public static val INVALID_END_FEATURE_MEMBERSHIP_IS_END_MSG = "Must be an end feature" // Note: validateFeatureHasType is not in the spec, but it is implied by semantic constraints on features. public static val INVALID_FEATURE_HAS_TYPE = 'validateFeatureHasType_' @@ -264,6 +271,8 @@ class KerMLValidator extends AbstractKerMLValidator { public static val INVALID_BEHAVIOR_SPECIALIZATION = "validateBehaviorSpecialization" public static val INVALID_BEHAVIOR_SPECIALIZATION_MSG = "Cannot specialize structure" + public static val INVALID_PARAMETER_MEMBERSHIP_DIRECTION = "validateParameterMembershipDirection" + public static val INVALID_PARAMETER_MEMBERSHIP_DIRECTION_MSG = "Must have direction '{direction}'" public static val INVALID_PARAMETER_MEMBERSHIP_OWNING_TYPE = "validateParameterMembershipOwningType" public static val INVALID_PARAMETER_MEMBERSHIP_OWNING_TYPE_MSG = "Parameter membership not allowed" @@ -319,9 +328,23 @@ class KerMLValidator extends AbstractKerMLValidator { public static val INVALID_OPERATOR_EXPRESSION_BRACKET_OPERATOR = "validateOperatorExpressionBracketOperator_" public static val INVALID_OPERATOR_EXPRESSION_BRACKET_OPERATOR_MSG = "Use #(...) for indexing" + public static val INVALID_COLLECT_EXPRESSION_OPERATOR = "validateCollectExpressionOperator" + public static val INVALID_COLLECT_EXPRESSION_OPERATOR_MSG = "Operator must be 'collect'" + + public static val INVALID_FEATURE_CHAIN_EXPRESSION_OPERATOR = "validateFeatureChainExpressionOperator" + public static val INVALID_FEATURE_CHAIN_EXPRESSION_OPERATOR_MSG = "Operator must be '.'" + + public static val INVALID_INDEX_EXPRESSION_OPERATOR = "validateIndexExpressionOperator" + public static val INVALID_INDEX_EXPRESSION_OPERATOR_MSG = "Operator must be '#'" + + public static val INVALID_SELECT_EXPRESSION_OPERATOR = "validateSelectExpressionOperator" + public static val INVALID_SELECT_EXPRESSION_OPERATOR_MSG = "Operator must be 'select'" + public static val INVALID_FLOW_ITEM_FEATURE = "validateFlowItemFeature" public static val INVALID_FLOW_ITEM_FEATURE_MSG = "Only one item feature is allowed" + public static val INVALID_FLOW_END_IS_END = "validateFlowEndIsEnd" + public static val INVALID_FLOW_END_IS_END_MSG = "Must be an end feature" public static val INVALID_FLOW_END_OWNING_TYPE = "validateFlowEndOwningType" public static val INVALID_FLOW_END_OWNING_TYPE_MSG = "Flow end not allowed" public static val INVALID_FLOW_END_NESTED_FEATURE = "validateFlowEndNestedFeature" @@ -555,10 +578,14 @@ class KerMLValidator extends AbstractKerMLValidator { } } - // @Check - // def checkEndFeatureMembership(EndFeatureMembership m) { - // // validateEndFeatureMembershipIsEnd is automatically satisfied - // } + @Check + def checkEndFeatureMembership(EndFeatureMembership m) { + // validateEndFeatureMembershipIsEnd + var ownedMemberFeature = m.ownedMemberFeature + if (ownedMemberFeature !== null && !ownedMemberFeature.isEnd) { + error(INVALID_END_FEATURE_MEMBERSHIP_IS_END_MSG, ownedMemberFeature, null, INVALID_END_FEATURE_MEMBERSHIP_IS_END) + } + } @Check def checkFeature(Feature f){ @@ -1026,9 +1053,12 @@ class KerMLValidator extends AbstractKerMLValidator { ExpressionUtil.isConstructorResult(owningType))) { error(INVALID_PARAMETER_MEMBERSHIP_OWNING_TYPE_MSG, m, SysMLPackage.eINSTANCE.parameterMembership_OwnedMemberParameter, INVALID_PARAMETER_MEMBERSHIP_OWNING_TYPE) } - - // validateParameterMembershipParameterHasDirection is automatically satisfied } + // validateParameterMembershipParameterDirection + var ownedMemberParameter = m.ownedMemberParameter + if (ownedMemberParameter !== null && ownedMemberParameter.direction != m.parameterDirection) { + error(INVALID_PARAMETER_MEMBERSHIP_DIRECTION_MSG.replace("{direction}", m.parameterDirection.toString.toLowerCase), ownedMemberParameter, null, INVALID_PARAMETER_MEMBERSHIP_DIRECTION) + } } @Check @@ -1074,8 +1104,6 @@ class KerMLValidator extends AbstractKerMLValidator { if (!(owningType instanceof Function || owningType instanceof Expression)) { error(INVALID_RETURN_PARAMETER_MEMBERSHIP_OWNING_TYPE_MSG, m, SysMLPackage.eINSTANCE.parameterMembership_OwnedMemberParameter, INVALID_RETURN_PARAMETER_MEMBERSHIP_OWNING_TYPE) } - - // validateReturnParameterMembershipParameterHasDirectionOut is automatically satisfied } @Check @@ -1085,19 +1113,15 @@ class KerMLValidator extends AbstractKerMLValidator { if (!(owningType instanceof Function || owningType instanceof Expression)) { error(INVALID_RESULT_EXPRESSION_MEMBERSHIP_OWNING_TYPE_MSG, m, SysMLPackage.eINSTANCE.parameterMembership_OwnedMemberParameter, INVALID_RESULT_EXPRESSION_MEMBERSHIP_OWNING_TYPE) } - - // validateReturnParameterMembershipParameterHasDirectionOut is automatically satisfied } - // @Check - // def checkReturnParameterMembership(ReturnParameterMembership m) { - // // validateReturnParameterMembershipParameterHasDirection is automatically satisfied - // } - - // @Check - // def checkCollectExpression(CollectExpression e) { - // // validateCollectExpressionOperator is automatically satisfied - // } + @Check + def checkCollectExpression(CollectExpression e) { + // validateCollectExpressionOperator + if (e.operator != "collect") { + error(INVALID_COLLECT_EXPRESSION_OPERATOR_MSG, e, null, INVALID_COLLECT_EXPRESSION_OPERATOR); + } + } @Check def checkFeatureChainExpression(FeatureChainExpression e) { @@ -1112,7 +1136,10 @@ class KerMLValidator extends AbstractKerMLValidator { error(INVALID_FEATURE_CHAIN_EXPRESSION_FEATURE_CONFORMANCE_MSG, e.ownedMembership.get(1), SysMLPackage.eINSTANCE.membership_MemberElement, INVALID_FEATURE_CHAIN_EXPRESSION_FEATURE_CONFORMANCE) } - // validateFeatureChainExpressionOperator is automatically satisfied + // validateFeatureChainExpressionOperator + if (e.operator != ".") { + error(INVALID_FEATURE_CHAIN_EXPRESSION_OPERATOR_MSG, e, null, INVALID_FEATURE_CHAIN_EXPRESSION_OPERATOR); + } } @Check @@ -1235,15 +1262,21 @@ class KerMLValidator extends AbstractKerMLValidator { } } - // @Check - // def checkSelectExpression(SelectExpression e) { - // // validateSelectExpressionOperator is automatically satisfied - // } - - // @Check - // def checkIndexExpression(IndexExpression e) { - // // validateIndexExpressionOperator is automatically satisfied - // } + @Check + def checkSelectExpression(SelectExpression e) { + // validateSelectExpressionOperator + if (e.operator != "select") { + error(INVALID_SELECT_EXPRESSION_OPERATOR_MSG, e, null, INVALID_SELECT_EXPRESSION_OPERATOR); + } + } + + @Check + def checkIndexExpression(IndexExpression e) { + // validateIndexExpressionOperator + if (e.operator != "#") { + error(INVALID_INDEX_EXPRESSION_OPERATOR_MSG, e, null, INVALID_INDEX_EXPRESSION_OPERATOR); + } + } @Check def checkFlow(Flow flow) { @@ -1254,7 +1287,10 @@ class KerMLValidator extends AbstractKerMLValidator { @Check def checkFlowEnd(FlowEnd flowEnd) { - // validateFlowEndIsEnd is automatically satisfied + // validateFlowEndIsEnd + if (!flowEnd.isEnd) { + error(INVALID_FLOW_END_IS_END_MSG, flowEnd, null, INVALID_FLOW_END_IS_END) + } // validateFlowEndNestedFeature if (flowEnd.ownedFeature.size != 1) { diff --git a/org.omg.sysml.edit/META-INF/MANIFEST.MF b/org.omg.sysml.edit/META-INF/MANIFEST.MF index 7aa80ae21..14de5b852 100644 --- a/org.omg.sysml.edit/META-INF/MANIFEST.MF +++ b/org.omg.sysml.edit/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.omg.sysml.edit;singleton:=true Automatic-Module-Name: org.omg.sysml.edit -Bundle-Version: 0.56.0.qualifier +Bundle-Version: 0.57.0.qualifier Bundle-ClassPath: . Bundle-Activator: org.omg.sysml.lang.sysml.provider.SysMLEditPlugin$Implementation Bundle-Vendor: %providerName diff --git a/org.omg.sysml.editor.feature/feature.xml b/org.omg.sysml.editor.feature/feature.xml index 7b8969416..e90810b03 100644 --- a/org.omg.sysml.editor.feature/feature.xml +++ b/org.omg.sysml.editor.feature/feature.xml @@ -2,7 +2,7 @@ diff --git a/org.omg.sysml.editor/META-INF/MANIFEST.MF b/org.omg.sysml.editor/META-INF/MANIFEST.MF index 175df7e24..463fca6c9 100644 --- a/org.omg.sysml.editor/META-INF/MANIFEST.MF +++ b/org.omg.sysml.editor/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.omg.sysml.editor;singleton:=true Automatic-Module-Name: org.omg.sysml.editor -Bundle-Version: 0.56.0.qualifier +Bundle-Version: 0.57.0.qualifier Bundle-ClassPath: . Bundle-Activator: org.omg.sysml.lang.sysml.presentation.SysMLEditorPlugin$Implementation Bundle-Vendor: %providerName diff --git a/org.omg.sysml.execution/META-INF/MANIFEST.MF b/org.omg.sysml.execution/META-INF/MANIFEST.MF index 85904c79e..aea95d62c 100644 --- a/org.omg.sysml.execution/META-INF/MANIFEST.MF +++ b/org.omg.sysml.execution/META-INF/MANIFEST.MF @@ -1,7 +1,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-SymbolicName: org.omg.sysml.execution;singleton:=true -Bundle-Version: 0.56.0.qualifier +Bundle-Version: 0.57.0.qualifier Automatic-Module-Name: org.omg.sysml.execution Bundle-RequiredExecutionEnvironment: JavaSE-21 Bundle-Name: org.omg.sysml.execution diff --git a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/ExpressionEvaluator.java b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/ExpressionEvaluator.java index 74677aa03..52b8c98fc 100644 --- a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/ExpressionEvaluator.java +++ b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/ExpressionEvaluator.java @@ -1,6 +1,6 @@ /******************************************************************************* * SysML 2 Pilot Implementation - * Copyright (c) 2022-2025 Model Driven Solutions, Inc. + * Copyright (c) 2022-2026 Model Driven Solutions, Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -27,7 +27,6 @@ import org.omg.sysml.lang.sysml.Element; import org.omg.sysml.lang.sysml.Expression; import org.omg.sysml.lang.sysml.Feature; -import org.omg.sysml.lang.sysml.FeatureTyping; import org.omg.sysml.lang.sysml.FeatureValue; import org.omg.sysml.lang.sysml.Function; import org.omg.sysml.lang.sysml.InvocationExpression; @@ -37,6 +36,7 @@ import org.omg.sysml.util.ElementUtil; import org.omg.sysml.util.EvaluationUtil; import org.omg.sysml.util.FeatureUtil; +import org.omg.sysml.util.NamespaceUtil; import org.omg.sysml.util.TypeUtil; public class ExpressionEvaluator extends ModelLevelExpressionEvaluator { @@ -74,13 +74,9 @@ public EList evaluateInvocation(InvocationExpression expression, Elemen protected InvocationExpression instantiateInvocation(InvocationExpression expression, Element target) { InvocationExpression instantiation = SysMLFactory.eINSTANCE.createInvocationExpression(); - // Copy typing from original expression. - for (FeatureTyping typing: expression.getOwnedTyping()) { - FeatureTyping newTyping = SysMLFactory.eINSTANCE.createFeatureTyping(); - newTyping.setType(typing.getType()); - newTyping.setTypedFeature(instantiation); - instantiation.getOwnedRelationship().add(newTyping); - } + // Copy instantiatedType from original expression. + Type instantiatedType = expression.getInstantiatedType(); + NamespaceUtil.addMemberTo(instantiation, instantiatedType); // Add implicit generalization. ElementUtil.transform(instantiation); @@ -119,4 +115,15 @@ protected InvocationExpression instantiateInvocation(InvocationExpression expres return instantiation; } + + @Override + public EList evaluateFeature(Feature feature, Type type) { + EList results = super.evaluateFeature(feature, type); + Element result = results == null || results.size() != 1? null: results.get(0); + + // Treat an unbound input parameter as if it was null. + return type != null && result instanceof Feature && !(result instanceof Expression) && + FeatureUtil.isInputParameter((Feature)results.get(0), type)? EvaluationUtil.nullList(): results; + } + } diff --git a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/LibraryFunctionFactory.java b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/LibraryFunctionFactory.java index 4f41aca30..47ac7bee0 100644 --- a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/LibraryFunctionFactory.java +++ b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/LibraryFunctionFactory.java @@ -26,14 +26,15 @@ import org.omg.sysml.execution.expressions.functions.numerical.*; import org.omg.sysml.execution.expressions.functions.sequence.*; import org.omg.sysml.execution.expressions.functions.string.*; +import org.omg.sysml.execution.expressions.functions.trig.*; public class LibraryFunctionFactory extends org.omg.sysml.expressions.ModelLevelLibraryFunctionFactory { public static final LibraryFunctionFactory INSTANCE = new LibraryFunctionFactory(); @Override - protected void initializeFunctionMap() { - super.initializeFunctionMap(); + protected void initialize() { + super.initialize(); // ControlFunctions put(new ExistsFunction()); @@ -75,6 +76,17 @@ protected void initializeFunctionMap() { // StringFunctions put(new StringLengthFunction()); put(new StringSubstringFunction()); + + // TrigFunctions + put(new ACosFunction()); + put(new AsinFunction()); + put(new AtanFunction()); + put(new CosFunction()); + put(new CotFunction()); + put(new DegFunction()); + put(new RadFunction()); + put(new SinFunction()); + put(new TanFunction()); } } diff --git a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/control/ExistsFunction.java b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/control/ExistsFunction.java index 40dac91a8..ffc490b3e 100644 --- a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/control/ExistsFunction.java +++ b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/control/ExistsFunction.java @@ -21,7 +21,7 @@ package org.omg.sysml.execution.expressions.functions.control; import org.eclipse.emf.common.util.EList; -import org.omg.sysml.expressions.ModelLevelExpressionEvaluator; +import org.omg.sysml.expressions.ExpressionEvaluator; import org.omg.sysml.lang.sysml.Element; import org.omg.sysml.lang.sysml.InvocationExpression; import org.omg.sysml.util.EvaluationUtil; @@ -29,13 +29,13 @@ public class ExistsFunction extends ForAllFunction { @Override - public String getOperatorName() { + public String getFunctionName() { return "exists"; } @Override public EList invoke(InvocationExpression invocation, Element target, - ModelLevelExpressionEvaluator evaluator) { + ExpressionEvaluator evaluator) { Boolean result = forAll(invocation, target, evaluator, false); return result == null? EvaluationUtil.singletonList(invocation): EvaluationUtil.booleanResult(!result); } diff --git a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/control/ForAllFunction.java b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/control/ForAllFunction.java index 979f50cbc..746861a24 100644 --- a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/control/ForAllFunction.java +++ b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/control/ForAllFunction.java @@ -21,7 +21,7 @@ package org.omg.sysml.execution.expressions.functions.control; import org.eclipse.emf.common.util.EList; -import org.omg.sysml.expressions.ModelLevelExpressionEvaluator; +import org.omg.sysml.expressions.ExpressionEvaluator; import org.omg.sysml.expressions.functions.control.ControlFunction; import org.omg.sysml.lang.sysml.Element; import org.omg.sysml.lang.sysml.Expression; @@ -31,12 +31,12 @@ public class ForAllFunction extends ControlFunction { @Override - public String getOperatorName() { + public String getFunctionName() { return "forAll"; } public Boolean forAll(InvocationExpression invocation, Element target, - ModelLevelExpressionEvaluator evaluator, Boolean test) { + ExpressionEvaluator evaluator, Boolean test) { EList list = evaluator.evaluateArgument(invocation, 0, target); Element expr = evaluator.argumentValue(invocation, 1, target); if (list == null || !(expr instanceof Expression)) { @@ -60,7 +60,7 @@ public Boolean forAll(InvocationExpression invocation, Element target, @Override public EList invoke(InvocationExpression invocation, Element target, - ModelLevelExpressionEvaluator evaluator) { + ExpressionEvaluator evaluator) { Boolean result = forAll(invocation, target, evaluator, true); return result == null? EvaluationUtil.singletonList(invocation): EvaluationUtil.booleanResult(result); } diff --git a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/control/MaximizeFunction.java b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/control/MaximizeFunction.java index 79114d34d..247296c3e 100644 --- a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/control/MaximizeFunction.java +++ b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/control/MaximizeFunction.java @@ -23,7 +23,7 @@ import java.util.function.BiFunction; import org.eclipse.emf.common.util.EList; -import org.omg.sysml.expressions.ModelLevelExpressionEvaluator; +import org.omg.sysml.expressions.ExpressionEvaluator; import org.omg.sysml.lang.sysml.Element; import org.omg.sysml.lang.sysml.Expression; import org.omg.sysml.lang.sysml.InvocationExpression; @@ -35,13 +35,13 @@ public class MaximizeFunction extends ReduceFunction { private static final String MAX_FUNCTION = "DataFunctions::max"; @Override - public String getOperatorName() { + public String getFunctionName() { return "maximize"; } @Override public EList invoke(InvocationExpression invocation, Element target, - ModelLevelExpressionEvaluator evaluator) { + ExpressionEvaluator evaluator) { EList list = evaluator.evaluateArgument(invocation, 0, target); Element expr = evaluator.argumentValue(invocation, 1, target); if (list == null || !(expr instanceof Expression)) { diff --git a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/control/MinimizeFunction.java b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/control/MinimizeFunction.java index 215e3641c..8bce13ce3 100644 --- a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/control/MinimizeFunction.java +++ b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/control/MinimizeFunction.java @@ -23,7 +23,7 @@ import java.util.function.BiFunction; import org.eclipse.emf.common.util.EList; -import org.omg.sysml.expressions.ModelLevelExpressionEvaluator; +import org.omg.sysml.expressions.ExpressionEvaluator; import org.omg.sysml.lang.sysml.Element; import org.omg.sysml.lang.sysml.Expression; import org.omg.sysml.lang.sysml.InvocationExpression; @@ -35,13 +35,13 @@ public class MinimizeFunction extends ReduceFunction { private static final String MIN_FUNCTION = "DataFunctions::min"; @Override - public String getOperatorName() { + public String getFunctionName() { return "minimize"; } @Override public EList invoke(InvocationExpression invocation, Element target, - ModelLevelExpressionEvaluator evaluator) { + ExpressionEvaluator evaluator) { EList list = evaluator.evaluateArgument(invocation, 0, target); Element expr = evaluator.argumentValue(invocation, 1, target); if (list == null || !(expr instanceof Expression)) { diff --git a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/control/ReduceFunction.java b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/control/ReduceFunction.java index c14f36ca7..c152241cd 100644 --- a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/control/ReduceFunction.java +++ b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/control/ReduceFunction.java @@ -23,7 +23,7 @@ import java.util.function.BiFunction; import org.eclipse.emf.common.util.EList; -import org.omg.sysml.expressions.ModelLevelExpressionEvaluator; +import org.omg.sysml.expressions.ExpressionEvaluator; import org.omg.sysml.expressions.functions.control.ControlFunction; import org.omg.sysml.lang.sysml.Element; import org.omg.sysml.lang.sysml.Expression; @@ -33,7 +33,7 @@ public class ReduceFunction extends ControlFunction { @Override - public String getOperatorName() { + public String getFunctionName() { return "reduce"; } @@ -55,7 +55,7 @@ protected EList reduce(InvocationExpression invocation, EList @Override public EList invoke(InvocationExpression invocation, Element target, - ModelLevelExpressionEvaluator evaluator) { + ExpressionEvaluator evaluator) { EList list = evaluator.evaluateArgument(invocation, 0, target); Element expr = evaluator.argumentValue(invocation, 1, target); if (list == null || !(expr instanceof Expression)) { diff --git a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/control/RejectFunction.java b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/control/RejectFunction.java index 9ede5eeec..3a89ad9b7 100644 --- a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/control/RejectFunction.java +++ b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/control/RejectFunction.java @@ -23,7 +23,7 @@ import java.util.function.BiFunction; import org.eclipse.emf.common.util.EList; -import org.omg.sysml.expressions.ModelLevelExpressionEvaluator; +import org.omg.sysml.expressions.ExpressionEvaluator; import org.omg.sysml.expressions.functions.control.ControlFunction; import org.omg.sysml.lang.sysml.Element; import org.omg.sysml.lang.sysml.InvocationExpression; @@ -32,13 +32,13 @@ public class RejectFunction extends ControlFunction { @Override - public String getOperatorName() { + public String getFunctionName() { return "reject"; } @Override public EList invoke(InvocationExpression invocation, Element target, - ModelLevelExpressionEvaluator evaluator) { + ExpressionEvaluator evaluator) { return collectSelected(invocation, target, evaluator, new BiFunction<>() { @Override public EList apply(Element value, EList exprValue) { diff --git a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/control/SelectOneFunction.java b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/control/SelectOneFunction.java index d14e20340..318812b35 100644 --- a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/control/SelectOneFunction.java +++ b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/control/SelectOneFunction.java @@ -21,7 +21,7 @@ package org.omg.sysml.execution.expressions.functions.control; import org.eclipse.emf.common.util.EList; -import org.omg.sysml.expressions.ModelLevelExpressionEvaluator; +import org.omg.sysml.expressions.ExpressionEvaluator; import org.omg.sysml.expressions.functions.control.SelectFunction; import org.omg.sysml.lang.sysml.Element; import org.omg.sysml.lang.sysml.InvocationExpression; @@ -30,13 +30,13 @@ public class SelectOneFunction extends SelectFunction { @Override - public String getOperatorName() { + public String getFunctionName() { return "selectOne"; } @Override public EList invoke(InvocationExpression invocation, Element target, - ModelLevelExpressionEvaluator evaluator) { + ExpressionEvaluator evaluator) { EList list = super.invoke(invocation, target, evaluator); return list.isEmpty()? EvaluationUtil.nullList(): EvaluationUtil.singletonList(list.get(0)); diff --git a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/data/MaxFunction.java b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/data/MaxFunction.java index 61749a695..90a9c4cde 100644 --- a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/data/MaxFunction.java +++ b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/data/MaxFunction.java @@ -29,7 +29,7 @@ public class MaxFunction extends ArithmeticFunction { @Override - public String getOperatorName() { + public String getFunctionName() { return "max"; } diff --git a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/data/MinFunction.java b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/data/MinFunction.java index fd447c90d..6b6ee402b 100644 --- a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/data/MinFunction.java +++ b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/data/MinFunction.java @@ -29,7 +29,7 @@ public class MinFunction extends ArithmeticFunction { @Override - public String getOperatorName() { + public String getFunctionName() { return "min"; } diff --git a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/numerical/ProdFunction.java b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/numerical/ProdFunction.java index 26191a9da..6b3280f03 100644 --- a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/numerical/ProdFunction.java +++ b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/numerical/ProdFunction.java @@ -22,7 +22,7 @@ package org.omg.sysml.execution.expressions.functions.numerical; import org.eclipse.emf.common.util.EList; -import org.omg.sysml.expressions.ModelLevelExpressionEvaluator; +import org.omg.sysml.expressions.ExpressionEvaluator; import org.omg.sysml.lang.sysml.Element; import org.omg.sysml.lang.sysml.InvocationExpression; import org.omg.sysml.lang.sysml.LiteralInteger; @@ -32,12 +32,12 @@ public class ProdFunction extends NumericalFunction { @Override - public String getOperatorName() { + public String getFunctionName() { return "product"; } @Override - public EList invoke(InvocationExpression invocation, Element target, ModelLevelExpressionEvaluator evaluator) { + public EList invoke(InvocationExpression invocation, Element target, ExpressionEvaluator evaluator) { EList list = evaluator.evaluateArgument(invocation, 0, target); if (list == null) { return EvaluationUtil.singletonList(invocation); diff --git a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/numerical/SumFunction.java b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/numerical/SumFunction.java index 52336023f..a44976599 100644 --- a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/numerical/SumFunction.java +++ b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/numerical/SumFunction.java @@ -22,7 +22,7 @@ package org.omg.sysml.execution.expressions.functions.numerical; import org.eclipse.emf.common.util.EList; -import org.omg.sysml.expressions.ModelLevelExpressionEvaluator; +import org.omg.sysml.expressions.ExpressionEvaluator; import org.omg.sysml.lang.sysml.Element; import org.omg.sysml.lang.sysml.InvocationExpression; import org.omg.sysml.lang.sysml.LiteralInteger; @@ -32,12 +32,12 @@ public class SumFunction extends NumericalFunction { @Override - public String getOperatorName() { + public String getFunctionName() { return "sum"; } @Override - public EList invoke(InvocationExpression invocation, Element target, ModelLevelExpressionEvaluator evaluator) { + public EList invoke(InvocationExpression invocation, Element target, ExpressionEvaluator evaluator) { EList list = evaluator.evaluateArgument(invocation, 0, target); if (list == null) { return EvaluationUtil.singletonList(invocation); diff --git a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/ExcludesFunction.java b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/ExcludesFunction.java index 09fecb814..96e7096f7 100644 --- a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/ExcludesFunction.java +++ b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/ExcludesFunction.java @@ -21,7 +21,7 @@ package org.omg.sysml.execution.expressions.functions.sequence; import org.eclipse.emf.common.util.EList; -import org.omg.sysml.expressions.ModelLevelExpressionEvaluator; +import org.omg.sysml.expressions.ExpressionEvaluator; import org.omg.sysml.lang.sysml.Element; import org.omg.sysml.lang.sysml.InvocationExpression; import org.omg.sysml.util.EvaluationUtil; @@ -29,12 +29,12 @@ public class ExcludesFunction extends SequenceFunction { @Override - public String getOperatorName() { + public String getFunctionName() { return "excludes"; } @Override - public EList invoke(InvocationExpression invocation, Element target, ModelLevelExpressionEvaluator evaluator) { + public EList invoke(InvocationExpression invocation, Element target, ExpressionEvaluator evaluator) { EList list1 = evaluator.evaluateArgument(invocation, 0, target); EList list2 = evaluator.evaluateArgument(invocation, 1, target); return list1 == null || list2 == null? EvaluationUtil.singletonList(invocation): diff --git a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/ExcludingAtFunction.java b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/ExcludingAtFunction.java index 3e097cc27..0543f5b4e 100644 --- a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/ExcludingAtFunction.java +++ b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/ExcludingAtFunction.java @@ -22,7 +22,7 @@ import org.eclipse.emf.common.util.BasicEList; import org.eclipse.emf.common.util.EList; -import org.omg.sysml.expressions.ModelLevelExpressionEvaluator; +import org.omg.sysml.expressions.ExpressionEvaluator; import org.omg.sysml.lang.sysml.Element; import org.omg.sysml.lang.sysml.InvocationExpression; import org.omg.sysml.util.EvaluationUtil; @@ -30,12 +30,12 @@ public class ExcludingAtFunction extends SequenceFunction { @Override - public String getOperatorName() { + public String getFunctionName() { return "excludingAt"; } @Override - public EList invoke(InvocationExpression invocation, Element target, ModelLevelExpressionEvaluator evaluator) { + public EList invoke(InvocationExpression invocation, Element target, ExpressionEvaluator evaluator) { EList seq = evaluator.evaluateArgument(invocation, 0, target); Element startIndex = evaluator.argumentValue(invocation, 1, target); Element endIndex = evaluator.argumentValue(invocation, 2, target); diff --git a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/ExcludingFunction.java b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/ExcludingFunction.java index bf637afd2..0fe4330a9 100644 --- a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/ExcludingFunction.java +++ b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/ExcludingFunction.java @@ -22,7 +22,7 @@ import org.eclipse.emf.common.util.BasicEList; import org.eclipse.emf.common.util.EList; -import org.omg.sysml.expressions.ModelLevelExpressionEvaluator; +import org.omg.sysml.expressions.ExpressionEvaluator; import org.omg.sysml.lang.sysml.Element; import org.omg.sysml.lang.sysml.InvocationExpression; import org.omg.sysml.util.EvaluationUtil; @@ -30,12 +30,12 @@ public class ExcludingFunction extends SequenceFunction { @Override - public String getOperatorName() { + public String getFunctionName() { return "excluding"; } @Override - public EList invoke(InvocationExpression invocation, Element target, ModelLevelExpressionEvaluator evaluator) { + public EList invoke(InvocationExpression invocation, Element target, ExpressionEvaluator evaluator) { EList list1 = evaluator.evaluateArgument(invocation, 0, target); EList list2 = evaluator.evaluateArgument(invocation, 1, target); if (list1 == null || list2 == null) { diff --git a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/HeadFunction.java b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/HeadFunction.java index 8a879b134..d9550681e 100644 --- a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/HeadFunction.java +++ b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/HeadFunction.java @@ -21,7 +21,7 @@ package org.omg.sysml.execution.expressions.functions.sequence; import org.eclipse.emf.common.util.EList; -import org.omg.sysml.expressions.ModelLevelExpressionEvaluator; +import org.omg.sysml.expressions.ExpressionEvaluator; import org.omg.sysml.lang.sysml.Element; import org.omg.sysml.lang.sysml.InvocationExpression; import org.omg.sysml.util.EvaluationUtil; @@ -29,12 +29,12 @@ public class HeadFunction extends SequenceFunction { @Override - public String getOperatorName() { + public String getFunctionName() { return "head"; } @Override - public EList invoke(InvocationExpression invocation, Element target, ModelLevelExpressionEvaluator evaluator) { + public EList invoke(InvocationExpression invocation, Element target, ExpressionEvaluator evaluator) { EList seq = evaluator.evaluateArgument(invocation, 0, target); return seq == null? EvaluationUtil.singletonList(invocation): seq.isEmpty()? EvaluationUtil.nullList(): diff --git a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/IncludesFunction.java b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/IncludesFunction.java index f4b0f5dae..c6c9f30e6 100644 --- a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/IncludesFunction.java +++ b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/IncludesFunction.java @@ -21,7 +21,7 @@ package org.omg.sysml.execution.expressions.functions.sequence; import org.eclipse.emf.common.util.EList; -import org.omg.sysml.expressions.ModelLevelExpressionEvaluator; +import org.omg.sysml.expressions.ExpressionEvaluator; import org.omg.sysml.lang.sysml.Element; import org.omg.sysml.lang.sysml.InvocationExpression; import org.omg.sysml.util.EvaluationUtil; @@ -29,12 +29,12 @@ public class IncludesFunction extends SequenceFunction { @Override - public String getOperatorName() { + public String getFunctionName() { return "includes"; } @Override - public EList invoke(InvocationExpression invocation, Element target, ModelLevelExpressionEvaluator evaluator) { + public EList invoke(InvocationExpression invocation, Element target, ExpressionEvaluator evaluator) { EList list1 = evaluator.evaluateArgument(invocation, 0, target); EList list2 = evaluator.evaluateArgument(invocation, 1, target); return list1 == null || list2 == null? EvaluationUtil.singletonList(invocation): diff --git a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/IncludesOnlyFunction.java b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/IncludesOnlyFunction.java index 013e52264..9fa36fc0a 100644 --- a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/IncludesOnlyFunction.java +++ b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/IncludesOnlyFunction.java @@ -21,7 +21,7 @@ package org.omg.sysml.execution.expressions.functions.sequence; import org.eclipse.emf.common.util.EList; -import org.omg.sysml.expressions.ModelLevelExpressionEvaluator; +import org.omg.sysml.expressions.ExpressionEvaluator; import org.omg.sysml.lang.sysml.Element; import org.omg.sysml.lang.sysml.InvocationExpression; import org.omg.sysml.util.EvaluationUtil; @@ -29,12 +29,12 @@ public class IncludesOnlyFunction extends IncludesFunction { @Override - public String getOperatorName() { + public String getFunctionName() { return "includesOnly"; } @Override - public EList invoke(InvocationExpression invocation, Element target, ModelLevelExpressionEvaluator evaluator) { + public EList invoke(InvocationExpression invocation, Element target, ExpressionEvaluator evaluator) { EList list1 = evaluator.evaluateArgument(invocation, 0, target); EList list2 = evaluator.evaluateArgument(invocation, 1, target); return list1 == null || list2 == null? EvaluationUtil.singletonList(invocation): diff --git a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/IncludingAtFunction.java b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/IncludingAtFunction.java index 9685dcd1e..a2a0fb9d9 100644 --- a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/IncludingAtFunction.java +++ b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/IncludingAtFunction.java @@ -22,7 +22,7 @@ import org.eclipse.emf.common.util.BasicEList; import org.eclipse.emf.common.util.EList; -import org.omg.sysml.expressions.ModelLevelExpressionEvaluator; +import org.omg.sysml.expressions.ExpressionEvaluator; import org.omg.sysml.lang.sysml.Element; import org.omg.sysml.lang.sysml.InvocationExpression; import org.omg.sysml.util.EvaluationUtil; @@ -30,12 +30,12 @@ public class IncludingAtFunction extends SequenceFunction { @Override - public String getOperatorName() { + public String getFunctionName() { return "includingAt"; } @Override - public EList invoke(InvocationExpression invocation, Element target, ModelLevelExpressionEvaluator evaluator) { + public EList invoke(InvocationExpression invocation, Element target, ExpressionEvaluator evaluator) { EList seq = evaluator.evaluateArgument(invocation, 0, target); EList values = evaluator.evaluateArgument(invocation, 1, target); Element index = evaluator.argumentValue(invocation, 2, target); diff --git a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/IncludingFunction.java b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/IncludingFunction.java index d986472d8..d7f683dad 100644 --- a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/IncludingFunction.java +++ b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/IncludingFunction.java @@ -23,7 +23,7 @@ public class IncludingFunction extends UnionFunction { @Override - public String getOperatorName() { + public String getFunctionName() { return "including"; } diff --git a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/IntersectionFunction.java b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/IntersectionFunction.java index b532d1b60..2d27e9326 100644 --- a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/IntersectionFunction.java +++ b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/IntersectionFunction.java @@ -22,7 +22,7 @@ import org.eclipse.emf.common.util.BasicEList; import org.eclipse.emf.common.util.EList; -import org.omg.sysml.expressions.ModelLevelExpressionEvaluator; +import org.omg.sysml.expressions.ExpressionEvaluator; import org.omg.sysml.lang.sysml.Element; import org.omg.sysml.lang.sysml.InvocationExpression; import org.omg.sysml.util.EvaluationUtil; @@ -30,12 +30,12 @@ public class IntersectionFunction extends SequenceFunction { @Override - public String getOperatorName() { + public String getFunctionName() { return "intersection"; } @Override - public EList invoke(InvocationExpression invocation, Element target, ModelLevelExpressionEvaluator evaluator) { + public EList invoke(InvocationExpression invocation, Element target, ExpressionEvaluator evaluator) { EList list1 = evaluator.evaluateArgument(invocation, 0, target); EList list2 = evaluator.evaluateArgument(invocation, 1, target); if (list1 == null || list2 == null) { diff --git a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/IsEmptyFunction.java b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/IsEmptyFunction.java index 07c4555f6..578fb17a7 100644 --- a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/IsEmptyFunction.java +++ b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/IsEmptyFunction.java @@ -21,7 +21,7 @@ package org.omg.sysml.execution.expressions.functions.sequence; import org.eclipse.emf.common.util.EList; -import org.omg.sysml.expressions.ModelLevelExpressionEvaluator; +import org.omg.sysml.expressions.ExpressionEvaluator; import org.omg.sysml.lang.sysml.Element; import org.omg.sysml.lang.sysml.InvocationExpression; import org.omg.sysml.util.EvaluationUtil; @@ -29,12 +29,12 @@ public class IsEmptyFunction extends SequenceFunction { @Override - public String getOperatorName() { + public String getFunctionName() { return "isEmpty"; } @Override - public EList invoke(InvocationExpression invocation, Element target, ModelLevelExpressionEvaluator evaluator) { + public EList invoke(InvocationExpression invocation, Element target, ExpressionEvaluator evaluator) { EList list = evaluator.evaluateArgument(invocation, 0, target); return list == null? EvaluationUtil.singletonList(invocation): EvaluationUtil.booleanResult(list.isEmpty()); } diff --git a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/LastFunction.java b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/LastFunction.java index d6b05655f..0e79b4a10 100644 --- a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/LastFunction.java +++ b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/LastFunction.java @@ -21,7 +21,7 @@ package org.omg.sysml.execution.expressions.functions.sequence; import org.eclipse.emf.common.util.EList; -import org.omg.sysml.expressions.ModelLevelExpressionEvaluator; +import org.omg.sysml.expressions.ExpressionEvaluator; import org.omg.sysml.lang.sysml.Element; import org.omg.sysml.lang.sysml.InvocationExpression; import org.omg.sysml.util.EvaluationUtil; @@ -29,12 +29,12 @@ public class LastFunction extends SequenceFunction { @Override - public String getOperatorName() { + public String getFunctionName() { return "last"; } @Override - public EList invoke(InvocationExpression invocation, Element target, ModelLevelExpressionEvaluator evaluator) { + public EList invoke(InvocationExpression invocation, Element target, ExpressionEvaluator evaluator) { EList seq = evaluator.evaluateArgument(invocation, 0, target); return seq == null? EvaluationUtil.singletonList(invocation): seq.isEmpty()? EvaluationUtil.nullList(): diff --git a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/NotEmptyFunction.java b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/NotEmptyFunction.java index 45f58e3bf..8589765c2 100644 --- a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/NotEmptyFunction.java +++ b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/NotEmptyFunction.java @@ -21,7 +21,7 @@ package org.omg.sysml.execution.expressions.functions.sequence; import org.eclipse.emf.common.util.EList; -import org.omg.sysml.expressions.ModelLevelExpressionEvaluator; +import org.omg.sysml.expressions.ExpressionEvaluator; import org.omg.sysml.lang.sysml.Element; import org.omg.sysml.lang.sysml.InvocationExpression; import org.omg.sysml.util.EvaluationUtil; @@ -29,12 +29,12 @@ public class NotEmptyFunction extends SequenceFunction { @Override - public String getOperatorName() { + public String getFunctionName() { return "notEmpty"; } @Override - public EList invoke(InvocationExpression invocation, Element target, ModelLevelExpressionEvaluator evaluator) { + public EList invoke(InvocationExpression invocation, Element target, ExpressionEvaluator evaluator) { EList list = evaluator.evaluateArgument(invocation, 0, target); return list == null? EvaluationUtil.singletonList(invocation): EvaluationUtil.booleanResult(!list.isEmpty()); diff --git a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/SequenceEqualsFunction.java b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/SequenceEqualsFunction.java index 8a634e46f..e06c27763 100644 --- a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/SequenceEqualsFunction.java +++ b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/SequenceEqualsFunction.java @@ -22,7 +22,7 @@ package org.omg.sysml.execution.expressions.functions.sequence; import org.eclipse.emf.common.util.EList; -import org.omg.sysml.expressions.ModelLevelExpressionEvaluator; +import org.omg.sysml.expressions.ExpressionEvaluator; import org.omg.sysml.lang.sysml.Element; import org.omg.sysml.lang.sysml.InvocationExpression; import org.omg.sysml.util.EvaluationUtil; @@ -30,13 +30,13 @@ public class SequenceEqualsFunction extends SequenceFunction { @Override - public String getOperatorName() { + public String getFunctionName() { return "equals"; } @Override public EList invoke(InvocationExpression invocation, Element target, - ModelLevelExpressionEvaluator evaluator) { + ExpressionEvaluator evaluator) { EList list1 = evaluator.evaluateArgument(invocation, 0, target); EList list2 = evaluator.evaluateArgument(invocation, 1, target); return list1 == null || list2 == null? EvaluationUtil.singletonList(invocation): diff --git a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/SequenceSameFunction.java b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/SequenceSameFunction.java index 75eef547a..d13887bd9 100644 --- a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/SequenceSameFunction.java +++ b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/SequenceSameFunction.java @@ -22,7 +22,7 @@ package org.omg.sysml.execution.expressions.functions.sequence; import org.eclipse.emf.common.util.EList; -import org.omg.sysml.expressions.ModelLevelExpressionEvaluator; +import org.omg.sysml.expressions.ExpressionEvaluator; import org.omg.sysml.lang.sysml.Element; import org.omg.sysml.lang.sysml.InvocationExpression; import org.omg.sysml.util.EvaluationUtil; @@ -30,13 +30,13 @@ public class SequenceSameFunction extends SequenceEqualsFunction { @Override - public String getOperatorName() { + public String getFunctionName() { return "same"; } @Override public EList invoke(InvocationExpression invocation, Element target, - ModelLevelExpressionEvaluator evaluator) { + ExpressionEvaluator evaluator) { EList list1 = evaluator.evaluateArgument(invocation, 0, target); EList list2 = evaluator.evaluateArgument(invocation, 1, target); return list1 == null || list2 == null? EvaluationUtil.singletonList(invocation): diff --git a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/SizeFunction.java b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/SizeFunction.java index c38e91de4..38932d0bc 100644 --- a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/SizeFunction.java +++ b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/SizeFunction.java @@ -21,7 +21,7 @@ package org.omg.sysml.execution.expressions.functions.sequence; import org.eclipse.emf.common.util.EList; -import org.omg.sysml.expressions.ModelLevelExpressionEvaluator; +import org.omg.sysml.expressions.ExpressionEvaluator; import org.omg.sysml.lang.sysml.Element; import org.omg.sysml.lang.sysml.InvocationExpression; import org.omg.sysml.util.EvaluationUtil; @@ -29,12 +29,12 @@ public class SizeFunction extends SequenceFunction { @Override - public String getOperatorName() { + public String getFunctionName() { return "size"; } @Override - public EList invoke(InvocationExpression invocation, Element target, ModelLevelExpressionEvaluator evaluator) { + public EList invoke(InvocationExpression invocation, Element target, ExpressionEvaluator evaluator) { EList list = evaluator.evaluateArgument(invocation, 0, target); return list == null? EvaluationUtil.singletonList(invocation): EvaluationUtil.integerResult(list.size()); diff --git a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/SubsequenceFunction.java b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/SubsequenceFunction.java index eaa4e19cb..c20627245 100644 --- a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/SubsequenceFunction.java +++ b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/SubsequenceFunction.java @@ -22,7 +22,7 @@ import org.eclipse.emf.common.util.BasicEList; import org.eclipse.emf.common.util.EList; -import org.omg.sysml.expressions.ModelLevelExpressionEvaluator; +import org.omg.sysml.expressions.ExpressionEvaluator; import org.omg.sysml.lang.sysml.Element; import org.omg.sysml.lang.sysml.InvocationExpression; import org.omg.sysml.util.EvaluationUtil; @@ -30,12 +30,12 @@ public class SubsequenceFunction extends SequenceFunction { @Override - public String getOperatorName() { + public String getFunctionName() { return "subsequence"; } @Override - public EList invoke(InvocationExpression invocation, Element target, ModelLevelExpressionEvaluator evaluator) { + public EList invoke(InvocationExpression invocation, Element target, ExpressionEvaluator evaluator) { EList seq = evaluator.evaluateArgument(invocation, 0, target); Element startIndex = evaluator.argumentValue(invocation, 1, target); Element endIndex = evaluator.argumentValue(invocation, 2, target); diff --git a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/TailFunction.java b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/TailFunction.java index 777bf95e6..891b1a5cd 100644 --- a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/TailFunction.java +++ b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/TailFunction.java @@ -22,7 +22,7 @@ import org.eclipse.emf.common.util.BasicEList; import org.eclipse.emf.common.util.EList; -import org.omg.sysml.expressions.ModelLevelExpressionEvaluator; +import org.omg.sysml.expressions.ExpressionEvaluator; import org.omg.sysml.lang.sysml.Element; import org.omg.sysml.lang.sysml.InvocationExpression; import org.omg.sysml.util.EvaluationUtil; @@ -30,12 +30,12 @@ public class TailFunction extends SequenceFunction { @Override - public String getOperatorName() { + public String getFunctionName() { return "tail"; } @Override - public EList invoke(InvocationExpression invocation, Element target, ModelLevelExpressionEvaluator evaluator) { + public EList invoke(InvocationExpression invocation, Element target, ExpressionEvaluator evaluator) { EList seq = evaluator.evaluateArgument(invocation, 0, target); return seq == null? EvaluationUtil.singletonList(invocation): seq.size() <= 1? EvaluationUtil.nullList(): diff --git a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/UnionFunction.java b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/UnionFunction.java index 8ba9843b8..f1b5883bb 100644 --- a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/UnionFunction.java +++ b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/sequence/UnionFunction.java @@ -30,7 +30,7 @@ public String getPackageName() { } @Override - public String getOperatorName() { + public String getFunctionName() { return "union"; } diff --git a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/string/StringLengthFunction.java b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/string/StringLengthFunction.java index 85d38ca65..c946553be 100644 --- a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/string/StringLengthFunction.java +++ b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/string/StringLengthFunction.java @@ -22,7 +22,7 @@ package org.omg.sysml.execution.expressions.functions.string; import org.eclipse.emf.common.util.EList; -import org.omg.sysml.expressions.ModelLevelExpressionEvaluator; +import org.omg.sysml.expressions.ExpressionEvaluator; import org.omg.sysml.lang.sysml.Element; import org.omg.sysml.lang.sysml.InvocationExpression; import org.omg.sysml.util.EvaluationUtil; @@ -35,12 +35,12 @@ public String getPackageName() { } @Override - public String getOperatorName() { + public String getFunctionName() { return "Length"; } @Override - public EList invoke(InvocationExpression invocation, Element target, ModelLevelExpressionEvaluator evaluator) { + public EList invoke(InvocationExpression invocation, Element target, ExpressionEvaluator evaluator) { String x = evaluator.stringValue(invocation, 0, target); return x == null? EvaluationUtil.singletonList(invocation): EvaluationUtil.integerResult(x.length()); } diff --git a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/string/StringSubstringFunction.java b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/string/StringSubstringFunction.java index 7b7cf7004..6d5087200 100644 --- a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/string/StringSubstringFunction.java +++ b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/string/StringSubstringFunction.java @@ -22,7 +22,7 @@ package org.omg.sysml.execution.expressions.functions.string; import org.eclipse.emf.common.util.EList; -import org.omg.sysml.expressions.ModelLevelExpressionEvaluator; +import org.omg.sysml.expressions.ExpressionEvaluator; import org.omg.sysml.lang.sysml.Element; import org.omg.sysml.lang.sysml.InvocationExpression; import org.omg.sysml.util.EvaluationUtil; @@ -35,12 +35,12 @@ public String getPackageName() { } @Override - public String getOperatorName() { + public String getFunctionName() { return "Substring"; } @Override - public EList invoke(InvocationExpression invocation, Element target, ModelLevelExpressionEvaluator evaluator) { + public EList invoke(InvocationExpression invocation, Element target, ExpressionEvaluator evaluator) { String x = evaluator.stringValue(invocation, 0, target); Integer lower = evaluator.integerValue(invocation, 1, target); Integer upper = evaluator.integerValue(invocation, 2, target); diff --git a/org.omg.sysml/syntax-gen/org/omg/sysml/lang/sysml/PartProperty.java b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/trig/ACosFunction.java similarity index 57% rename from org.omg.sysml/syntax-gen/org/omg/sysml/lang/sysml/PartProperty.java rename to org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/trig/ACosFunction.java index 13ec23c36..47852e8b8 100644 --- a/org.omg.sysml/syntax-gen/org/omg/sysml/lang/sysml/PartProperty.java +++ b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/trig/ACosFunction.java @@ -1,6 +1,6 @@ /******************************************************************************* * SysML 2 Pilot Implementation - * Copyright (c) 2020-2021 Model Driven Solutions, Inc. + * Copyright (c) 2026 Model Driven Solutions, Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -18,24 +18,25 @@ * @license LGPL-3.0-or-later * *******************************************************************************/ -/** - */ -package org.omg.sysml.lang.sysml; +package org.omg.sysml.execution.expressions.functions.trig; -/** - * - * A representation of the model object 'Part Property'. - * - * - * - *

A PartProperty is a usage of a Block to represent a composite part of a system. Any FeatureMembership of a PartProperty must be composite, which means a PartProperty cannot be a feature of ValueType or a nested feature of a ReferenceProperty or a ValueProperty.

- * - * - * - * @see org.omg.sysml.lang.sysml.SysMLPackage#getPartProperty() - * @model - * @generated - */ -public interface PartProperty extends PartUsage { -} // PartProperty +import java.lang.Math; + +import org.eclipse.emf.common.util.EList; +import org.omg.sysml.lang.sysml.Element; +import org.omg.sysml.util.EvaluationUtil; + +public class ACosFunction extends TrigFunction { + + @Override + public String getFunctionName() { + return "arccos"; + } + + @Override + protected EList realFunction(double x) { + return EvaluationUtil.realResult(Math.acos(x)); + } + +} diff --git a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/trig/AsinFunction.java b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/trig/AsinFunction.java new file mode 100644 index 000000000..5bcbfaf37 --- /dev/null +++ b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/trig/AsinFunction.java @@ -0,0 +1,42 @@ +/******************************************************************************* + * SysML 2 Pilot Implementation + * Copyright (c) 2026 Model Driven Solutions, Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of theGNU Lesser General Public License + * along with this program. If not, see . + * + * @license LGPL-3.0-or-later + * + *******************************************************************************/ + +package org.omg.sysml.execution.expressions.functions.trig; + +import java.lang.Math; + +import org.eclipse.emf.common.util.EList; +import org.omg.sysml.lang.sysml.Element; +import org.omg.sysml.util.EvaluationUtil; + +public class AsinFunction extends TrigFunction { + + @Override + public String getFunctionName() { + return "arcsin"; + } + + @Override + protected EList realFunction(double x) { + return EvaluationUtil.realResult(Math.asin(x)); + } + +} diff --git a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/trig/AtanFunction.java b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/trig/AtanFunction.java new file mode 100644 index 000000000..efea9f6fa --- /dev/null +++ b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/trig/AtanFunction.java @@ -0,0 +1,42 @@ +/******************************************************************************* + * SysML 2 Pilot Implementation + * Copyright (c) 2026 Model Driven Solutions, Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of theGNU Lesser General Public License + * along with this program. If not, see . + * + * @license LGPL-3.0-or-later + * + *******************************************************************************/ + +package org.omg.sysml.execution.expressions.functions.trig; + +import java.lang.Math; + +import org.eclipse.emf.common.util.EList; +import org.omg.sysml.lang.sysml.Element; +import org.omg.sysml.util.EvaluationUtil; + +public class AtanFunction extends TrigFunction { + + @Override + public String getFunctionName() { + return "arctan"; + } + + @Override + protected EList realFunction(double x) { + return EvaluationUtil.realResult(Math.atan(x)); + } + +} diff --git a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/trig/CosFunction.java b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/trig/CosFunction.java new file mode 100644 index 000000000..6d8d34285 --- /dev/null +++ b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/trig/CosFunction.java @@ -0,0 +1,42 @@ +/******************************************************************************* + * SysML 2 Pilot Implementation + * Copyright (c) 2026 Model Driven Solutions, Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of theGNU Lesser General Public License + * along with this program. If not, see . + * + * @license LGPL-3.0-or-later + * + *******************************************************************************/ + +package org.omg.sysml.execution.expressions.functions.trig; + +import java.lang.Math; + +import org.eclipse.emf.common.util.EList; +import org.omg.sysml.lang.sysml.Element; +import org.omg.sysml.util.EvaluationUtil; + +public class CosFunction extends TrigFunction { + + @Override + public String getFunctionName() { + return "cos"; + } + + @Override + protected EList realFunction(double x) { + return EvaluationUtil.realResult(Math.cos(x)); + } + +} diff --git a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/trig/CotFunction.java b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/trig/CotFunction.java new file mode 100644 index 000000000..8df12afe9 --- /dev/null +++ b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/trig/CotFunction.java @@ -0,0 +1,42 @@ +/******************************************************************************* + * SysML 2 Pilot Implementation + * Copyright (c) 2026 Model Driven Solutions, Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of theGNU Lesser General Public License + * along with this program. If not, see . + * + * @license LGPL-3.0-or-later + * + *******************************************************************************/ + +package org.omg.sysml.execution.expressions.functions.trig; + +import java.lang.Math; + +import org.eclipse.emf.common.util.EList; +import org.omg.sysml.lang.sysml.Element; +import org.omg.sysml.util.EvaluationUtil; + +public class CotFunction extends TrigFunction { + + @Override + public String getFunctionName() { + return "cot"; + } + + @Override + protected EList realFunction(double x) { + return EvaluationUtil.realResult(1.0/Math.tan(x)); + } + +} diff --git a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/trig/DegFunction.java b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/trig/DegFunction.java new file mode 100644 index 000000000..7217f50d6 --- /dev/null +++ b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/trig/DegFunction.java @@ -0,0 +1,42 @@ +/******************************************************************************* + * SysML 2 Pilot Implementation + * Copyright (c) 2026 Model Driven Solutions, Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of theGNU Lesser General Public License + * along with this program. If not, see . + * + * @license LGPL-3.0-or-later + * + *******************************************************************************/ + +package org.omg.sysml.execution.expressions.functions.trig; + +import java.lang.Math; + +import org.eclipse.emf.common.util.EList; +import org.omg.sysml.lang.sysml.Element; +import org.omg.sysml.util.EvaluationUtil; + +public class DegFunction extends TrigFunction { + + @Override + public String getFunctionName() { + return "deg"; + } + + @Override + protected EList realFunction(double x) { + return EvaluationUtil.realResult(Math.toDegrees(x)); + } + +} diff --git a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/trig/RadFunction.java b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/trig/RadFunction.java new file mode 100644 index 000000000..12fdd2346 --- /dev/null +++ b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/trig/RadFunction.java @@ -0,0 +1,42 @@ +/******************************************************************************* + * SysML 2 Pilot Implementation + * Copyright (c) 2026 Model Driven Solutions, Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of theGNU Lesser General Public License + * along with this program. If not, see . + * + * @license LGPL-3.0-or-later + * + *******************************************************************************/ + +package org.omg.sysml.execution.expressions.functions.trig; + +import java.lang.Math; + +import org.eclipse.emf.common.util.EList; +import org.omg.sysml.lang.sysml.Element; +import org.omg.sysml.util.EvaluationUtil; + +public class RadFunction extends TrigFunction { + + @Override + public String getFunctionName() { + return "rad"; + } + + @Override + protected EList realFunction(double x) { + return EvaluationUtil.realResult(Math.toRadians(x)); + } + +} diff --git a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/trig/SinFunction.java b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/trig/SinFunction.java new file mode 100644 index 000000000..43e4b1888 --- /dev/null +++ b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/trig/SinFunction.java @@ -0,0 +1,42 @@ +/******************************************************************************* + * SysML 2 Pilot Implementation + * Copyright (c) 2026 Model Driven Solutions, Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of theGNU Lesser General Public License + * along with this program. If not, see . + * + * @license LGPL-3.0-or-later + * + *******************************************************************************/ + +package org.omg.sysml.execution.expressions.functions.trig; + +import java.lang.Math; + +import org.eclipse.emf.common.util.EList; +import org.omg.sysml.lang.sysml.Element; +import org.omg.sysml.util.EvaluationUtil; + +public class SinFunction extends TrigFunction { + + @Override + public String getFunctionName() { + return "sin"; + } + + @Override + protected EList realFunction(double x) { + return EvaluationUtil.realResult(Math.sin(x)); + } + +} diff --git a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/trig/TanFunction.java b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/trig/TanFunction.java new file mode 100644 index 000000000..b7ad6e39f --- /dev/null +++ b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/trig/TanFunction.java @@ -0,0 +1,42 @@ +/******************************************************************************* + * SysML 2 Pilot Implementation + * Copyright (c) 2026 Model Driven Solutions, Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of theGNU Lesser General Public License + * along with this program. If not, see . + * + * @license LGPL-3.0-or-later + * + *******************************************************************************/ + +package org.omg.sysml.execution.expressions.functions.trig; + +import java.lang.Math; + +import org.eclipse.emf.common.util.EList; +import org.omg.sysml.lang.sysml.Element; +import org.omg.sysml.util.EvaluationUtil; + +public class TanFunction extends TrigFunction { + + @Override + public String getFunctionName() { + return "tan"; + } + + @Override + protected EList realFunction(double x) { + return EvaluationUtil.realResult(Math.tan(x)); + } + +} diff --git a/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/trig/TrigFunction.java b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/trig/TrigFunction.java new file mode 100644 index 000000000..8f14f4684 --- /dev/null +++ b/org.omg.sysml.execution/src/org/omg/sysml/execution/expressions/functions/trig/TrigFunction.java @@ -0,0 +1,47 @@ +/******************************************************************************* + * SysML 2 Pilot Implementation + * Copyright (c) 2026 Model Driven Solutions, Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of theGNU Lesser General Public License + * along with this program. If not, see . + * + * @license LGPL-3.0-or-later + * + *******************************************************************************/ + +package org.omg.sysml.execution.expressions.functions.trig; + +import org.eclipse.emf.common.util.EList; +import org.omg.sysml.expressions.ExpressionEvaluator; +import org.omg.sysml.expressions.functions.LibraryFunction; +import org.omg.sysml.lang.sysml.Element; +import org.omg.sysml.lang.sysml.InvocationExpression; +import org.omg.sysml.util.EvaluationUtil; + +public abstract class TrigFunction implements LibraryFunction { + + @Override + public String getPackageName() { + return "TrigFunctions"; + } + + protected abstract EList realFunction(double x); + + @Override + public EList invoke(InvocationExpression invocation, Element target, ExpressionEvaluator evaluator) { + Object x = EvaluationUtil.valueOf(evaluator.argumentValue(invocation, 0, target)); + return x instanceof Integer? realFunction((double)(int)x): + x instanceof Double? realFunction((double)x): + EvaluationUtil.singletonList(invocation); + } +} diff --git a/org.omg.sysml.feature/feature.xml b/org.omg.sysml.feature/feature.xml index 877c070f3..2ea11f72f 100644 --- a/org.omg.sysml.feature/feature.xml +++ b/org.omg.sysml.feature/feature.xml @@ -2,7 +2,7 @@ diff --git a/org.omg.sysml.installer/SysML2.setup b/org.omg.sysml.installer/SysML2.setup index 4230e9d9d..cc14585e6 100644 --- a/org.omg.sysml.installer/SysML2.setup +++ b/org.omg.sysml.installer/SysML2.setup @@ -45,7 +45,7 @@ + url="http://download.eclipse.org/releases/2025-12/"/> + name="SysMLv2 2025-12 Target"/> enumeratedValues = ((EnumerationDefinition)ownedMembers.get(1)).getEnumeratedValue(); assertEquals("enum def (variants.size)", 2, variants.size()); - assertEquals("enuim def (enumeratedValues.size)", 2, enumeratedValues.size()); + assertEquals("enum def (enumeratedValues.size)", 2, enumeratedValues.size()); assertEquals("enum def (enumeratedValues)", variants, enumeratedValues); } + + public final String circularRecursiveImportTest = + "package Test {\n" + + " package P1 {\n" + + " public import Test::**;\n" + + " item def X;" + + " }\n" + + " package P2 {\n" + + " public import Test::*::**;\n" + + " item def Y;" + + " }\n" + + "}"; + + @Test + public void testCircularRecursiveImport() throws Exception { + SysMLInteractive instance = getSysMLInteractiveInstance(); + SysMLInteractiveResult result = instance.process(circularRecursiveImportTest); + Element root = result.getRootElement(); + List elements = ((Namespace)root).getOwnedMember(); + List ownedMembers = ((Namespace)elements.get(0)).getOwnedMember(); + List importedMemberships = ((Namespace)ownedMembers.get(0)).getImportedMembership(); + assertArrayEquals("P1.importedMembers", new String[] {"Test", "P1", "P2", "X", "Y"}, + importedMemberships.stream().map(Membership::getMemberElement).map(Element::getName).toArray()); + importedMemberships = ((Namespace)ownedMembers.get(1)).getImportedMembership(); + assertArrayEquals("P2.importedMembers", new String[] {"P1", "P2", "X", "Test", "Y"}, + importedMemberships.stream().map(Membership::getMemberElement).map(Element::getName).toArray()); + } + + public final String localeTest = + "package Test {\n" + + " comment locale \"en_US\" /* doc */\n" + + " doc locale \"en_US\" /* doc */\\n" + + "}"; + + @Test + public void testLocale() throws Exception { + SysMLInteractive instance = getSysMLInteractiveInstance(); + SysMLInteractiveResult result = instance.process(localeTest); + Element root = result.getRootElement(); + List elements = ((Namespace)root).getOwnedMember(); + List ownedMembers = ((Namespace)elements.get(0)).getOwnedMember(); + Comment comment = (Comment)ownedMembers.get(0); + Documentation doc = (Documentation)ownedMembers.get(1); + assertEquals("comment.locale", "en_US", comment.getLocale()); + assertEquals("doc.locale", "en_US", doc.getLocale()); + } } diff --git a/org.omg.sysml.interactive.tests/src/org/omg/sysml/interactive/tests/ExpressionEvaluationTest.java b/org.omg.sysml.interactive.tests/src/org/omg/sysml/interactive/tests/ExpressionEvaluationTest.java index fdb4da91b..9f690f0d9 100644 --- a/org.omg.sysml.interactive.tests/src/org/omg/sysml/interactive/tests/ExpressionEvaluationTest.java +++ b/org.omg.sysml.interactive.tests/src/org/omg/sysml/interactive/tests/ExpressionEvaluationTest.java @@ -347,7 +347,7 @@ public void testIndexOperator() throws Exception { + " calc def Test {" + " in x;" + " in y;" - + " x" + + " (x, y)" + " }" + "}"; @@ -355,9 +355,11 @@ public void testIndexOperator() throws Exception { public void testInvocationEvaluation() throws Exception { SysMLInteractive instance = getSysMLInteractiveInstance(); process(instance, invocationTest); - assertElement("LiteralInteger 1", instance.eval("Test(1, 2)", "InvocationTest")); - assertElement("LiteralInteger 1", instance.eval("Test(x = 1, y = 2)", "InvocationTest")); - assertElement("LiteralInteger 1", instance.eval("Test(y = 2, x = 1)", "InvocationTest")); + assertList(new String[] {"LiteralInteger 1", "LiteralInteger 2"}, instance.eval("Test(1, 2)", "InvocationTest")); + assertList(new String[] {"LiteralInteger 1", "LiteralInteger 2"}, instance.eval("Test(x = 1, y = 2)", "InvocationTest")); + assertList(new String[] {"LiteralInteger 1", "LiteralInteger 2"}, instance.eval("Test(y = 2, x = 1)", "InvocationTest")); + assertList(new String[] {"LiteralInteger 1"}, instance.eval("Test(1)", "InvocationTest")); + assertList(new String[] {"LiteralInteger 2"}, instance.eval("Test(null, 2)", "InvocationTest")); } @Test @@ -419,7 +421,7 @@ public void testNumericalFunctionEvaluation() throws Exception { assertElement("LiteralInteger 6", instance.eval("NumericalFunctions::sum((1,2,3))", null)); assertElement("LiteralInteger 6", instance.eval("NumericalFunctions::product((1,2,3))", null)); } - + @Test public void testSequenceFunctionEvaluation() throws Exception { SysMLInteractive instance = getSysMLInteractiveInstance(); @@ -565,4 +567,31 @@ public void testControlFunctionEvaluation() throws Exception { assertList(new String[] {"LiteralInteger 2"}, instance.eval("(1,2,3)->ControlFunctions::minimize{in x : ScalarValues::Integer; x * 2}", null)); assertList(new String[] {}, instance.eval("()->ControlFunctions::minimize{in x : ScalarValues::Integer; x * 2}", null)); } + + @Test + public void testTrigFunctionEvaluation() throws Exception { + SysMLInteractive instance = getSysMLInteractiveInstance(); + assertElement("LiteralRational " + Math.sin(2), instance.eval("TrigFunctions::sin(2)", null)); + assertElement("LiteralRational " + Math.sin(2.5), instance.eval("TrigFunctions::sin(2.5)", null)); + assertElement("LiteralRational " + Math.cos(2), instance.eval("TrigFunctions::cos(2)", null)); + assertElement("LiteralRational " + Math.cos(2.5), instance.eval("TrigFunctions::cos(2.5)", null)); + assertElement("LiteralRational " + Math.tan(2), instance.eval("TrigFunctions::tan(2)", null)); + assertElement("LiteralRational " + Math.tan(2.5), instance.eval("TrigFunctions::tan(2.5)", null)); + assertElement("LiteralRational " + 1.0/Math.tan(2), instance.eval("TrigFunctions::cot(2)", null)); + assertElement("LiteralRational " + 1.0/Math.tan(2.5), instance.eval("TrigFunctions::cot(2.5)", null)); + assertElement("LiteralRational " + Math.asin(0), instance.eval("TrigFunctions::arcsin(0)", null)); + assertElement("LiteralRational " + Math.asin(0.5), instance.eval("TrigFunctions::arcsin(0.5)", null)); + assertElement("LiteralRational " + Math.acos(0), instance.eval("TrigFunctions::arccos(0)", null)); + assertElement("LiteralRational " + Math.acos(0.5), instance.eval("TrigFunctions::arccos(0.5)", null)); + assertElement("LiteralRational " + Math.atan(10), instance.eval("TrigFunctions::arctan(10)", null)); + assertElement("LiteralRational " + Math.atan(10.5), instance.eval("TrigFunctions::arctan(10.5)", null)); + assertElement("LiteralRational " + Math.toDegrees(2), instance.eval("TrigFunctions::deg(2)", null)); + assertElement("LiteralRational " + Math.toDegrees(2.5), instance.eval("TrigFunctions::deg(2.5)", null)); + assertElement("LiteralRational " + Math.toRadians(90), instance.eval("TrigFunctions::rad(90)", null)); + assertElement("LiteralRational " + Math.toRadians(90.5), instance.eval("TrigFunctions::rad(90.5)", null)); + + assertElement("LiteralRational " + 90.0, instance.eval("TrigFunctions::deg(TrigFunctions::pi/2)", null)); + assertElement("LiteralRational " + Math.PI/2, instance.eval("TrigFunctions::rad(90)", null)); + } + } diff --git a/org.omg.sysml.interactive.tests/src/org/omg/sysml/interactive/tests/ModelLevelEvaluationTest.java b/org.omg.sysml.interactive.tests/src/org/omg/sysml/interactive/tests/ModelLevelEvaluationTest.java index 4ef55d79f..91f15eea4 100644 --- a/org.omg.sysml.interactive.tests/src/org/omg/sysml/interactive/tests/ModelLevelEvaluationTest.java +++ b/org.omg.sysml.interactive.tests/src/org/omg/sysml/interactive/tests/ModelLevelEvaluationTest.java @@ -57,7 +57,7 @@ protected Expression checkFilterExpression(SysMLInteractive instance, String tex assertFalse("'" + text + "': No filter conditions", filterConditions.isEmpty()); Expression filterCondition = filterConditions.get(0); assertTrue("'" + text + "': Not operator expression", filterCondition instanceof OperatorExpression); - List operands = ((OperatorExpression)filterCondition).getOperand(); + List operands = ((OperatorExpression)filterCondition).getArgument(); assertFalse("'" + text + "': No operands", operands.isEmpty()); return operands.get(0); } @@ -489,5 +489,10 @@ public void testMetadataAccess() throws Exception { assertEquals(1, evaluateIntegerValue(instance, null, "(P.metadata as M1).a")); assertEquals(1, evaluateIntegerValue(instance, null, "(P meta M1).a")); } + + @Test + public void testLibraryFeatureReference() throws Exception { + assertEquals(Math.PI, evaluateRealValue(null, null, "TrigFunctions::pi"), 0); + } } diff --git a/org.omg.sysml.interactive.tests/src/org/omg/sysml/semantics/tests/SysMLBinaryRelationTest.java b/org.omg.sysml.interactive.tests/src/org/omg/sysml/semantics/tests/SysMLBinaryRelationTest.java index 691e3cd28..fba3de635 100644 --- a/org.omg.sysml.interactive.tests/src/org/omg/sysml/semantics/tests/SysMLBinaryRelationTest.java +++ b/org.omg.sysml.interactive.tests/src/org/omg/sysml/semantics/tests/SysMLBinaryRelationTest.java @@ -1,6 +1,6 @@ /** * SysML 2 Pilot Implementation - * Copyright (C) 2024,2025 Model Driven Solutions, Inc. + * Copyright (C) 2024-2026 Model Driven Solutions, Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -132,7 +132,8 @@ public void checkSuccessionFlowUsageSpecialization() { public static void addEndTo(Type type) { var end = SysMLFactory.eINSTANCE.createFeature(); - var endMembership = SysMLFactory.eINSTANCE.createEndFeatureMembership(); + end.setIsEnd(true); + var endMembership = SysMLFactory.eINSTANCE.createFeatureMembership(); endMembership.setOwnedMemberFeature(end); type.getOwnedRelationship().add(endMembership); } diff --git a/org.omg.sysml.interactive.tests/src/org/omg/sysml/semantics/tests/SysMLImpliedRelationsTest.java b/org.omg.sysml.interactive.tests/src/org/omg/sysml/semantics/tests/SysMLImpliedRelationsTest.java index a617e93e1..db4d0d92d 100644 --- a/org.omg.sysml.interactive.tests/src/org/omg/sysml/semantics/tests/SysMLImpliedRelationsTest.java +++ b/org.omg.sysml.interactive.tests/src/org/omg/sysml/semantics/tests/SysMLImpliedRelationsTest.java @@ -1,6 +1,6 @@ /** * SysML 2 Pilot Implementation - * Copyright (C) 2024, 2025 Model Driven Solutions, Inc. + * Copyright (C) 2024-2026 Model Driven Solutions, Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -27,7 +27,6 @@ import org.junit.Ignore; import org.junit.Test; import org.omg.sysml.lang.sysml.FeatureDirectionKind; -import org.omg.sysml.lang.sysml.ParameterMembership; import org.omg.sysml.lang.sysml.StateSubactionKind; import org.omg.sysml.lang.sysml.SysMLFactory; import org.omg.sysml.util.ElementUtil; @@ -104,10 +103,7 @@ public void checkAssignmentActionUsageAccessedFeatureRedefinition() { var targetParam = SysMLFactory.eINSTANCE.createFeature(); targetParam.setDirection(FeatureDirectionKind.IN); - - ParameterMembership parameterMembership = SysMLFactory.eINSTANCE.createParameterMembership(); - assignment.getOwnedRelationship().add(parameterMembership); - parameterMembership.setOwnedMemberParameter(targetParam); + TypeUtil.addOwnedFeatureTo(assignment, targetParam); var firstOfTarget = SysMLFactory.eINSTANCE.createFeature(); TypeUtil.addOwnedFeatureTo(targetParam, firstOfTarget); @@ -136,10 +132,7 @@ public void checkAssignmentActionUsageReferentRedefinition() { var targetParam = SysMLFactory.eINSTANCE.createFeature(); targetParam.setDirection(FeatureDirectionKind.IN); - - ParameterMembership parameterMembership = SysMLFactory.eINSTANCE.createParameterMembership(); - assignment.getOwnedRelationship().add(parameterMembership); - parameterMembership.setOwnedMemberParameter(targetParam); + TypeUtil.addOwnedFeatureTo(assignment, targetParam); var firstOfTarget = SysMLFactory.eINSTANCE.createFeature(); TypeUtil.addOwnedFeatureTo(targetParam, firstOfTarget); @@ -163,10 +156,7 @@ public void checkAssignmentActionUsageStartingAtRedefinition() { var targetParam = SysMLFactory.eINSTANCE.createFeature(); targetParam.setDirection(FeatureDirectionKind.IN); - - ParameterMembership parameterMembership = SysMLFactory.eINSTANCE.createParameterMembership(); - assignment.getOwnedRelationship().add(parameterMembership); - parameterMembership.setOwnedMemberParameter(targetParam); + TypeUtil.addOwnedFeatureTo(assignment, targetParam); var firstOfTarget = SysMLFactory.eINSTANCE.createFeature(); TypeUtil.addOwnedFeatureTo(targetParam, firstOfTarget); diff --git a/org.omg.sysml.interactive/META-INF/MANIFEST.MF b/org.omg.sysml.interactive/META-INF/MANIFEST.MF index 89b804101..59da9a3de 100644 --- a/org.omg.sysml.interactive/META-INF/MANIFEST.MF +++ b/org.omg.sysml.interactive/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: org.omg.sysml.interactive Bundle-RequiredExecutionEnvironment: JavaSE-21 Bundle-SymbolicName: org.omg.sysml.interactive -Bundle-Version: 0.56.0.qualifier +Bundle-Version: 0.57.0.qualifier Export-Package: org.omg.sysml.interactive Require-Bundle: org.eclipse.emf.ecore, com.google.inject, diff --git a/org.omg.sysml.jupyter.jupyterlab/.classpath b/org.omg.sysml.jupyter.jupyterlab/.classpath index fe279107c..64cdcfd19 100644 --- a/org.omg.sysml.jupyter.jupyterlab/.classpath +++ b/org.omg.sysml.jupyter.jupyterlab/.classpath @@ -1,33 +1,8 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/org.omg.sysml.jupyter.jupyterlab/package.json b/org.omg.sysml.jupyter.jupyterlab/package.json index 2e01b4eea..63867067c 100644 --- a/org.omg.sysml.jupyter.jupyterlab/package.json +++ b/org.omg.sysml.jupyter.jupyterlab/package.json @@ -1,6 +1,6 @@ { "name": "@systems-modeling/jupyterlab-sysml", - "version": "0.56.0-SNAPSHOT", + "version": "0.57.0-SNAPSHOT", "description": "A JupyterLab extension for system modeling using SysML", "repository": "github:Systems-Modeling/SysML-v2-Pilot-Implementation", "author": "SysML v2 Submission Team", diff --git a/org.omg.sysml.plantuml.eclipse/META-INF/MANIFEST.MF b/org.omg.sysml.plantuml.eclipse/META-INF/MANIFEST.MF index 56ef16121..bc8105b0e 100644 --- a/org.omg.sysml.plantuml.eclipse/META-INF/MANIFEST.MF +++ b/org.omg.sysml.plantuml.eclipse/META-INF/MANIFEST.MF @@ -4,7 +4,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: SysML 2 PlantUML visualization for Eclipse Bundle-RequiredExecutionEnvironment: JavaSE-21 Bundle-SymbolicName: org.omg.sysml.plantuml.eclipse;singleton:=true -Bundle-Version: 0.56.0.qualifier +Bundle-Version: 0.57.0.qualifier Import-Package: net.sourceforge.plantuml.eclipse.utils;version="1.1.25.himi1", net.sourceforge.plantuml.ecore, net.sourceforge.plantuml.text, diff --git a/org.omg.sysml.plantuml.feature/feature.xml b/org.omg.sysml.plantuml.feature/feature.xml index 0ecb4a99c..e8db6bccc 100644 --- a/org.omg.sysml.plantuml.feature/feature.xml +++ b/org.omg.sysml.plantuml.feature/feature.xml @@ -2,7 +2,7 @@ diff --git a/org.omg.sysml.plantuml/META-INF/MANIFEST.MF b/org.omg.sysml.plantuml/META-INF/MANIFEST.MF index d198085fe..5dfd046ae 100644 --- a/org.omg.sysml.plantuml/META-INF/MANIFEST.MF +++ b/org.omg.sysml.plantuml/META-INF/MANIFEST.MF @@ -4,7 +4,7 @@ Bundle-Name: SysML 2 PlantUML visualization Bundle-RequiredExecutionEnvironment: JavaSE-21 Bundle-SymbolicName: org.omg.sysml.plantuml Automatic-Module-Name: org.omg.sysml.plantuml -Bundle-Version: 0.56.0.qualifier +Bundle-Version: 0.57.0.qualifier Export-Package: org.omg.sysml.plantuml Import-Package: com.google.common.collect, com.google.inject;version="1.3.0", diff --git a/org.omg.sysml.plantuml/src/org/omg/sysml/plantuml/VPath.java b/org.omg.sysml.plantuml/src/org/omg/sysml/plantuml/VPath.java index 296f4ba39..c367bee0b 100644 --- a/org.omg.sysml.plantuml/src/org/omg/sysml/plantuml/VPath.java +++ b/org.omg.sysml.plantuml/src/org/omg/sysml/plantuml/VPath.java @@ -1,6 +1,6 @@ /***************************************************************************** * SysML 2 Pilot Implementation, PlantUML Visualization - * Copyright (c) 2020-2024 Mgnite Inc. + * Copyright (c) 2020-2026 Mgnite Inc. * Copyright (c) 2022 Model Driven Solutions, Inc. * * This program is free software: you can redistribute it and/or modify @@ -170,7 +170,7 @@ private class PCFeatureChainExpression extends PC { private final FeatureChainExpression fce; private Expression getTargetExp() { - List ops = fce.getOperand(); + List ops = fce.getArgument(); if (ops.isEmpty()) { return null; } else { @@ -327,29 +327,38 @@ public PCTerminal(PC prev) { // Make an InheritKey for ref, which is either a connector end or FeatureReferenceExpression or FeatureChainExpression. // These are (indirectly) owned by the innermost feature, which effectively determines the target scope. - private InheritKey makeInheritKeyForReferer(PC pc) { + private RefPC makeRefPCForReferer(PC pc) { if (pc == null) return null; Element e = pc.getTarget(); if (!(e instanceof Feature)) return null; Feature ref = (Feature) e; - Namespace ns = getCurrentNamespace(); + Namespace ns = getCurrentNamespace(); // the namespace owning a connector if (!(ns instanceof Type)) return null; if (ns instanceof Feature) { - Feature tgt = (Feature) ns; - InheritKey ik = makeInheritKey(tgt); + //Feature tgt = (Feature) ns; + InheritKey ik = makeInheritKey(ref); if (ik != null) { // Make the inherit key indirect in order to refer to redefined targets as well as inherited ones. ik = InheritKey.makeIndirect(ik); - ik = InheritKey.findTop(ik, ref); - if (ik != null) return ik; + InheritKey ik2 = InheritKey.findTop(ik, ref); + if (ik2 != null) { + // This is overspecifying case. + return createRefPC(ik2, pc); + } + // This is underspecifying case and we need to add a PCNamespace to capture ns/tgt + PCNamespace pcn = new PCNamespace(ns, pc); + return createRefPC(ik, pcn); } } // In case that tgt inherits ref, we need to make an InheritKey for tgt. - Type tgt = (Type) ns; - return InheritKey.makeTargetKey(tgt, ref); + { + Type tgt = (Type) ns; + InheritKey ik = InheritKey.makeTargetKey(tgt, ref); + return createRefPC(ik, pc); + } } @@ -359,27 +368,36 @@ private InheritKey makeInheritKeyForReferer(PC pc) { iff : Feature :>> ioTarget: ReferenceUsage; } */ + + private static Feature getRootRedefinedFeature(Feature f) { + for (Redefinition rd: f.getOwnedRedefinition()) { + Feature rf = rd.getRedefinedFeature(); + Feature rrf = getRootRedefinedFeature(rf); + if (rrf == null) return rf; + return rrf; + } + return null; + } + private static Feature getIOTarget(FlowEnd ife) { for (FeatureMembership fm: toOwnedFeatureMembershipArray(ife)) { Feature f = fm.getOwnedMemberFeature(); - for (Redefinition rd: f.getOwnedRedefinition()) { - return rd.getRedefinedFeature(); - } + return getRootRedefinedFeature(f); } return null; } - private class PCItemFlowEnd extends PC { + private class PCFlowEnd extends PC { private final Feature ioTarget; private final PC basePC; - public PCItemFlowEnd(FlowEnd ife, PC basePC, Feature ioTarget) { + public PCFlowEnd(FlowEnd ife, PC basePC, Feature ioTarget) { super(ife, false); this.basePC = basePC; this.ioTarget = ioTarget; } - private PCItemFlowEnd(PCItemFlowEnd prev, PC basePC) { + private PCFlowEnd(PCFlowEnd prev, PC basePC) { super(prev); this.basePC = basePC; this.ioTarget = prev.ioTarget; @@ -406,12 +424,12 @@ protected PC getNext() { if (basePC == null) return new PCTerminal(this); PC ret = basePC.getNext(); if (!ret.isTerminal()) { - return new PCItemFlowEnd(this, ret); + return new PCFlowEnd(this, ret); } if (ioTarget == null) { return new PCTerminal(this); } else { - return new PCItemFlowEnd(this, null); + return new PCFlowEnd(this, null); } } } @@ -447,6 +465,37 @@ protected Element getTarget() { } } + private class PCNamespace extends PC { + public final Namespace ns; + private final PC pc; + + @Override + protected PC getNext() { + return pc; + } + + @Override + public PC enter(Namespace ns) { + if (ns.equals(this.ns)) { + return pc; + } else { + return this; + } + } + + public PCNamespace(Namespace ns, PC pc) { + super((Element) null, true); + this.ns = ns; + this.pc = pc; + pc.setPrev(this); + } + + @Override + protected Element getTarget() { + return null; + } + } + private class RefPC { private PC pc; private final InheritKey ik; @@ -542,28 +591,25 @@ private String addContextForFeature(Feature f, boolean isRedefinition) { private String addContextForEnd(Feature f) { if (f instanceof FlowEnd) { - return addContextForItemFlowEnd((FlowEnd) f); + return addContextForFlowEnd((FlowEnd) f); } PC pc = makeEndFeaturePC(f); - InheritKey ik = makeInheritKeyForReferer(pc); - if (createRefPC(ik, pc) == null) return null; + if (makeRefPCForReferer(pc) == null) return null; return ""; } - private String addContextForItemFlowEnd(FlowEnd ife) { + private String addContextForFlowEnd(FlowEnd ife) { PC pc = makeEndFeaturePC(ife); if (pc == null) return null; Feature ioTarget = getIOTarget(ife); - pc = new PCItemFlowEnd(ife, pc, ioTarget); - InheritKey ik = makeInheritKeyForReferer(pc); - if (createRefPC(ik, pc) == null) return null; + pc = new PCFlowEnd(ife, pc, ioTarget); + if (makeRefPCForReferer(pc) == null) return null; return ""; } private String addContextForFeatureChainExpression(FeatureChainExpression fce) { PC pc = new PCFeatureChainExpression(fce); - InheritKey ik = makeInheritKeyForReferer(pc); - createRefPC(ik, pc); + makeRefPCForReferer(pc); return ""; } @@ -571,8 +617,7 @@ private String addContextForFeatureReferenceExpression(FeatureReferenceExpressio Feature f = fre.getReferent(); if (f == null) return ""; PC pc = new PCFeature(fre, f, false); - InheritKey ik = makeInheritKeyForReferer(pc); - createRefPC(ik, pc); + makeRefPCForReferer(pc); return ""; } @@ -666,7 +711,7 @@ public String caseFeatureReferenceExpression(FeatureReferenceExpression fre) { @Override public String caseFlowEnd(FlowEnd ife) { - return addContextForItemFlowEnd(ife); + return addContextForFlowEnd(ife); } @Override diff --git a/org.omg.sysml.plantuml/src/org/omg/sysml/plantuml/VSequence.java b/org.omg.sysml.plantuml/src/org/omg/sysml/plantuml/VSequence.java index 2b84e01b0..afdc29c29 100644 --- a/org.omg.sysml.plantuml/src/org/omg/sysml/plantuml/VSequence.java +++ b/org.omg.sysml.plantuml/src/org/omg/sysml/plantuml/VSequence.java @@ -110,7 +110,7 @@ private static boolean isTarget(Feature f) { } private Element next(FeatureChainExpression fce, boolean first) { - List ops = fce.getOperand(); + List ops = fce.getArgument(); int size = ops.size(); if (size == 0) return null; Expression ex = ops.get(0); diff --git a/org.omg.sysml.site/README.adoc b/org.omg.sysml.site/README.adoc index 796feff52..8c8bbac1c 100644 --- a/org.omg.sysml.site/README.adoc +++ b/org.omg.sysml.site/README.adoc @@ -1,8 +1,8 @@ = SysML v2 Release Eclipse Installation -*Requirements:* Eclipse 2025-03 (4.35), with Java Development Kit +*Requirements:* Eclipse 2025-12 (4.38), with Java Development Kit -(*Note:* The release may work on later versions of Eclipse, but it has only been tested on 2025-03.) +(*Note:* The release may work on later versions of Eclipse, but it has only been tested on 2025-12.) == Installing the plugins diff --git a/org.omg.sysml.target/org.omg.sysml.target.target b/org.omg.sysml.target/org.omg.sysml.target.target index 32f0520b1..3ebd2b0f1 100644 --- a/org.omg.sysml.target/org.omg.sysml.target.target +++ b/org.omg.sysml.target/org.omg.sysml.target.target @@ -1,17 +1,17 @@ - + - - - - - + + + + + - - - + + + diff --git a/org.omg.sysml.uml.ecore.importer/src/org/omg/sysml/uml/ecore/importer/CustomUML2EcoreConverter.java b/org.omg.sysml.uml.ecore.importer/src/org/omg/sysml/uml/ecore/importer/CustomUML2EcoreConverter.java index afc438edd..70a94f94f 100644 --- a/org.omg.sysml.uml.ecore.importer/src/org/omg/sysml/uml/ecore/importer/CustomUML2EcoreConverter.java +++ b/org.omg.sysml.uml.ecore.importer/src/org/omg/sysml/uml/ecore/importer/CustomUML2EcoreConverter.java @@ -6,6 +6,7 @@ import org.eclipse.emf.common.util.DiagnosticChain; import org.eclipse.emf.ecore.EAnnotation; +import org.eclipse.emf.ecore.EAttribute; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EClassifier; import org.eclipse.emf.ecore.EModelElement; @@ -42,27 +43,45 @@ private void customConvert(DiagnosticChain diagnostics) { for (Entry entry : elementToEModelElementMap.entrySet()) { Element element = entry.getKey(); EModelElement modelElement = entry.getValue(); - if (element instanceof Property && ((Property)element).isDerived() && !((Property)element).isDerivedUnion() && modelElement instanceof EStructuralFeature || + if (element instanceof Property && modelElement instanceof EStructuralFeature && + (((Property)element).isDerived() && !((Property)element).isDerivedUnion() || + "elementId".equals(((Property)element).getName())) || element instanceof Operation && modelElement instanceof EOperation) { + // Add SysML EAnnotation to derived properties (but not derived unions) and all operations String qualifiedName = ((NamedElement)element).getQualifiedName(); - System.out.println("Add annotation: " + qualifiedName.substring(qualifiedName.indexOf("::") + 2)); - EAnnotation annotation = EcoreFactory.eINSTANCE.createEAnnotation(); - annotation.setSource(ANNOTATION_SYSML); - modelElement.getEAnnotations().add(annotation); + addSysMLAnnotation(qualifiedName.substring(qualifiedName.indexOf("::") + 2), modelElement); + if (element instanceof Property && "elementId".equals(((Property)element).getName())) { + // Since elementId is to be treated as effectively derived, don't use it as an ID + // internally to Eclipse. + ((EAttribute)modelElement).setID(false); + } } else if (element instanceof org.eclipse.uml2.uml.Class && modelElement instanceof EClass) { String name = ((org.eclipse.uml2.uml.Class)element).getName(); EClass eClass = (EClass)modelElement; if ("Feature".equals(name)) { + // Add the "isNonunique" attribute as the effective logical inverse of "isUnique". EClassifier booleanType = eClass.getEStructuralFeature("isUnique").getEType(); - addStructuralFeature(eClass, EcoreFactory.eINSTANCE.createEAttribute(), "isNonunique", booleanType, 1, 1, "false", false); + EAttribute isNonUniqueAttribute = EcoreFactory.eINSTANCE.createEAttribute(); + addStructuralFeature(eClass, isNonUniqueAttribute, "isNonunique", booleanType, 1, 1, "false", false); + addSysMLAnnotation("Feature::isNonUnique", isNonUniqueAttribute); } else if ("InvocationExpression".equals(name)) { + // Add the "operand" reference as a workaround for parsing operator expression arguments. EClassifier expressionClass = eClass.getEStructuralFeature("argument").getEType(); - addStructuralFeature(eClass, EcoreFactory.eINSTANCE.createEReference(), "operand", expressionClass, 0, -1, null, true); + EReference operandReference = EcoreFactory.eINSTANCE.createEReference(); + addStructuralFeature(eClass, operandReference, "operand", expressionClass, 0, -1, null, true); + addSysMLAnnotation("InvocationExpression::operand", operandReference); } } } } + private void addSysMLAnnotation(String qualifiedName, EModelElement modelElement) { + System.out.println("Add annotation: " + qualifiedName); + EAnnotation annotation = EcoreFactory.eINSTANCE.createEAnnotation(); + annotation.setSource(ANNOTATION_SYSML); + modelElement.getEAnnotations().add(annotation); + } + private void addStructuralFeature(EClass eClass, EStructuralFeature feature, String name, EClassifier type, int lower, int upper, String defaultValue, boolean isContainment) { System.out.println("Add feature: " + eClass.getName() + "::" + name + ": " + (type == null? "": type.getName())); feature.setName(name); diff --git a/org.omg.sysml.xpect.tests/META-INF/MANIFEST.MF b/org.omg.sysml.xpect.tests/META-INF/MANIFEST.MF index fa1bb9abb..7fdd3399a 100644 --- a/org.omg.sysml.xpect.tests/META-INF/MANIFEST.MF +++ b/org.omg.sysml.xpect.tests/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: org.omg.sysml.xpect.tests Bundle-RequiredExecutionEnvironment: JavaSE-21 Bundle-SymbolicName: org.omg.sysml.xpect.tests;singleton:=true -Bundle-Version: 0.56.0.qualifier +Bundle-Version: 0.57.0.qualifier Require-Bundle: org.eclipse.core.runtime, org.eclipse.xpect.xtext.lib;bundle-version="0.3.0", org.eclipse.xpect.xtext.xbase.lib;bundle-version="[0.3.0,0.4.0)", diff --git a/org.omg.sysml.xpect.tests/src/org/omg/sysml/xpect/tests/validation/invalid/PortUsage_Invalid.sysml.xt b/org.omg.sysml.xpect.tests/src/org/omg/sysml/xpect/tests/validation/invalid/PortUsage_Invalid.sysml.xt index c157f4aba..5523f4642 100644 --- a/org.omg.sysml.xpect.tests/src/org/omg/sysml/xpect/tests/validation/invalid/PortUsage_Invalid.sysml.xt +++ b/org.omg.sysml.xpect.tests/src/org/omg/sysml/xpect/tests/validation/invalid/PortUsage_Invalid.sysml.xt @@ -47,7 +47,7 @@ package 'Port Example' { port two_port_def_types: pd1, pd2 { port p2 : pd2; ref b3 : B; - // XPECT errors --> "Nested usages of a port usage (other than ports) must be referential." at "part b4 : B;" + // XPECT errors --> "Nested usages in a port usage (other than ports) must be referential." at "part b4 : B;" part b4 : B; } } diff --git a/org.omg.sysml.xpect.tests/src/org/omg/sysml/xpect/tests/validation/invalid/Relationship_invalid_relatedElement1.sysml.xt b/org.omg.sysml.xpect.tests/src/org/omg/sysml/xpect/tests/validation/invalid/Relationship_invalid_relatedElement1.sysml.xt index c819de186..032807a12 100644 --- a/org.omg.sysml.xpect.tests/src/org/omg/sysml/xpect/tests/validation/invalid/Relationship_invalid_relatedElement1.sysml.xt +++ b/org.omg.sysml.xpect.tests/src/org/omg/sysml/xpect/tests/validation/invalid/Relationship_invalid_relatedElement1.sysml.xt @@ -49,6 +49,7 @@ package 'Streaming Example' { "Cannot identify flow end (use dot notation)" at "C::myIn" "Must be an accessible feature (use dot notation for nesting)" at "B::myOut" "Must be an accessible feature (use dot notation for nesting)" at "C::myIn" + "Must have at least two related elements" at "flow XXX from B::myOut to C::myIn;" --- */ flow XXX from B::myOut to C::myIn; } diff --git a/org.omg.sysml.xtext.ide/META-INF/MANIFEST.MF b/org.omg.sysml.xtext.ide/META-INF/MANIFEST.MF index b39ee8a93..19ae420d7 100644 --- a/org.omg.sysml.xtext.ide/META-INF/MANIFEST.MF +++ b/org.omg.sysml.xtext.ide/META-INF/MANIFEST.MF @@ -4,7 +4,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: org.omg.sysml.xtext.ide Bundle-RequiredExecutionEnvironment: JavaSE-21 Bundle-Vendor: SysML v2 Submission Team -Bundle-Version: 0.56.0.qualifier +Bundle-Version: 0.57.0.qualifier Bundle-SymbolicName: org.omg.sysml.xtext.ide; singleton:=true Bundle-ActivationPolicy: lazy Require-Bundle: org.omg.sysml.xtext, diff --git a/org.omg.sysml.xtext.ui/META-INF/MANIFEST.MF b/org.omg.sysml.xtext.ui/META-INF/MANIFEST.MF index e86e2f029..93cea1434 100644 --- a/org.omg.sysml.xtext.ui/META-INF/MANIFEST.MF +++ b/org.omg.sysml.xtext.ui/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Automatic-Module-Name: org.omg.sysml.xtext.ui Bundle-ManifestVersion: 2 Bundle-Name: org.omg.sysml.xtext.ui Bundle-RequiredExecutionEnvironment: JavaSE-21 -Bundle-Version: 0.56.0.qualifier +Bundle-Version: 0.57.0.qualifier Bundle-SymbolicName: org.omg.sysml.xtext.ui; singleton:=true Bundle-ActivationPolicy: lazy Require-Bundle: org.omg.sysml;bundle-version="0.2.0", diff --git a/org.omg.sysml.xtext/META-INF/MANIFEST.MF b/org.omg.sysml.xtext/META-INF/MANIFEST.MF index 2ba89b923..9f17be0d8 100644 --- a/org.omg.sysml.xtext/META-INF/MANIFEST.MF +++ b/org.omg.sysml.xtext/META-INF/MANIFEST.MF @@ -4,7 +4,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: org.omg.sysml.xtext Bundle-RequiredExecutionEnvironment: JavaSE-21 Bundle-Vendor: SysML v2 Submission Team -Bundle-Version: 0.56.0.qualifier +Bundle-Version: 0.57.0.qualifier Bundle-SymbolicName: org.omg.sysml.xtext; singleton:=true Bundle-ActivationPolicy: lazy Require-Bundle: org.eclipse.xtext, diff --git a/org.omg.sysml.xtext/src/org/omg/sysml/xtext/validation/SysMLValidator.xtend b/org.omg.sysml.xtext/src/org/omg/sysml/xtext/validation/SysMLValidator.xtend index 5a9e87dfd..76f9f9c49 100644 --- a/org.omg.sysml.xtext/src/org/omg/sysml/xtext/validation/SysMLValidator.xtend +++ b/org.omg.sysml.xtext/src/org/omg/sysml/xtext/validation/SysMLValidator.xtend @@ -1,7 +1,7 @@ /***************************************************************************** * SysML 2 Pilot Implementation * Copyright (c) 2020 California Institute of Technology/Jet Propulsion Laboratory - * Copyright (c) 2020-2025 Model Driven Solutions, Inc. + * Copyright (c) 2020-2026 Model Driven Solutions, Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -148,6 +148,10 @@ class SysMLValidator extends KerMLValidator { public static val INVALID_USAGE_TYPE = "validateUsageType_" public static val INVALID_USAGE_TYPE_MSG = "A usage must be typed by definitions." + public static val INVALID_USAGE_IS_REFERENTIAL = "validateUsageIsReferential" + public static val INVALID_USAGE_IS_REFERENTIAL_MSG_1 = "A directed usage must be referential." + public static val INVALID_USAGE_IS_REFERENTIAL_MSG_2 = "An end usage must be referential." + public static val INVALID_USAGE_IS_REFERENTIAL_MSG_3 = "A package-lebel usage must be referential." public static val INVALID_USAGE_VARIATION_IS_ABSTRACT = "validateUsageVariationIsAbstract" public static val INVALID_USAGE_VARIATION_IS_ABSTRACT_MSG = "A variation must be abstract." public static val INVALID_USAGE_VARIATION_MEMBERSHIP = "validateUsageVariationMembership" @@ -158,6 +162,9 @@ class SysMLValidator extends KerMLValidator { public static val INVALID_VARIANT_MEMBERSHIP_OWNING_NAMESPACE = "validateVariationMembershipOwningNamespace" public static val INVALID_VARIANT_MEMBERSHIP_OWNING_NAMESPACE_MSG = "A variant must be an owned member of a variation." + public static val INVALID_REFERENCE_USAGE_IS_REFERENCE = "validateReferenceUsageIsReference" + public static val INVALID_REFERENCE_USAGE_IS_REFERENCE_MSG = "An attribute usage must be referential." + public static val INVALID_ATTRIBUTE_DEFINITION_FEATURES = "validateAttributeDefinitionFeatures" public static val INVALID_ATTRIBUTE_DEFINITION_FEATURES_MSG = "Features of an attribute definition must be referential." public static val INVALID_ATTRIBUTE_DEFINITION_SPECIALIZATION = "validateDataTypeSpecialization" @@ -165,14 +172,24 @@ class SysMLValidator extends KerMLValidator { public static val INVALID_ATTRIBUTE_USAGE_FEATURES = "validateAttributeUsageFeatures" public static val INVALID_ATTRIBUTE_USAGE_FEATURES_MSG = "Features of an attribute usage must be referential." + public static val INVALID_ATTRIBUTE_USAGE_IS_REFERENTIAL = "validateAttributeUsageIsReferential" + public static val INVALID_ATTRIBUTE_USAGE_IS_REFERENTIAL_MSG = "An attribute usage must be referential." public static val INVALID_ATTRIBUTE_USAGE_TYPE = "validateAttributeUsageType_" public static val INVALID_ATTRIBUTE_USAGE_MSG = "An attribute must be typed by attribute definitions." public static val INVALID_ATTRIBUTE_USAGE_ENUMERATION_TYPE = "validateAttributeUsageEnumerationType_" public static val INVALID_ATTRIBUTE_USAGE_ENUMERATION_TYPE_MSG = "An enumeration attribute cannot have more than one type." + public static val INVALID_ENUMERATION_DEFINITION_IS_VARIATION = "validateEnumerationDefinitionIsVariation" + public static val INVALID_ENUMERATION_DEFINITION_IS_VARIATION_MSG = "An enumeration definition must be a variation." + public static val INVALID_ENUMERATION_USAGE_TYPE = "validateEnumerationUsageType_" public static val INVALID_ENUMERATION_USAGE_TYPE_MSG = "An enumeration must be typed by one enumeration definition." + public static val INVALID_EVENT_OCCURRENCE_USAGE_IS_REFERENCE = "validateEventOccurrenceUsageIsReference" + public static val INVALID_EVENT_OCCURRENCE_USAGE_IS_REFERENCE_MSG_0 = "An event occurrence usage must be referential." + public static val INVALID_EVENT_OCCURRENCE_USAGE_IS_REFERENCE_MSG_1 = "An exhibit state usage must be referential." + public static val INVALID_EVENT_OCCURRENCE_USAGE_IS_REFERENCE_MSG_2 = "An include use case usage must be referential." + public static val INVALID_EVENT_OCCURRENCE_USAGE_IS_REFERENCE_MSG_3 = "A perform action usage must be referential." public static val INVALID_EVENT_OCCURRENCE_USAGE_REFERENCE = "validateEventOccurrenceUsageReferent" public static val INVALID_EVENT_OCCURRENCE_USAGE_REFERENCE_MSG = "Must reference an occurrence." @@ -210,8 +227,10 @@ class SysMLValidator extends KerMLValidator { public static val INVALID_PORT_USAGE_TYPE = "validatePortUsageType_" public static val INVALID_PORT_USAGE_TYPE_MSG = "A port must be typed by port definitions." + public static val INVALID_PORT_USAGE_IS_REFERENCE = "validatePortUsageIsReference" + public static val INVALID_PORT_USAGE_IS_REFERENCE_MSG = "A port usage must be referential." public static val INVALID_PORT_USAGE_NESTED_USAGES_NOT_COMPOSITE = "validatePortUsageNestedUsagesNotComposite" - public static val INVALID_PORT_USAGE_NESTED_USAGES_NOT_COMPOSITE_MSG = "Nested usages of a port usage (other than ports) must be referential." + public static val INVALID_PORT_USAGE_NESTED_USAGES_NOT_COMPOSITE_MSG = "Nested usages in a port usage (other than ports) must be referential." public static val INVALID_CONNECTION_USAGE_TYPE = "validateConnectionUsageType_" public static val INVALID_CONNECTION_USAGE_TYPE_MSG = "A connection must be typed by connection definitions." @@ -420,8 +439,8 @@ class SysMLValidator extends KerMLValidator { public static val INVALID_EXPOSE_IS_IMPORT_ALL = "validateExposeIsImportAll" public static val INVALID_EXPOSE_IS_IMPORT_ALL_MSG = "An expose must import all." - public static val INVALID_EXPOSE_IS_OWNING_NAMESPACE = "validateExposeIsImportAll" - public static val INVALID_EXPOSE_IS_OWNING_NAMESPACE_MSG = "Only view usages can expose elements." + public static val INVALID_EXPOSE_OWNING_NAMESPACE = "validateExposeOwningNamespace" + public static val INVALID_EXPOSE_OWNING_NAMESPACE_MSG = "Only view usages can expose elements." public static val INVALID_RENDERING_USAGE_TYPE = "validateRenderingUsageType_" public static val INVALID_RENDERING_USAGE_TYPE_MSG = "A rendering must be typed by one rendering definition." @@ -451,11 +470,7 @@ class SysMLValidator extends KerMLValidator { if (definition.isVariation) { // validateDefinitionVariationOwnedFeatureMembership for (mem: definition.ownedFeatureMembership) { - // NOTE: Need to allow parameters and objectives because they are currently physically inserted by transform implementation. - // TODO: Add allowance of parameters and objectives in variations to spec? Or remove when possible? - if (!(mem instanceof ParameterMembership || mem instanceof ObjectiveMembership)) { - error(INVALID_DEFINITION_VARIATION_MEMBERSHIP_MSG, mem, null, INVALID_DEFINITION_VARIATION_MEMBERSHIP) - } + error(INVALID_DEFINITION_VARIATION_MEMBERSHIP_MSG, mem, null, INVALID_DEFINITION_VARIATION_MEMBERSHIP) } // validateDefinitionVariationSpecialization @@ -467,11 +482,13 @@ class SysMLValidator extends KerMLValidator { } } -// @Check -// def checkReferenceUsage(ReferenceUsage usage) { -// // validateReferenceUsageIsReferential is satisfied automatically -// } - + @Check + def checkReferenceUsage(ReferenceUsage usage) { + // validateReferenceUsageIsReferential + if (!usage.isReference) { + error(INVALID_ATTRIBUTE_USAGE_IS_REFERENTIAL_MSG, usage, null, INVALID_ATTRIBUTE_USAGE_IS_REFERENTIAL) + } + } @Check def checkUsage(Usage usage) { @@ -479,8 +496,17 @@ class SysMLValidator extends KerMLValidator { if (!(usage instanceof AttributeUsage || usage instanceof OccurrenceUsage)) checkAllTypes(usage, Classifier, INVALID_USAGE_TYPE_MSG, SysMLPackage.eINSTANCE.usage_Definition, INVALID_USAGE_TYPE) - // validateUsageIsReferential is satisfied automatically - + // validateUsageIsReferential + if (!usage.isReference) { + if (usage.direction !== null) { + error(INVALID_USAGE_IS_REFERENTIAL_MSG_1, usage, null, INVALID_USAGE_IS_REFERENTIAL) + } else if (usage.isEnd) { + error(INVALID_USAGE_IS_REFERENTIAL_MSG_2, usage, null, INVALID_USAGE_IS_REFERENTIAL) + } else if (usage.featuringType.empty) { + error(INVALID_USAGE_IS_REFERENTIAL_MSG_3, usage, null, INVALID_USAGE_IS_REFERENTIAL) + } + } + if (usage.isVariation) { // validateUsageVariationIsAbstract if (!usage.isAbstract) { @@ -539,7 +565,10 @@ class SysMLValidator extends KerMLValidator { } } - // validateAttributeUsageIsReference is satisfied automatically + // validateAttributeUsageIsReference + if (!usg.isReference) { + error(INVALID_REFERENCE_USAGE_IS_REFERENCE_MSG, usg, null, INVALID_REFERENCE_USAGE_IS_REFERENCE) + } // Not implemented for now, until resolution of KerML issues on composite semantics. (See KerML-4.) // TODO: Check validateAttributeUsageFeatures @@ -548,10 +577,13 @@ class SysMLValidator extends KerMLValidator { // checkAllNotComposite(usg.ownedFeature, INVALID_ATTRIBUTE_USAGE_FEATURES_MSG, INVALID_ATTRIBUTE_USAGE_FEATURES) } -// @Check -// def checkEnumerationDefinition(EnumerationDefinition defn) { -// // validateEnumerationDefinitionIsVariation is satisfied automatically -// } + @Check + def checkEnumerationDefinition(EnumerationDefinition defn) { + // validateEnumerationDefinitionIsVariation + if (!defn.isVariation) { + error(INVALID_ENUMERATION_DEFINITION_IS_VARIATION_MSG, defn, null, INVALID_ENUMERATION_DEFINITION_IS_VARIATION) + } + } @Check def checkEnumerationUsage(EnumerationUsage usg) { @@ -561,7 +593,18 @@ class SysMLValidator extends KerMLValidator { @Check def checkEventOccurrenceUsage(EventOccurrenceUsage usg) { - // validateEventOccurrenceUsageIsReference is satisfied automatically + // validateEventOccurrenceUsageIsReference + if (!usg.isReference) { + if (usg instanceof ExhibitStateUsage) { + error(INVALID_EVENT_OCCURRENCE_USAGE_IS_REFERENCE_MSG_1, usg, null, INVALID_EVENT_OCCURRENCE_USAGE_IS_REFERENCE) + } else if (usg instanceof IncludeUseCaseUsage) { + error(INVALID_EVENT_OCCURRENCE_USAGE_IS_REFERENCE_MSG_2, usg, null, INVALID_EVENT_OCCURRENCE_USAGE_IS_REFERENCE) + } else if (usg instanceof PerformActionUsage) { + error(INVALID_EVENT_OCCURRENCE_USAGE_IS_REFERENCE_MSG_3, usg, null, INVALID_EVENT_OCCURRENCE_USAGE_IS_REFERENCE) + } else { + error(org.omg.sysml.xtext.validation.SysMLValidator.INVALID_EVENT_OCCURRENCE_USAGE_IS_REFERENCE_MSG_0, usg, null, INVALID_EVENT_OCCURRENCE_USAGE_IS_REFERENCE) + } + } // validateEventOccurrenceUsageReference if (!(usg instanceof PerformActionUsage || usg instanceof IncludeUseCaseUsage)) { @@ -645,7 +688,11 @@ class SysMLValidator extends KerMLValidator { // All types must be PortDefinitions checkAllTypes(usg, PortDefinition, INVALID_PORT_USAGE_TYPE_MSG, SysMLPackage.eINSTANCE.portUsage_PortDefinition, INVALID_PORT_USAGE_TYPE) - // validatePortUsageIsReference is satisfied automatically + // validatePortUsageIsReference + val owningType = usg.owningType + if (!(owningType instanceof PortDefinition || owningType instanceof PortUsage || usg.isReference)) { + error(INVALID_PORT_USAGE_IS_REFERENCE_MSG, usg, null, INVALID_PORT_USAGE_IS_REFERENCE) + } // validatePortUsageNestedUsagesNotComposite val usages = usg.nestedUsage.filter[u | !(u instanceof PortUsage)] @@ -1197,7 +1244,10 @@ class SysMLValidator extends KerMLValidator { @Check def checkExpose(Expose exp) { - // validateExposeIsImportAll is automatically satisfied + // validateExposeIsImportAll + if (!exp.isImportAll) { + error(INVALID_EXPOSE_IS_IMPORT_ALL_MSG, exp, null, INVALID_EXPOSE_IS_IMPORT_ALL) + } // validateExposeOwningNamespace if (!(exp.importOwningNamespace instanceof ViewUsage)) { diff --git a/org.omg.sysml/.launch/Launch Runtime Eclipse.launch b/org.omg.sysml/.launch/Launch Runtime Eclipse.launch index 7b1c420cf..e595bb15c 100644 --- a/org.omg.sysml/.launch/Launch Runtime Eclipse.launch +++ b/org.omg.sysml/.launch/Launch Runtime Eclipse.launch @@ -25,7 +25,7 @@ - + diff --git a/org.omg.sysml/.settings/org.eclipse.jdt.ui.prefs b/org.omg.sysml/.settings/org.eclipse.jdt.ui.prefs index b5128b802..7103be722 100644 --- a/org.omg.sysml/.settings/org.eclipse.jdt.ui.prefs +++ b/org.omg.sysml/.settings/org.eclipse.jdt.ui.prefs @@ -1,3 +1,2 @@ eclipse.preferences.version=1 -org.eclipse.jdt.ui.javadoc=true -org.eclipse.jdt.ui.text.custom_code_templates=