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