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