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