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