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