Repository navigation
Expand file tree
/
Copy pathparser_features_demo_action_semantics.sysml
More file actions
75 lines (58 loc) · 1.83 KB
/
Copy pathparser_features_demo_action_semantics.sysml
File metadata and controls
75 lines (58 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/*
* Parser Features Demo: Action Semantics
*
* Demonstrates action body statements (Tasks 72, 93).
* All patterns extracted from Actions.sysml stdlib file.
*/
package ActionSemantics {
// The library is not implicitly visible: a bare name needs an import.
private import ScalarValues::*;
// The actions the performs below refer to.
action ValidateInput;
action Transform;
action SaveResults;
// ===== Basic Action with Assign (Task 72) =====
action InitializeCounter {
attribute counter : Integer;
assign counter := 0;
}
// ===== Action with Perform and Then =====
action ProcessWorkflow {
perform ValidateInput;
then perform Transform;
then perform SaveResults;
}
// ===== While Loop (Task 72) =====
action IterateSequence {
attribute index : Integer;
attribute var : Integer;
assign index := 1;
then while index <= 10 {
assign var := index;
then assign index := index + 1;
}
}
// ===== If/Else Statement (Task 72) =====
action ConditionalProcess {
attribute value : Integer;
attribute result : Integer;
if value > 0 {
assign result := 1;
} else {
assign result := 0;
}
}
// ===== Namespace-Level Succession within Action (Task 93) =====
// Exact pattern from Actions.sysml forEachLoop
action forEachLoop {
attribute index : Integer;
attribute var : Integer;
private action initialization
assign index := 1;
then private action whileLoop
while index <= 10 {
assign var := index;
then assign index := index + 1;
}
}
}