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