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