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