Show last authors
1 == Deprecated since 0.12 ==
2 This article is deprecated. The described features are no longer available in current releases.
3
4
5
6
7
8 {{toc/}}
9
10 There are several extensions implemented to ease the work with a scl model. (de.cau.cs.kieler.scl.extensions)
11
12 = SCL Factory Extensions =
13
14 You need several Factories to handle all aspects of Yakindu (SGraph + SText) and the extended SCChart models. The SCL Factory Extension provides you with shortcuts for all factories.
15
16 (% class="wrapped" %)
17 |=(((
18 Shortcut
19 )))|=(((
20 Factory
21 )))|=(% colspan="1" %)(% colspan="1" %)
22 (((
23 Description
24 )))
25 |(((
26 SGraph()
27 )))|(((
28 SGraphFactory::eINSTANCE
29 )))|(% colspan="1" %)(% colspan="1" %)
30 (((
31 Factory for yakindu statechart models
32 )))
33 |(% colspan="1" %)(% colspan="1" %)
34 (((
35 SText()
36 )))|(% colspan="1" %)(% colspan="1" %)
37 (((
38 StextFactory::eINSTANCE
39 )))|(% colspan="1" %)(% colspan="1" %)
40 (((
41 Factory for yakindu expressions
42 )))
43 |(% colspan="1" %)(% colspan="1" %)
44 (((
45 SyncGraph()
46 )))|(% colspan="1" %)(% colspan="1" %)
47 (((
48 SyncgraphFactory::eINSTANCE
49 )))|(% colspan="1" %)(% colspan="1" %)
50 (((
51 Factory for sgraph extensions
52 )))
53 |(% colspan="1" %)(% colspan="1" %)
54 (((
55 SyncText()
56 )))|(% colspan="1" %)(% colspan="1" %)
57 (((
58 SynctextFactory::eINSTANCE
59 )))|(% colspan="1" %)(% colspan="1" %)
60 (((
61 Factory for stext extensions
62 )))
63 |(% colspan="1" %)(% colspan="1" %)
64 (((
65 SCCExp()
66 )))|(% colspan="1" %)(% colspan="1" %)
67 (((
68 SCChartsExpFactory::eINSTANCE
69 )))|(% colspan="1" %)(% colspan="1" %)
70 (((
71 Factory for SCCharts specific expression extensions
72 )))
73 |(% colspan="1" %)(% colspan="1" %)
74 (((
75 SCL()
76 )))|(% colspan="1" %)(% colspan="1" %)
77 (((
78 SclFactory::eINSTANCE
79 )))|(% colspan="1" %)(% colspan="1" %)
80 (((
81 Factory for SCL
82 )))
83
84 = SCL Create Extensions =
85
86 coming soon...
87
88 = SCL Naming Extensions =
89
90 SCL Naming Extensions provide helper functions for ID & naming services.
91
92 (% class="wrapped" %)
93 |=(((
94 Method
95 )))|=(((
96 Description
97 )))
98 |(((
99 def void distributeStateIDs(Statechart)
100 )))|(((
101 Since yakindu does not make use of the ID field, one can use this method to make every ID in a statechart unique.
102 )))
103 |(% colspan="1" %)(% colspan="1" %)
104 (((
105 def String getHierarchicalName(SyncState, String)
106 )))|(% colspan="1" %)(% colspan="1" %)
107 (((
108 Generates a (most likely unique) name for a state. The name is generated from all parent states and regions, which are separated by an underscore. If a region or state has no name, the element's hash code is used instead.
109 )))
110
111 = SCL Ordering Extensions =
112
113 The Ordering Extensions provide functions, which can be used in the //xtend sort// context.
114
115 (% class="wrapped" %)
116 |=(((
117 Method
118 )))|=(((
119 Description
120 )))
121 |(((
122 def **int** compareSCLRegionStateOrder(SyncState, SyncState)(% style="font-size:small" %)
123 )))|(((
124 Sorts states according to their type. Initial states come first, final states last.
125 )))
126
127 = SCL Statement Extensions =
128
129 (% class="wrapped" %)
130 |=(((
131 Method
132 )))|=(((
133 Description
134 )))
135 |(((
136 def boolean isEmpty(Statement)
137 )))|(((
138 Returns true, if the statement is an EmptyStatement.
139 )))
140 |(% colspan="1" %)(% colspan="1" %)
141 (((
142 def boolean hasInstruction(Statement)
143 )))|(% colspan="1" %)(% colspan="1" %)
144 (((
145 Returns true, if the statement is an InstructionStatement containing an instruction.
146 )))
147 |(% colspan="1" %)(% colspan="1" %)
148 (((
149 def boolean isGoto(Statement)
150 )))|(% colspan="1" %)(% colspan="1" %)
151 (((
152 Returns true, if the statement is an InstructionStatement containing a goto instruction.
153 )))
154 |(% colspan="1" %)(% colspan="1" %)
155 (((
156 def EmptyStatement asEmptyStatement(Statement)
157 )))|(% colspan="1" %)(% colspan="1" %)
158 (((
159 Convenently type-cast the statement to an EmptyStatement
160 )))
161 |(% colspan="1" %)(% colspan="1" %)
162 (((
163 def InstructionStatement asInstructionStatement(Statement)
164 )))|(% colspan="1" %)(% colspan="1" %)
165 (((
166 Convenently type-cast the statement to an InstructionStatement
167 )))
168 |(% colspan="1" %)(% colspan="1" %)
169 (((
170 def getInstruction(Statement)
171 )))|(% colspan="1" %)(% colspan="1" %)
172 (((
173 Type-cast the statement to an InstructionStatement an return its instruction.
174 )))
175 |(% colspan="1" %)(% colspan="1" %)
176 (((
177 def EmptyStatement removeInstruction(Statement)
178 )))|(% colspan="1" %)(% colspan="1" %)
179 (((
180 Creates a new EmptyStatement and copies the label and comment information from the old statement.
181 )))
182 |(% colspan="1" %)(% colspan="1" %)
183 (((
184 def getStatement(Instruction)
185 )))|(% colspan="1" %)(% colspan="1" %)
186 (((
187 Returns the parent statement of a given instruction.
188 )))
189
190 = SCL Thread Extensions =
191
192 The Thread Extensions provide functions to ease the handling of SCL threads and statements in the context of SCL threads.
193
194 (% class="wrapped" %)
195 |=(((
196 Method
197 )))|=(((
198 Description
199 )))
200 |(((
201 def AbstractThread getThread(Instruction)
202
203 def AbstractThread getThread(Statement)(% style="font-size:small" %)
204 )))|(((
205 Returns the SCL thread of a SCL statement or SCL instruction.
206 )))
207 |(% colspan="1" %)(% colspan="1" %)
208 (((
209 def AbstractThread getMainThread(Instruction)
210
211 def AbstractThread getMainThread(Statement)(% style="font-size:small" %)
212 )))|(% colspan="1" %)(% colspan="1" %)
213 (((
214 Returns the main thread of a SCL program.
215 )))
216 |(% colspan="1" %)(% colspan="1" %)
217 (((
218 def Statement[] getControlFlow(Instruction)
219
220 def Statement[] getControlFlow(Statement)
221 )))|(% colspan="1" %)(% colspan="1" %)
222 (((
223 Returns the control flow of an instruction/statement up to the parent of this control flow. In contrast to a thread this also includes control flows of conditional instructions.
224 )))
225 |(% colspan="1" %)(% colspan="1" %)
226 (((
227 def **boolean** isInSameThreadAs(Instruction, Instruction)
228
229 def **boolean** isInSameThreadAs(Statement, Statement)
230 )))|(% colspan="1" %)(% colspan="1" %)
231 (((
232 Returns true, if both instructions/statements are in the same thread.
233 )))
234 |(% colspan="1" %)(% colspan="1" %)
235 (((
236 def **boolean** isInMainThread(Instruction)
237
238 def **boolean** isInMainThread(Statement)
239 )))|(% colspan="1" %)(% colspan="1" %)
240 (((
241 Returns true, if the instruction/statement runs in the main thread.
242 )))
243 |(% colspan="1" %)(% colspan="1" %)
244 (((
245 def **boolean** isInThread(Instruction, AbstractThread)
246
247 def **boolean** isInThread(Statement, AbstractThread)
248 )))|(% colspan="1" %)(% colspan="1" %)
249 (((
250 Returns true, if the instruction/statement runs in the given thread.
251 )))
252 |(% colspan="1" %)(% colspan="1" %)
253 (((
254 def **boolean** contains(AbstractThread, Instruction)
255
256 def **boolean** contains(AbstractThread, Statements)
257 )))|(% colspan="1" %)(% colspan="1" %)
258 (((
259 Returns true, if the thread contains the given instruction/statement.
260 )))
261 |(% colspan="1" %)(% colspan="1" %)
262 (((
263 def dropPrevious(AbstractThread, Statement)
264
265 def dropPrevious(List<Statement>, Statement)(% style="font-size:small" %)
266 )))|(% colspan="1" %)(% colspan="1" %)
267 (((
268 Drops all preceding statements in a thread or a list of statements before the given statement.
269 )))
270 |(% colspan="1" %)(% colspan="1" %)
271 (((
272 def Statement getPreviousStatement(Statement)
273 )))|(% colspan="1" %)(% colspan="1" %)
274 (((
275 Returns the preceding statement.
276 )))
277 |(% colspan="1" %)(% colspan="1" %)
278 (((
279 def Statement getPreviousStatementHierarchical(Statement)
280 )))|(% colspan="1" %)(% colspan="1" %)
281 (((
282 Returns the preceding statement or the parent statement of that control flow, if no preceding statement is present.
283 )))
284 |(% colspan="1" %)(% colspan="1" %)
285 (((
286 def InstructionStatement getPreviousInstructionStatement(Statement)
287 )))|(% colspan="1" %)(% colspan="1" %)
288 (((
289 Returns the preceding instruction statement. Empty statements are ignored.
290 )))
291 |(% colspan="1" %)(% colspan="1" %)
292 (((
293 def InstructionStatement getPreviousInstructionStatementHierarchical(Statement)
294 )))|(% colspan="1" %)(% colspan="1" %)
295 (((
296 Returns the preceding instruction statement or the parent statement of that control flow, if no preceding statement is present.
297 )))
298
299 = SCL Goto Extensions =
300
301 To help with the handling of the goto statement and its target instruction, use the SCL Goto Extensions.
302
303 (% class="wrapped" %)
304 |=(((
305 Method
306 )))|=(((
307 Description
308 )))
309 |(((
310 def Statement getTargetStatement(Goto)
311
312 def Statement getTargetStatement(Goto, AbstractThread)
313 )))|(((
314 Returns the target statement of a goto instruction (in the context of the (given) thread).
315 )))
316 |(% colspan="1" %)(% colspan="1" %)
317 (((
318 def boolean targetExists(Goto)
319
320 def boolean targetExists(Goto, AbstractThread)
321 )))|(% colspan="1" %)(% colspan="1" %)
322 (((
323 Returns true, if the target of a goto instruction exists (in the context of the (given) thread).
324 )))
325 |(% colspan="1" %)(% colspan="1" %)
326 (((
327 def InstructionStatement getInstructionStatement(Statement)(% style="font-size:small" %)
328 )))|(% colspan="1" %)(% colspan="1" %)
329 (((
330 Returns the first valid InstructionStatement in a thread after the given statement. **May return null, if no further InstructionStatement exists.**
331
332 To get a valid instruction form a goto jump, one can write "goto.getTargetStatement?.getInstructionStatement?.instruction". The result value will be the instruction or null.
333 )))
334 |(% colspan="1" %)(% colspan="1" %)
335 (((
336 def getIncomingGotos(Statement)
337 )))|(% colspan="1" %)(% colspan="1" %)
338 (((
339 Returns a list of all gotos that target the given statement. If you want to retrieve the count of incoming goto jumps, use "getIncomingGotos.size".
340 )))
341
342 = SCL Expression Extensions =
343
344 The SCL Expression Extension holds methods to help with the manipulation and constructions of the SText (and extended) expressions.
345
346 (% class="wrapped" %)
347 |=(((
348 Method
349 )))|=(((
350 Description
351 )))
352 |(((
353 def Expression toExpression(RegularEventSpec)
354 )))|(((
355 Transforms a SGraph RegularEventSpec to a SText Expression. The resulting expression will be an ElementReferenceExpression.
356 )))
357 |(% colspan="1" %)(% colspan="1" %)
358 (((
359 def Expression negate(Expression)
360 )))|(% colspan="1" %)(% colspan="1" %)
361 (((
362 Negates the given expression. If the Expression is an ElementReferenceExpression the result will be a LogicalNotExpression containing the expression. Otherwise the result will be a LogicalNotExpression containing a ParenthesizedExpression, which then holds the original expression.
363 )))
364 |(% colspan="1" %)(% colspan="1" %)
365 (((
366 def String correctSerialization(String)
367 )))|(% colspan="1" %)(% colspan="1" %)
368 (((
369 Since the actual implementation of the SText parser may parse artefacts (like linebreaks) until matching a preceding delimeter, correctSerialization removes these artifacts, when serializing an expression.
370 )))
371
372 = SCL Dependency Extensions =
373
374 //coming soon...//
375
376 = SCL Basic Block Extensions =
377
378 The Basic Block Extensions retrieve information about basic blocks in the SCL model. A basic block can be identified by any statement in the block. Usually the first statement in the block is used.
379
380 (% class="wrapped" %)
381 |=(((
382 Method
383 )))|=(((
384 Description
385 )))
386 |(((
387 def ArrayList<Statement> getBasicBlock(Statement)
388
389 def ArrayList<Statement> getBasicBlock(Statement, List<Statement>)
390 )))|(((
391 Retrieves all statements of the basic block in which the given statement is located.
392 )))
393 |(% colspan="1" %)(% colspan="1" %)
394 (((
395 def Statement getBasicBlockFirst(Statement)
396
397 def Statement getBasicBlockFirst(List<Statement>)
398 )))|(% colspan="1" %)(% colspan="1" %)
399 (((
400 Returns the first statement of a basic block.
401 )))
402 |(% colspan="1" %)(% colspan="1" %)
403 (((
404 def boolean isInBasicBlock(Statement, Statement)
405
406 def boolean isInBasicBlock(Statement, List<Statement>)
407 )))|(% colspan="1" %)(% colspan="1" %)
408 (((
409 Returns true, if the caller statement is contained in the given basic block.
410 )))
411 |(% colspan="1" %)(% colspan="1" %)
412 (((
413 def String getBasicBlockID(Statement)
414
415 def String getBasicBlockID(List<Statement>)
416 )))|(% colspan="1" %)(% colspan="1" %)
417 (((
418 Returns an unique ID for the given basic block. To create this ID, the hash code of the root statement is used.
419 )))
420 |(% colspan="1" %)(% colspan="1" %)
421 (((
422 def ArrayList<Statement> getBasicBlockRoots(Statement)
423 )))|(% colspan="1" %)(% colspan="1" %)
424 (((
425 Returns a list of all basic block root statements in the contorl flow of the calling statement.
426 )))
427 |(% colspan="1" %)(% colspan="1" %)
428 (((
429 def ArrayList<Statement> getAllBasicBlockRoots(Statement)
430 )))|(% colspan="1" %)(% colspan="1" %)
431 (((
432 Returns a list of all basic block root statements in the program that contains the calling statement.
433 )))
434 |(% colspan="1" %)(% colspan="1" %)
435 (((
436 def int getBasicBlockIndex(Statement)
437 )))|(% colspan="1" %)(% colspan="1" %)
438 (((
439 Returns the index of the given basic block.
440 )))
441 |(% colspan="1" %)(% colspan="1" %)
442 (((
443 def ArrayList<Statement> getBasicBlockPredecessors(Statement)
444 )))|(% colspan="1" %)(% colspan="1" %)
445 (((
446 Returns a list of basic block root statements, that identify the predecessor basic blocks of the basic block identified by the given statement.
447 )))
448
449 {{code language="java" title="SCL Basic Block Extensions Code Examples"}}
450 for (predecessor : basicBlockData.BasicBlockRootStatement.getBasicBlockPredecessors) {
451 goLabelText = goLabelText + 'P' + predecessor.getBasicBlockIndex + "\n"
452 }
453 {{/code}}