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