Wiki source code of SCL Extensions
Version 6.1 by ssm on 2013/05/03 19:31
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 **boolean** isInSameThreadAs(Instruction, Instruction) | ||
153 | |||
154 | def **boolean** isInSameThreadAs(Statement, Statement) | ||
155 | )))|(% colspan="1" %)(% colspan="1" %) | ||
156 | ((( | ||
157 | Returns true, if both instructions/statements are in the same thread. | ||
158 | ))) | ||
159 | |(% colspan="1" %)(% colspan="1" %) | ||
160 | ((( | ||
161 | def **boolean** isInMainThread(Instruction) | ||
162 | |||
163 | def **boolean** isInMainThread(Statement) | ||
164 | )))|(% colspan="1" %)(% colspan="1" %) | ||
165 | ((( | ||
166 | Returns true, if the instruction/statement runs in the main thread. | ||
167 | ))) | ||
168 | |(% colspan="1" %)(% colspan="1" %) | ||
169 | ((( | ||
170 | def **boolean** isInThread(Instruction, AbstractThread) | ||
171 | |||
172 | def **boolean** isInThread(Statement, AbstractThread) | ||
173 | )))|(% colspan="1" %)(% colspan="1" %) | ||
174 | ((( | ||
175 | Returns true, if the instruction/statement runs in the given thread. | ||
176 | ))) | ||
177 | |(% colspan="1" %)(% colspan="1" %) | ||
178 | ((( | ||
179 | def **boolean** contains(AbstractThread, Instruction) | ||
180 | |||
181 | def **boolean** contains(AbstractThread, Statements) | ||
182 | )))|(% colspan="1" %)(% colspan="1" %) | ||
183 | ((( | ||
184 | Returns true, if the thread contains the given instruction/statement. | ||
185 | ))) | ||
186 | |(% colspan="1" %)(% colspan="1" %) | ||
187 | ((( | ||
188 | def dropPrevious(AbstractThread, Statement) | ||
189 | |||
190 | def dropPrevious(List<Statement>, Statement)(% style="font-size: small;" %) | ||
191 | )))|(% colspan="1" %)(% colspan="1" %) | ||
192 | ((( | ||
193 | Drops all preceeding statements in a thread or a list of statements before the given statement. | ||
194 | ))) | ||
195 | |||
196 | = SCL Goto Extensions = | ||
197 | |||
198 | To help with the handling of the goto statement and its target instruction, use the SCL Goto Extensions. | ||
199 | |||
200 | |=((( | ||
201 | Method | ||
202 | )))|=((( | ||
203 | Description | ||
204 | ))) | ||
205 | |((( | ||
206 | def Statement getTargetStatement(Goto) | ||
207 | |||
208 | def Statement getTargetStatement(Goto, AbstractThread) | ||
209 | )))|((( | ||
210 | Returns the target statement of a goto instruction (in the context of the (given) thread). | ||
211 | ))) | ||
212 | |(% colspan="1" %)(% colspan="1" %) | ||
213 | ((( | ||
214 | def boolean targetExists(Goto) | ||
215 | |||
216 | def boolean targetExists(Goto, AbstractThread) | ||
217 | )))|(% colspan="1" %)(% colspan="1" %) | ||
218 | ((( | ||
219 | Returns true, if the target of a goto instruction exists (in the context of the (given) thread). | ||
220 | ))) | ||
221 | |(% colspan="1" %)(% colspan="1" %) | ||
222 | ((( | ||
223 | def InstructionStatement getInstructionStatement(Statement)(% style="font-size: small;" %) | ||
224 | )))|(% colspan="1" %)(% colspan="1" %) | ||
225 | ((( | ||
226 | Returns the first valid InstructionStatement in a thread after the given statement. **May return null, if no further InstructionStatement exists.** | ||
227 | |||
228 | 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. | ||
229 | ))) | ||
230 | |(% colspan="1" %)(% colspan="1" %) | ||
231 | ((( | ||
232 | def getIncomingGotos(Statement) | ||
233 | )))|(% colspan="1" %)(% colspan="1" %) | ||
234 | ((( | ||
235 | 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". | ||
236 | ))) | ||
237 | |||
238 | = SCL Expression Extensions = | ||
239 | |||
240 | The SCL Expression Extension holds methods to help with the manipulation and constructions of the SText (and extended) expressions. | ||
241 | |||
242 | |=((( | ||
243 | Method | ||
244 | )))|=((( | ||
245 | Description | ||
246 | ))) | ||
247 | |((( | ||
248 | def Expression toExpression(RegularEventSpec) | ||
249 | )))|((( | ||
250 | Transforms a SGraph RegularEventSpec to a SText Expression. The resulting expression will be an ElementReferenceExpression. | ||
251 | ))) | ||
252 | |(% colspan="1" %)(% colspan="1" %) | ||
253 | ((( | ||
254 | def Expression negate(Expression) | ||
255 | )))|(% colspan="1" %)(% colspan="1" %) | ||
256 | ((( | ||
257 | 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. | ||
258 | ))) | ||
259 | |(% colspan="1" %)(% colspan="1" %) | ||
260 | ((( | ||
261 | def String correctSerialization(String) | ||
262 | )))|(% colspan="1" %)(% colspan="1" %) | ||
263 | ((( | ||
264 | 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. | ||
265 | ))) | ||
266 | |||
267 | = SCL Dependency Extensions = | ||
268 | |||
269 | //coming soon...// | ||
270 | |||
271 | = SCL Basic Block Extensions = | ||
272 | |||
273 | //coming soon...// |