Wiki source code of SCL Extensions
Version 7.1 by ssm on 2013/05/08 10:56
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | |||
2 | |||
3 | |||
4 | |||
5 | {{toc/}} | ||
6 | |||
7 | There are several extensions implemented to ease the work with a scl model. (de.cau.cs.kieler.scl.extensions) | ||
8 | |||
9 | = SCL Factory Extensions = | ||
10 | |||
11 | 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. | ||
12 | |||
13 | |=((( | ||
14 | Shortcut | ||
15 | )))|=((( | ||
16 | Factory | ||
17 | )))|=(% colspan="1" %)(% colspan="1" %) | ||
18 | ((( | ||
19 | Description | ||
20 | ))) | ||
21 | |((( | ||
22 | SGraph() | ||
23 | )))|((( | ||
24 | SGraphFactory::eINSTANCE | ||
25 | )))|(% colspan="1" %)(% colspan="1" %) | ||
26 | ((( | ||
27 | Factory for yakindu statechart models | ||
28 | ))) | ||
29 | |(% colspan="1" %)(% colspan="1" %) | ||
30 | ((( | ||
31 | SText() | ||
32 | )))|(% colspan="1" %)(% colspan="1" %) | ||
33 | ((( | ||
34 | StextFactory::eINSTANCE | ||
35 | )))|(% colspan="1" %)(% colspan="1" %) | ||
36 | ((( | ||
37 | Factory for yakindu expressions | ||
38 | ))) | ||
39 | |(% colspan="1" %)(% colspan="1" %) | ||
40 | ((( | ||
41 | SyncGraph() | ||
42 | )))|(% colspan="1" %)(% colspan="1" %) | ||
43 | ((( | ||
44 | SyncgraphFactory::eINSTANCE | ||
45 | )))|(% colspan="1" %)(% colspan="1" %) | ||
46 | ((( | ||
47 | Factory for sgraph extensions | ||
48 | ))) | ||
49 | |(% colspan="1" %)(% colspan="1" %) | ||
50 | ((( | ||
51 | SyncText() | ||
52 | )))|(% colspan="1" %)(% colspan="1" %) | ||
53 | ((( | ||
54 | SynctextFactory::eINSTANCE | ||
55 | )))|(% colspan="1" %)(% colspan="1" %) | ||
56 | ((( | ||
57 | Factory for stext extensions | ||
58 | ))) | ||
59 | |(% colspan="1" %)(% colspan="1" %) | ||
60 | ((( | ||
61 | SCCExp() | ||
62 | )))|(% colspan="1" %)(% colspan="1" %) | ||
63 | ((( | ||
64 | SCChartsExpFactory::eINSTANCE | ||
65 | )))|(% colspan="1" %)(% colspan="1" %) | ||
66 | ((( | ||
67 | Factory for SCCharts specific expression extensions | ||
68 | ))) | ||
69 | |(% colspan="1" %)(% colspan="1" %) | ||
70 | ((( | ||
71 | SCL() | ||
72 | )))|(% colspan="1" %)(% colspan="1" %) | ||
73 | ((( | ||
74 | SclFactory::eINSTANCE | ||
75 | )))|(% colspan="1" %)(% colspan="1" %) | ||
76 | ((( | ||
77 | Factory for SCL | ||
78 | ))) | ||
79 | |||
80 | = SCL Create Extensions = | ||
81 | |||
82 | //coming soon...// | ||
83 | |||
84 | = SCL Naming Extensions = | ||
85 | |||
86 | SCL Naming Extensions provide helper functions for ID & naming services. | ||
87 | |||
88 | |=((( | ||
89 | Method | ||
90 | )))|=((( | ||
91 | Description | ||
92 | ))) | ||
93 | |((( | ||
94 | def void distributeStateIDs(Statechart) | ||
95 | )))|((( | ||
96 | Since yakindu does not make use of the ID field, one can use this method to make every ID in a statechart unique. | ||
97 | ))) | ||
98 | |(% colspan="1" %)(% colspan="1" %) | ||
99 | ((( | ||
100 | def String getHierarchicalName(SyncState, String) | ||
101 | )))|(% colspan="1" %)(% colspan="1" %) | ||
102 | ((( | ||
103 | 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. | ||
104 | ))) | ||
105 | |||
106 | = SCL Ordering Extensions = | ||
107 | |||
108 | The Ordering Extensions provide functions, which can be used in the //xtend sort// context. | ||
109 | |||
110 | |=((( | ||
111 | Method | ||
112 | )))|=((( | ||
113 | Description | ||
114 | ))) | ||
115 | |((( | ||
116 | def **int** compareSCLRegionStateOrder(SyncState, SyncState)(% style="font-size: small;" %) | ||
117 | )))|((( | ||
118 | Sorts states according to their type. Initial states come first, final states last. | ||
119 | ))) | ||
120 | |||
121 | = SCL Statement Extensions = | ||
122 | |||
123 | //coming soon...// | ||
124 | |||
125 | = SCL Thread Extensions = | ||
126 | |||
127 | The Thread Extensions provide functions to ease the handling of SCL threads and statements in the context of SCL threads. | ||
128 | |||
129 | |=((( | ||
130 | Method | ||
131 | )))|=((( | ||
132 | Description | ||
133 | ))) | ||
134 | |((( | ||
135 | def AbstractThread getThread(Instruction) | ||
136 | |||
137 | def AbstractThread getThread(Statement)(% style="font-size: small;" %) | ||
138 | )))|((( | ||
139 | Returns the SCL thread of a SCL statement or SCL instruction. | ||
140 | ))) | ||
141 | |(% colspan="1" %)(% colspan="1" %) | ||
142 | ((( | ||
143 | def AbstractThread getMainThread(Instruction) | ||
144 | |||
145 | def AbstractThread getMainThread(Statement)(% style="font-size: small;" %) | ||
146 | )))|(% colspan="1" %)(% colspan="1" %) | ||
147 | ((( | ||
148 | Returns the main thread of a SCL program. | ||
149 | ))) | ||
150 | |(% colspan="1" %)(% colspan="1" %) | ||
151 | ((( | ||
152 | def Statement[] getControlFlow(Instruction) | ||
153 | |||
154 | def Statement[] getControlFlow(Statement) | ||
155 | )))|(% colspan="1" %)(% colspan="1" %) | ||
156 | ((( | ||
157 | 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. | ||
158 | ))) | ||
159 | |(% colspan="1" %)(% colspan="1" %) | ||
160 | ((( | ||
161 | def **boolean** isInSameThreadAs(Instruction, Instruction) | ||
162 | |||
163 | def **boolean** isInSameThreadAs(Statement, Statement) | ||
164 | )))|(% colspan="1" %)(% colspan="1" %) | ||
165 | ((( | ||
166 | Returns true, if both instructions/statements are in the same thread. | ||
167 | ))) | ||
168 | |(% colspan="1" %)(% colspan="1" %) | ||
169 | ((( | ||
170 | def **boolean** isInMainThread(Instruction) | ||
171 | |||
172 | def **boolean** isInMainThread(Statement) | ||
173 | )))|(% colspan="1" %)(% colspan="1" %) | ||
174 | ((( | ||
175 | Returns true, if the instruction/statement runs in the main thread. | ||
176 | ))) | ||
177 | |(% colspan="1" %)(% colspan="1" %) | ||
178 | ((( | ||
179 | def **boolean** isInThread(Instruction, AbstractThread) | ||
180 | |||
181 | def **boolean** isInThread(Statement, AbstractThread) | ||
182 | )))|(% colspan="1" %)(% colspan="1" %) | ||
183 | ((( | ||
184 | Returns true, if the instruction/statement runs in the given thread. | ||
185 | ))) | ||
186 | |(% colspan="1" %)(% colspan="1" %) | ||
187 | ((( | ||
188 | def **boolean** contains(AbstractThread, Instruction) | ||
189 | |||
190 | def **boolean** contains(AbstractThread, Statements) | ||
191 | )))|(% colspan="1" %)(% colspan="1" %) | ||
192 | ((( | ||
193 | Returns true, if the thread contains the given instruction/statement. | ||
194 | ))) | ||
195 | |(% colspan="1" %)(% colspan="1" %) | ||
196 | ((( | ||
197 | def dropPrevious(AbstractThread, Statement) | ||
198 | |||
199 | def dropPrevious(List<Statement>, Statement)(% style="font-size: small;" %) | ||
200 | )))|(% colspan="1" %)(% colspan="1" %) | ||
201 | ((( | ||
202 | Drops all preceding statements in a thread or a list of statements before the given statement. | ||
203 | ))) | ||
204 | |(% colspan="1" %)(% colspan="1" %) | ||
205 | ((( | ||
206 | def Statement getPreviousStatement(Statement) | ||
207 | )))|(% colspan="1" %)(% colspan="1" %) | ||
208 | ((( | ||
209 | Returns the preceding statement. | ||
210 | ))) | ||
211 | |(% colspan="1" %)(% colspan="1" %) | ||
212 | ((( | ||
213 | def Statement getPreviousStatementHierarchical(Statement) | ||
214 | )))|(% colspan="1" %)(% colspan="1" %) | ||
215 | ((( | ||
216 | Returns the preceding statement or the parent statement of that control flow, if no preceding statement is present. | ||
217 | ))) | ||
218 | |(% colspan="1" %)(% colspan="1" %) | ||
219 | ((( | ||
220 | def InstructionStatement getPreviousInstructionStatement(Statement) | ||
221 | )))|(% colspan="1" %)(% colspan="1" %) | ||
222 | ((( | ||
223 | Returns the preceding instruction statement. Empty statements are ignored. | ||
224 | ))) | ||
225 | |(% colspan="1" %)(% colspan="1" %) | ||
226 | ((( | ||
227 | def InstructionStatement getPreviousInstructionStatementHierarchical(Statement) | ||
228 | )))|(% colspan="1" %)(% colspan="1" %) | ||
229 | ((( | ||
230 | Returns the preceding instruction statement or the parent statement of that control flow, if no preceding statement is present. | ||
231 | ))) | ||
232 | |||
233 | = SCL Goto Extensions = | ||
234 | |||
235 | To help with the handling of the goto statement and its target instruction, use the SCL Goto Extensions. | ||
236 | |||
237 | |=((( | ||
238 | Method | ||
239 | )))|=((( | ||
240 | Description | ||
241 | ))) | ||
242 | |((( | ||
243 | def Statement getTargetStatement(Goto) | ||
244 | |||
245 | def Statement getTargetStatement(Goto, AbstractThread) | ||
246 | )))|((( | ||
247 | Returns the target statement of a goto instruction (in the context of the (given) thread). | ||
248 | ))) | ||
249 | |(% colspan="1" %)(% colspan="1" %) | ||
250 | ((( | ||
251 | def boolean targetExists(Goto) | ||
252 | |||
253 | def boolean targetExists(Goto, AbstractThread) | ||
254 | )))|(% colspan="1" %)(% colspan="1" %) | ||
255 | ((( | ||
256 | Returns true, if the target of a goto instruction exists (in the context of the (given) thread). | ||
257 | ))) | ||
258 | |(% colspan="1" %)(% colspan="1" %) | ||
259 | ((( | ||
260 | def InstructionStatement getInstructionStatement(Statement)(% style="font-size: small;" %) | ||
261 | )))|(% colspan="1" %)(% colspan="1" %) | ||
262 | ((( | ||
263 | Returns the first valid InstructionStatement in a thread after the given statement. **May return null, if no further InstructionStatement exists.** | ||
264 | |||
265 | 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. | ||
266 | ))) | ||
267 | |(% colspan="1" %)(% colspan="1" %) | ||
268 | ((( | ||
269 | def getIncomingGotos(Statement) | ||
270 | )))|(% colspan="1" %)(% colspan="1" %) | ||
271 | ((( | ||
272 | 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". | ||
273 | ))) | ||
274 | |||
275 | = SCL Expression Extensions = | ||
276 | |||
277 | The SCL Expression Extension holds methods to help with the manipulation and constructions of the SText (and extended) expressions. | ||
278 | |||
279 | |=((( | ||
280 | Method | ||
281 | )))|=((( | ||
282 | Description | ||
283 | ))) | ||
284 | |((( | ||
285 | def Expression toExpression(RegularEventSpec) | ||
286 | )))|((( | ||
287 | Transforms a SGraph RegularEventSpec to a SText Expression. The resulting expression will be an ElementReferenceExpression. | ||
288 | ))) | ||
289 | |(% colspan="1" %)(% colspan="1" %) | ||
290 | ((( | ||
291 | def Expression negate(Expression) | ||
292 | )))|(% colspan="1" %)(% colspan="1" %) | ||
293 | ((( | ||
294 | 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. | ||
295 | ))) | ||
296 | |(% colspan="1" %)(% colspan="1" %) | ||
297 | ((( | ||
298 | def String correctSerialization(String) | ||
299 | )))|(% colspan="1" %)(% colspan="1" %) | ||
300 | ((( | ||
301 | 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. | ||
302 | ))) | ||
303 | |||
304 | = SCL Dependency Extensions = | ||
305 | |||
306 | //coming soon...// | ||
307 | |||
308 | = SCL Basic Block Extensions = | ||
309 | |||
310 | //coming soon...// |