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