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