diff options
author | 2020-11-02 02:02:40 +0100 | |
---|---|---|
committer | 2020-11-02 02:02:40 +0100 | |
commit | f06427cd7375551582461f91b3458339a8227f9b (patch) | |
tree | 97bc6ec85f4c384e5080a6611b492caf460b6ce9 /Domains/ca.mcgill.rtgmrt.example.modes3/vql-gen/modes3/queries/EndOfSiding_step_2.java | |
parent | Must unit propagation (diff) | |
download | VIATRA-Generator-f06427cd7375551582461f91b3458339a8227f9b.tar.gz VIATRA-Generator-f06427cd7375551582461f91b3458339a8227f9b.tar.zst VIATRA-Generator-f06427cd7375551582461f91b3458339a8227f9b.zip |
Optimizing generator with linear objective functions
Diffstat (limited to 'Domains/ca.mcgill.rtgmrt.example.modes3/vql-gen/modes3/queries/EndOfSiding_step_2.java')
-rw-r--r-- | Domains/ca.mcgill.rtgmrt.example.modes3/vql-gen/modes3/queries/EndOfSiding_step_2.java | 564 |
1 files changed, 564 insertions, 0 deletions
diff --git a/Domains/ca.mcgill.rtgmrt.example.modes3/vql-gen/modes3/queries/EndOfSiding_step_2.java b/Domains/ca.mcgill.rtgmrt.example.modes3/vql-gen/modes3/queries/EndOfSiding_step_2.java new file mode 100644 index 00000000..a8f68dca --- /dev/null +++ b/Domains/ca.mcgill.rtgmrt.example.modes3/vql-gen/modes3/queries/EndOfSiding_step_2.java | |||
@@ -0,0 +1,564 @@ | |||
1 | /** | ||
2 | * Generated from platform:/resource/ca.mcgill.rtgmrt.example.modes3/src/modes3/queries/Modes3Queries.vql | ||
3 | */ | ||
4 | package modes3.queries; | ||
5 | |||
6 | import java.util.Arrays; | ||
7 | import java.util.Collection; | ||
8 | import java.util.LinkedHashSet; | ||
9 | import java.util.List; | ||
10 | import java.util.Objects; | ||
11 | import java.util.Optional; | ||
12 | import java.util.Set; | ||
13 | import java.util.function.Consumer; | ||
14 | import java.util.stream.Collectors; | ||
15 | import java.util.stream.Stream; | ||
16 | import modes3.Train; | ||
17 | import org.apache.log4j.Logger; | ||
18 | import org.eclipse.emf.ecore.EClass; | ||
19 | import org.eclipse.viatra.query.runtime.api.IPatternMatch; | ||
20 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification; | ||
21 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; | ||
22 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
23 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; | ||
24 | import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; | ||
25 | import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; | ||
26 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
27 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
28 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
29 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
30 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
33 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
34 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
35 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; | ||
36 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
37 | import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; | ||
38 | |||
39 | /** | ||
40 | * A pattern-specific query specification that can instantiate Matcher in a type-safe way. | ||
41 | * | ||
42 | * <p>Original source: | ||
43 | * <code><pre> | ||
44 | * // | ||
45 | * // endOfSiding | ||
46 | * // | ||
47 | * | ||
48 | * pattern endOfSiding_step_2(in train : Train) { | ||
49 | * // frame-{@literal >}train = model-{@literal >}trains[i0]; | ||
50 | * // frame-{@literal >}location = frame-{@literal >}train-{@literal >}location; | ||
51 | * // if (frame-{@literal >}location != NULL) { | ||
52 | * // ... | ||
53 | * // } | ||
54 | * | ||
55 | * Train(train); | ||
56 | * } | ||
57 | * </pre></code> | ||
58 | * | ||
59 | * @see Matcher | ||
60 | * @see Match | ||
61 | * | ||
62 | */ | ||
63 | @SuppressWarnings("all") | ||
64 | public final class EndOfSiding_step_2 extends BaseGeneratedEMFQuerySpecification<EndOfSiding_step_2.Matcher> { | ||
65 | /** | ||
66 | * Pattern-specific match representation of the modes3.queries.endOfSiding_step_2 pattern, | ||
67 | * to be used in conjunction with {@link Matcher}. | ||
68 | * | ||
69 | * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. | ||
70 | * Each instance is a (possibly partial) substitution of pattern parameters, | ||
71 | * usable to represent a match of the pattern in the result of a query, | ||
72 | * or to specify the bound (fixed) input parameters when issuing a query. | ||
73 | * | ||
74 | * @see Matcher | ||
75 | * | ||
76 | */ | ||
77 | public static abstract class Match extends BasePatternMatch { | ||
78 | private Train fTrain; | ||
79 | |||
80 | private static List<String> parameterNames = makeImmutableList("train"); | ||
81 | |||
82 | private Match(final Train pTrain) { | ||
83 | this.fTrain = pTrain; | ||
84 | } | ||
85 | |||
86 | @Override | ||
87 | public Object get(final String parameterName) { | ||
88 | switch(parameterName) { | ||
89 | case "train": return this.fTrain; | ||
90 | default: return null; | ||
91 | } | ||
92 | } | ||
93 | |||
94 | @Override | ||
95 | public Object get(final int index) { | ||
96 | switch(index) { | ||
97 | case 0: return this.fTrain; | ||
98 | default: return null; | ||
99 | } | ||
100 | } | ||
101 | |||
102 | public Train getTrain() { | ||
103 | return this.fTrain; | ||
104 | } | ||
105 | |||
106 | @Override | ||
107 | public boolean set(final String parameterName, final Object newValue) { | ||
108 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
109 | if ("train".equals(parameterName) ) { | ||
110 | this.fTrain = (Train) newValue; | ||
111 | return true; | ||
112 | } | ||
113 | return false; | ||
114 | } | ||
115 | |||
116 | public void setTrain(final Train pTrain) { | ||
117 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
118 | this.fTrain = pTrain; | ||
119 | } | ||
120 | |||
121 | @Override | ||
122 | public String patternName() { | ||
123 | return "modes3.queries.endOfSiding_step_2"; | ||
124 | } | ||
125 | |||
126 | @Override | ||
127 | public List<String> parameterNames() { | ||
128 | return EndOfSiding_step_2.Match.parameterNames; | ||
129 | } | ||
130 | |||
131 | @Override | ||
132 | public Object[] toArray() { | ||
133 | return new Object[]{fTrain}; | ||
134 | } | ||
135 | |||
136 | @Override | ||
137 | public EndOfSiding_step_2.Match toImmutable() { | ||
138 | return isMutable() ? newMatch(fTrain) : this; | ||
139 | } | ||
140 | |||
141 | @Override | ||
142 | public String prettyPrint() { | ||
143 | StringBuilder result = new StringBuilder(); | ||
144 | result.append("\"train\"=" + prettyPrintValue(fTrain)); | ||
145 | return result.toString(); | ||
146 | } | ||
147 | |||
148 | @Override | ||
149 | public int hashCode() { | ||
150 | return Objects.hash(fTrain); | ||
151 | } | ||
152 | |||
153 | @Override | ||
154 | public boolean equals(final Object obj) { | ||
155 | if (this == obj) | ||
156 | return true; | ||
157 | if (obj == null) { | ||
158 | return false; | ||
159 | } | ||
160 | if ((obj instanceof EndOfSiding_step_2.Match)) { | ||
161 | EndOfSiding_step_2.Match other = (EndOfSiding_step_2.Match) obj; | ||
162 | return Objects.equals(fTrain, other.fTrain); | ||
163 | } else { | ||
164 | // this should be infrequent | ||
165 | if (!(obj instanceof IPatternMatch)) { | ||
166 | return false; | ||
167 | } | ||
168 | IPatternMatch otherSig = (IPatternMatch) obj; | ||
169 | return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); | ||
170 | } | ||
171 | } | ||
172 | |||
173 | @Override | ||
174 | public EndOfSiding_step_2 specification() { | ||
175 | return EndOfSiding_step_2.instance(); | ||
176 | } | ||
177 | |||
178 | /** | ||
179 | * Returns an empty, mutable match. | ||
180 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
181 | * | ||
182 | * @return the empty match. | ||
183 | * | ||
184 | */ | ||
185 | public static EndOfSiding_step_2.Match newEmptyMatch() { | ||
186 | return new Mutable(null); | ||
187 | } | ||
188 | |||
189 | /** | ||
190 | * Returns a mutable (partial) match. | ||
191 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
192 | * | ||
193 | * @param pTrain the fixed value of pattern parameter train, or null if not bound. | ||
194 | * @return the new, mutable (partial) match object. | ||
195 | * | ||
196 | */ | ||
197 | public static EndOfSiding_step_2.Match newMutableMatch(final Train pTrain) { | ||
198 | return new Mutable(pTrain); | ||
199 | } | ||
200 | |||
201 | /** | ||
202 | * Returns a new (partial) match. | ||
203 | * This can be used e.g. to call the matcher with a partial match. | ||
204 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
205 | * @param pTrain the fixed value of pattern parameter train, or null if not bound. | ||
206 | * @return the (partial) match object. | ||
207 | * | ||
208 | */ | ||
209 | public static EndOfSiding_step_2.Match newMatch(final Train pTrain) { | ||
210 | return new Immutable(pTrain); | ||
211 | } | ||
212 | |||
213 | private static final class Mutable extends EndOfSiding_step_2.Match { | ||
214 | Mutable(final Train pTrain) { | ||
215 | super(pTrain); | ||
216 | } | ||
217 | |||
218 | @Override | ||
219 | public boolean isMutable() { | ||
220 | return true; | ||
221 | } | ||
222 | } | ||
223 | |||
224 | private static final class Immutable extends EndOfSiding_step_2.Match { | ||
225 | Immutable(final Train pTrain) { | ||
226 | super(pTrain); | ||
227 | } | ||
228 | |||
229 | @Override | ||
230 | public boolean isMutable() { | ||
231 | return false; | ||
232 | } | ||
233 | } | ||
234 | } | ||
235 | |||
236 | /** | ||
237 | * Generated pattern matcher API of the modes3.queries.endOfSiding_step_2 pattern, | ||
238 | * providing pattern-specific query methods. | ||
239 | * | ||
240 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | ||
241 | * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. | ||
242 | * | ||
243 | * <p>Matches of the pattern will be represented as {@link Match}. | ||
244 | * | ||
245 | * <p>Original source: | ||
246 | * <code><pre> | ||
247 | * // | ||
248 | * // endOfSiding | ||
249 | * // | ||
250 | * | ||
251 | * pattern endOfSiding_step_2(in train : Train) { | ||
252 | * // frame-{@literal >}train = model-{@literal >}trains[i0]; | ||
253 | * // frame-{@literal >}location = frame-{@literal >}train-{@literal >}location; | ||
254 | * // if (frame-{@literal >}location != NULL) { | ||
255 | * // ... | ||
256 | * // } | ||
257 | * | ||
258 | * Train(train); | ||
259 | * } | ||
260 | * </pre></code> | ||
261 | * | ||
262 | * @see Match | ||
263 | * @see EndOfSiding_step_2 | ||
264 | * | ||
265 | */ | ||
266 | public static class Matcher extends BaseMatcher<EndOfSiding_step_2.Match> { | ||
267 | /** | ||
268 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
269 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
270 | * | ||
271 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
272 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
273 | * | ||
274 | */ | ||
275 | public static EndOfSiding_step_2.Matcher on(final ViatraQueryEngine engine) { | ||
276 | // check if matcher already exists | ||
277 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | ||
278 | if (matcher == null) { | ||
279 | matcher = (Matcher)engine.getMatcher(querySpecification()); | ||
280 | } | ||
281 | return matcher; | ||
282 | } | ||
283 | |||
284 | /** | ||
285 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
286 | * @return an initialized matcher | ||
287 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | ||
288 | * | ||
289 | */ | ||
290 | public static EndOfSiding_step_2.Matcher create() { | ||
291 | return new Matcher(); | ||
292 | } | ||
293 | |||
294 | private static final int POSITION_TRAIN = 0; | ||
295 | |||
296 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(EndOfSiding_step_2.Matcher.class); | ||
297 | |||
298 | /** | ||
299 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
300 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
301 | * | ||
302 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
303 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
304 | * | ||
305 | */ | ||
306 | private Matcher() { | ||
307 | super(querySpecification()); | ||
308 | } | ||
309 | |||
310 | /** | ||
311 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | ||
312 | * @param pTrain the fixed value of pattern parameter train, or null if not bound. | ||
313 | * @return matches represented as a Match object. | ||
314 | * | ||
315 | */ | ||
316 | public Collection<EndOfSiding_step_2.Match> getAllMatches(final Train pTrain) { | ||
317 | return rawStreamAllMatches(new Object[]{pTrain}).collect(Collectors.toSet()); | ||
318 | } | ||
319 | |||
320 | /** | ||
321 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. | ||
322 | * </p> | ||
323 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
324 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
325 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
326 | * @param pTrain the fixed value of pattern parameter train, or null if not bound. | ||
327 | * @return a stream of matches represented as a Match object. | ||
328 | * | ||
329 | */ | ||
330 | public Stream<EndOfSiding_step_2.Match> streamAllMatches(final Train pTrain) { | ||
331 | return rawStreamAllMatches(new Object[]{pTrain}); | ||
332 | } | ||
333 | |||
334 | /** | ||
335 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
336 | * Neither determinism nor randomness of selection is guaranteed. | ||
337 | * @param pTrain the fixed value of pattern parameter train, or null if not bound. | ||
338 | * @return a match represented as a Match object, or null if no match is found. | ||
339 | * | ||
340 | */ | ||
341 | public Optional<EndOfSiding_step_2.Match> getOneArbitraryMatch(final Train pTrain) { | ||
342 | return rawGetOneArbitraryMatch(new Object[]{pTrain}); | ||
343 | } | ||
344 | |||
345 | /** | ||
346 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | ||
347 | * under any possible substitution of the unspecified parameters (if any). | ||
348 | * @param pTrain the fixed value of pattern parameter train, or null if not bound. | ||
349 | * @return true if the input is a valid (partial) match of the pattern. | ||
350 | * | ||
351 | */ | ||
352 | public boolean hasMatch(final Train pTrain) { | ||
353 | return rawHasMatch(new Object[]{pTrain}); | ||
354 | } | ||
355 | |||
356 | /** | ||
357 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | ||
358 | * @param pTrain the fixed value of pattern parameter train, or null if not bound. | ||
359 | * @return the number of pattern matches found. | ||
360 | * | ||
361 | */ | ||
362 | public int countMatches(final Train pTrain) { | ||
363 | return rawCountMatches(new Object[]{pTrain}); | ||
364 | } | ||
365 | |||
366 | /** | ||
367 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
368 | * Neither determinism nor randomness of selection is guaranteed. | ||
369 | * @param pTrain the fixed value of pattern parameter train, or null if not bound. | ||
370 | * @param processor the action that will process the selected match. | ||
371 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | ||
372 | * | ||
373 | */ | ||
374 | public boolean forOneArbitraryMatch(final Train pTrain, final Consumer<? super EndOfSiding_step_2.Match> processor) { | ||
375 | return rawForOneArbitraryMatch(new Object[]{pTrain}, processor); | ||
376 | } | ||
377 | |||
378 | /** | ||
379 | * Returns a new (partial) match. | ||
380 | * This can be used e.g. to call the matcher with a partial match. | ||
381 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
382 | * @param pTrain the fixed value of pattern parameter train, or null if not bound. | ||
383 | * @return the (partial) match object. | ||
384 | * | ||
385 | */ | ||
386 | public EndOfSiding_step_2.Match newMatch(final Train pTrain) { | ||
387 | return EndOfSiding_step_2.Match.newMatch(pTrain); | ||
388 | } | ||
389 | |||
390 | /** | ||
391 | * Retrieve the set of values that occur in matches for train. | ||
392 | * @return the Set of all values or empty set if there are no matches | ||
393 | * | ||
394 | */ | ||
395 | protected Stream<Train> rawStreamAllValuesOftrain(final Object[] parameters) { | ||
396 | return rawStreamAllValues(POSITION_TRAIN, parameters).map(Train.class::cast); | ||
397 | } | ||
398 | |||
399 | /** | ||
400 | * Retrieve the set of values that occur in matches for train. | ||
401 | * @return the Set of all values or empty set if there are no matches | ||
402 | * | ||
403 | */ | ||
404 | public Set<Train> getAllValuesOftrain() { | ||
405 | return rawStreamAllValuesOftrain(emptyArray()).collect(Collectors.toSet()); | ||
406 | } | ||
407 | |||
408 | /** | ||
409 | * Retrieve the set of values that occur in matches for train. | ||
410 | * @return the Set of all values or empty set if there are no matches | ||
411 | * | ||
412 | */ | ||
413 | public Stream<Train> streamAllValuesOftrain() { | ||
414 | return rawStreamAllValuesOftrain(emptyArray()); | ||
415 | } | ||
416 | |||
417 | @Override | ||
418 | protected EndOfSiding_step_2.Match tupleToMatch(final Tuple t) { | ||
419 | try { | ||
420 | return EndOfSiding_step_2.Match.newMatch((Train) t.get(POSITION_TRAIN)); | ||
421 | } catch(ClassCastException e) { | ||
422 | LOGGER.error("Element(s) in tuple not properly typed!",e); | ||
423 | return null; | ||
424 | } | ||
425 | } | ||
426 | |||
427 | @Override | ||
428 | protected EndOfSiding_step_2.Match arrayToMatch(final Object[] match) { | ||
429 | try { | ||
430 | return EndOfSiding_step_2.Match.newMatch((Train) match[POSITION_TRAIN]); | ||
431 | } catch(ClassCastException e) { | ||
432 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
433 | return null; | ||
434 | } | ||
435 | } | ||
436 | |||
437 | @Override | ||
438 | protected EndOfSiding_step_2.Match arrayToMatchMutable(final Object[] match) { | ||
439 | try { | ||
440 | return EndOfSiding_step_2.Match.newMutableMatch((Train) match[POSITION_TRAIN]); | ||
441 | } catch(ClassCastException e) { | ||
442 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
443 | return null; | ||
444 | } | ||
445 | } | ||
446 | |||
447 | /** | ||
448 | * @return the singleton instance of the query specification of this pattern | ||
449 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
450 | * | ||
451 | */ | ||
452 | public static IQuerySpecification<EndOfSiding_step_2.Matcher> querySpecification() { | ||
453 | return EndOfSiding_step_2.instance(); | ||
454 | } | ||
455 | } | ||
456 | |||
457 | private EndOfSiding_step_2() { | ||
458 | super(GeneratedPQuery.INSTANCE); | ||
459 | } | ||
460 | |||
461 | /** | ||
462 | * @return the singleton instance of the query specification | ||
463 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
464 | * | ||
465 | */ | ||
466 | public static EndOfSiding_step_2 instance() { | ||
467 | try{ | ||
468 | return LazyHolder.INSTANCE; | ||
469 | } catch (ExceptionInInitializerError err) { | ||
470 | throw processInitializerError(err); | ||
471 | } | ||
472 | } | ||
473 | |||
474 | @Override | ||
475 | protected EndOfSiding_step_2.Matcher instantiate(final ViatraQueryEngine engine) { | ||
476 | return EndOfSiding_step_2.Matcher.on(engine); | ||
477 | } | ||
478 | |||
479 | @Override | ||
480 | public EndOfSiding_step_2.Matcher instantiate() { | ||
481 | return EndOfSiding_step_2.Matcher.create(); | ||
482 | } | ||
483 | |||
484 | @Override | ||
485 | public EndOfSiding_step_2.Match newEmptyMatch() { | ||
486 | return EndOfSiding_step_2.Match.newEmptyMatch(); | ||
487 | } | ||
488 | |||
489 | @Override | ||
490 | public EndOfSiding_step_2.Match newMatch(final Object... parameters) { | ||
491 | return EndOfSiding_step_2.Match.newMatch((modes3.Train) parameters[0]); | ||
492 | } | ||
493 | |||
494 | /** | ||
495 | * Inner class allowing the singleton instance of {@link EndOfSiding_step_2} to be created | ||
496 | * <b>not</b> at the class load time of the outer class, | ||
497 | * but rather at the first call to {@link EndOfSiding_step_2#instance()}. | ||
498 | * | ||
499 | * <p> This workaround is required e.g. to support recursion. | ||
500 | * | ||
501 | */ | ||
502 | private static class LazyHolder { | ||
503 | private static final EndOfSiding_step_2 INSTANCE = new EndOfSiding_step_2(); | ||
504 | |||
505 | /** | ||
506 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
507 | * This initialization order is required to support indirect recursion. | ||
508 | * | ||
509 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
510 | * | ||
511 | */ | ||
512 | private static final Object STATIC_INITIALIZER = ensureInitialized(); | ||
513 | |||
514 | public static Object ensureInitialized() { | ||
515 | INSTANCE.ensureInitializedInternal(); | ||
516 | return null; | ||
517 | } | ||
518 | } | ||
519 | |||
520 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
521 | private static final EndOfSiding_step_2.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
522 | |||
523 | private final PParameter parameter_train = new PParameter("train", "modes3.Train", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.ece.mcgill.ca/wcet/modes3", "Train")), PParameterDirection.INOUT); | ||
524 | |||
525 | private final List<PParameter> parameters = Arrays.asList(parameter_train); | ||
526 | |||
527 | private GeneratedPQuery() { | ||
528 | super(PVisibility.PUBLIC); | ||
529 | } | ||
530 | |||
531 | @Override | ||
532 | public String getFullyQualifiedName() { | ||
533 | return "modes3.queries.endOfSiding_step_2"; | ||
534 | } | ||
535 | |||
536 | @Override | ||
537 | public List<String> getParameterNames() { | ||
538 | return Arrays.asList("train"); | ||
539 | } | ||
540 | |||
541 | @Override | ||
542 | public List<PParameter> getParameters() { | ||
543 | return parameters; | ||
544 | } | ||
545 | |||
546 | @Override | ||
547 | public Set<PBody> doGetContainedBodies() { | ||
548 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
549 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
550 | { | ||
551 | PBody body = new PBody(this); | ||
552 | PVariable var_train = body.getOrCreateVariableByName("train"); | ||
553 | new TypeConstraint(body, Tuples.flatTupleOf(var_train), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.ece.mcgill.ca/wcet/modes3", "Train"))); | ||
554 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
555 | new ExportedParameter(body, var_train, parameter_train) | ||
556 | )); | ||
557 | // // frame->train = model->trains[i0];// frame->location = frame->train->location;// if (frame->location != NULL) {// ...// } Train(train) | ||
558 | new TypeConstraint(body, Tuples.flatTupleOf(var_train), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.ece.mcgill.ca/wcet/modes3", "Train"))); | ||
559 | bodies.add(body); | ||
560 | } | ||
561 | return bodies; | ||
562 | } | ||
563 | } | ||
564 | } | ||