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