blob: 77cde675ec41be49843cf6c78742f314c7064d6e (
plain) (
blame)
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
|
RoomModel DetailExpressionTestModel {
import room.basic.types.* from "../../../runtime/${etModellib}/model/Types.room"
import room.basic.test.* from "../../../runtime/${etModellib}/model/Tests.room"
import room.basic.service.timing.* from "../../../runtime/${etModellib}/model/TimingService.room"
/**
* TODO define supported expression properly
* TODO sync UI and translation in generator
*/
async ActorClass DetailExpressionTest {
Interface {
SPP sppEvent: PEventdriven
Port portNotVisible: PEventdriven
}
Structure {
ServiceImplementation of sppEvent
Attribute numberArray [5]: int32
Attribute infoData: DDataNested
Port rPortEvent: PEventdriven
Port rPortData: PDatadriven
Port rReplEvent [5]: PEventdriven
conjugated Port cPortEvent: PEventdriven
conjugated Port cPortData: PDatadriven
conjugated Port cReplEvent [*]: PEventdriven
}
Behavior {
ctor '''
numberArray[0] = 5;
'''
dtor '''
numberArray[0] = 5;
'''
Operation actorOp(param: int32): boolean '''
return param == 0;
'''
StateMachine {
Transition eventTrans: idle -> state1 {
triggers {
<out1: cPortEvent guard '''
/* TODO activate action code editor */
rPortData.in1 == numberArray[3] &&
transitionData && infoData.flag
'''
>
}
action '''
// TODO syntax highlighting
rPortEvent.out1(true);
rPortData.in1;
rReplEvent[0].out1(true);
rReplEvent.out1(true); // broadcast
cPortEvent.in1();
cPortData.in1(32);
cReplEvent[1].in1();
cReplEvent.in1(); // broadcast
sppEvent[4].out1(true);
sppEvent.out1(true); // broadcast
rPortEvent.regularOp(32);
cPortEvent.conjOp(32);
actorOp(32);
int number = numberArray[0];
DData nestedData = infoData.nested;
int port = infoData.nested.tcpPort;
// transition event data
int data = (transitionData)? 1 : 0;
// -- not supported yet by code translation --
// getReplication():
// int replSize1 = rReplEvent.getReplication();
// int replSize2 = cReplEvent.getReplication();
// int replSize2 = sppEvent.getReplication();
// DataClass operations:
// infoData.dataOp(32);
// infoData.nested.dataOp("127.0.0.1", 8080);
'''
}
Transition guardedTrans: idle -> state2 {
guard '''
rPortData.in1 == numberArray[3] && infoData.flag && actorOp(32) && rPortEvent.regularOp(32) && cPortEvent.conjOp(32)
'''
}
Transition init: initial -> idle
State idle
State state1
State state2
}
}
}
ProtocolClass PEventdriven {
incoming {
Message in1()
}
outgoing {
Message out1(accessibleMessageData: boolean)
}
regular PortClass
{
Attribute regularAttr : boolean = "true"
Operation regularOp(param: int32): boolean '''
// return regularOp2(param);
return true;
'''
Operation regularOp2(): boolean '''
// return regularAttr;
return true;
'''
}
conjugated PortClass
{
Attribute conjAttr : boolean = "true"
Operation conjOp(param: int32): boolean '''
// return conjOp2(param);
return true;
'''
Operation conjOp2(): boolean '''
// return conjAttr;
return true;
'''
}
}
datadriven ProtocolClass PDatadriven {
incoming {
Message in1(data: int32)
}
/* not supported yet
* regular PortClass
* {
* Operation regularOp(param: int32): boolean {
* ""
* }
* Attribute regularAttr: int32
* }
* conjugated PortClass
* {
* Operation conjugatedOp(param: int32): boolean {
* ""
* }
* Attribute conjugatedAttr: int32
* }
* /*
*/
}
DataClass DDataNested {
Operation dataOp(number: int32) : boolean '''
// return dataOp2() && number;
return true;
'''
Operation dataOp2() : boolean '''
// nested.dataOp("", 0);
// return flag && nested.tcpPort;
return true;
'''
Attribute flag: boolean
Attribute array [5]: int32
Attribute nested: DData
}
DataClass DData {
Operation dataOp(ip: string, port: int32) '''
'''
Attribute iPAddr: string
Attribute tcpPort: int32
}
}
|