Skip to content

Commit fd405c2

Browse files
committed
SYSML2_-44 Updated Actions library model for terminate actions.
Also: - Added implicit specializations and adapter. - Added examples to SimpleTests/ActionTest model. - Updated SysML Xpect SimpleTests/ActionTest.
1 parent 9c555c3 commit fd405c2

8 files changed

Lines changed: 886 additions & 3 deletions

File tree

org.omg.sysml.xpect.tests/library.systems/Actions.sysml

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ standard library package Actions {
2828
private import TransitionPerformances::NonStateTransitionPerformance;
2929
private import Transfers::MessageTransfer;
3030
private import Connections::MessageConnection;
31+
private import OccurrenceFunctions::destroy;
3132

3233
abstract action def Action :> Performance {
3334
doc
@@ -81,7 +82,14 @@ standard library package Actions {
8182
* The subactions of this Action that are AcceptActions.
8283
*/
8384
}
84-
85+
86+
abstract action terminateSubactions : TerminateAction[0..*] :> subactions, terminateActions {
87+
doc
88+
/*
89+
* The subactions of this Action that are TerminateActions.
90+
*/
91+
}
92+
8593
abstract action controls : ControlAction[0..*] :> subactions {
8694
doc
8795
/*
@@ -223,6 +231,36 @@ standard library package Actions {
223231
*/
224232
}
225233

234+
abstract action def TerminateAction :> Action {
235+
doc
236+
/*
237+
* A TerminateAction is an Action that terminates a given Occurrence, meaning
238+
* that the Occurrence ends during the performance of this Action. TerminateAction
239+
* is the base type for all TerminateActionUsages.
240+
*/
241+
242+
in occurrence terminatedOccurrence[1];
243+
244+
action terminateOccurrence : destroy {
245+
in occ = terminatedOccurrence;
246+
}
247+
}
248+
249+
abstract action terminateActions : TerminateAction[0..*] nonunique :> actions {
250+
doc
251+
/*
252+
* terminateActions is the base feature for all TerminateActionUsages.
253+
*/
254+
255+
in occurrence terminatedOccurrence default that as Occurrence {
256+
doc
257+
/*
258+
* The default terminatedOccurrence for a terminateAction is its
259+
* featuring occurrence (which will generally be a containing Action).
260+
*/
261+
}
262+
}
263+
226264
abstract action def ControlAction :> Action {
227265
doc
228266
/*

org.omg.sysml.xpect.tests/src/org/omg/sysml/xpect/tests/simpletests/ActionTest.sysml.xt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ XPECT_SETUP org.omg.sysml.xpect.tests.simpletests.SysMLTests
2020
File {from ="/library.systems/Parts.sysml"}
2121
File {from ="/library.systems/Ports.sysml"}
2222
File {from ="/library.systems/Actions.sysml"}
23+
File {from ="/library.systems/Calculations.sysml"}
2324
File {from ="/library.domain/Quantities and Units/Quantities.sysml"}
2425
File {from ="/library.domain/Quantities and Units/MeasurementReferences.sysml"}
2526
File {from ="/library.domain/Quantities and Units/ISQ.sysml"}
@@ -49,6 +50,7 @@ XPECT_SETUP org.omg.sysml.xpect.tests.simpletests.SysMLTests
4950
File {from ="/library.systems/Parts.sysml"}
5051
File {from ="/library.systems/Ports.sysml"}
5152
File {from ="/library.systems/Actions.sysml"}
53+
File {from ="/library.systems/Calculations.sysml"}
5254
File {from ="/library.domain/Quantities and Units/Quantities.sysml"}
5355
File {from ="/library.domain/Quantities and Units/MeasurementReferences.sysml"}
5456
File {from ="/library.domain/Quantities and Units/ISQ.sysml"}
@@ -93,4 +95,11 @@ package ActionTest {
9395
ref action a : A;
9496
}
9597

98+
action def c {
99+
first start;
100+
then action c1 {
101+
terminate c1;
102+
}
103+
then terminate;
104+
}
96105
}

org.omg.sysml/src/org/omg/sysml/adapter/ElementAdapterFactory.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,11 @@ public ElementAdapter caseSuccession(Succession element) {
492492
return new SuccessionAdapter(element);
493493
}
494494

495+
@Override
496+
public ElementAdapter caseTerminateActionUsage(TerminateActionUsage element) {
497+
return new TerminateActionUsageAdapter(element);
498+
}
499+
495500
@Override
496501
public ElementAdapter caseTransitionUsage(TransitionUsage element) {
497502
return new TransitionUsageAdapter(element);
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*******************************************************************************
2+
* SysML 2 Pilot Implementation
3+
* Copyright (c) 2024 Model Driven Solutions, Inc.
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU Lesser General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU Lesser General Public License for more details.
14+
*
15+
* You should have received a copy of theGNU Lesser General Public License
16+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
17+
*
18+
* @license LGPL-3.0-or-later <http://spdx.org/licenses/LGPL-3.0-or-later>
19+
*
20+
*******************************************************************************/
21+
22+
package org.omg.sysml.adapter;
23+
24+
import org.omg.sysml.lang.sysml.Element;
25+
import org.omg.sysml.lang.sysml.TerminateActionUsage;
26+
27+
public class TerminateActionUsageAdapter extends ActionUsageAdapter {
28+
29+
public TerminateActionUsageAdapter(TerminateActionUsage element) {
30+
super(element);
31+
}
32+
33+
@Override
34+
public TerminateActionUsage getTarget() {
35+
return (TerminateActionUsage)super.getTarget();
36+
}
37+
38+
@Override
39+
public void computeImplicitGeneralTypes() {
40+
addComputedRedefinitions(null);
41+
}
42+
43+
@Override
44+
public void addComputedRedefinitions(Element skip) {
45+
addDefaultGeneralType();
46+
super.addComputedRedefinitions(skip);
47+
}
48+
49+
}

org.omg.sysml/src/org/omg/sysml/util/ImplicitGeneralizationMap.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,11 @@ protected ImplicitGeneralizationMap() {
307307
put(SuccessionFlowConnectionUsageImpl.class, "base", "Connections::successionFlowConnections");
308308
put(SuccessionFlowConnectionUsageImpl.class, "message", "Connections::successionFlowConnections");
309309

310+
put(TerminateActionUsageImpl.class, "base", "Actions::terminateActions");
311+
put(TerminateActionUsageImpl.class, "subaction", "Actions::Action::terminateSubactions");
312+
313+
put(TerminateActionUsageImpl.class, "subaction", "Actions::Action::terminateWithResultSubactions");
314+
310315
put(TransitionUsageImpl.class, "base", "Actions::transitionActions");
311316
put(TransitionUsageImpl.class, "actionTransition", "Actions::Action::decisionTransitions");
312317
put(TransitionUsageImpl.class, "stateTransition", "States::StateAction::stateTransitions");

0 commit comments

Comments
 (0)