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