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