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