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