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