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