diff options
Diffstat (limited to 'Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/SynchronizedRegionsAreNotSiblings.java')
-rw-r--r-- | Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/SynchronizedRegionsAreNotSiblings.java | 902 |
1 files changed, 902 insertions, 0 deletions
diff --git a/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/SynchronizedRegionsAreNotSiblings.java b/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/SynchronizedRegionsAreNotSiblings.java new file mode 100644 index 00000000..160c4aa0 --- /dev/null +++ b/Tests/ca.mcgill.ecse.dslreasoner.standalone.test/src-gen/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/SynchronizedRegionsAreNotSiblings.java | |||
@@ -0,0 +1,902 @@ | |||
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 ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Vertex; | ||
8 | import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.Transition; | ||
9 | import java.util.Arrays; | ||
10 | import java.util.Collection; | ||
11 | import java.util.LinkedHashSet; | ||
12 | import java.util.List; | ||
13 | import java.util.Objects; | ||
14 | import java.util.Optional; | ||
15 | import java.util.Set; | ||
16 | import java.util.function.Consumer; | ||
17 | import java.util.stream.Collectors; | ||
18 | import java.util.stream.Stream; | ||
19 | import org.apache.log4j.Logger; | ||
20 | import org.eclipse.emf.ecore.EClass; | ||
21 | import org.eclipse.viatra.query.runtime.api.IPatternMatch; | ||
22 | import org.eclipse.viatra.query.runtime.api.IQuerySpecification; | ||
23 | import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; | ||
24 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; | ||
25 | import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; | ||
26 | import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher; | ||
27 | import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch; | ||
28 | import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey; | ||
29 | import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey; | ||
30 | import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint; | ||
31 | import org.eclipse.viatra.query.runtime.matchers.psystem.PBody; | ||
32 | import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable; | ||
33 | import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation; | ||
34 | import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference; | ||
35 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality; | ||
36 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | ||
37 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Inequality; | ||
38 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; | ||
39 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | ||
40 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | ||
41 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; | ||
42 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; | ||
43 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; | ||
44 | import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; | ||
45 | import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; | ||
46 | |||
47 | /** | ||
48 | * A pattern-specific query specification that can instantiate Matcher in a type-safe way. | ||
49 | * | ||
50 | * <p>Original source: | ||
51 | * <code><pre> | ||
52 | * {@literal @}Constraint(severity="error", message="error", key = {s}) | ||
53 | * pattern SynchronizedRegionsAreNotSiblings(s : Synchronization, v1 : Vertex, v2 : Vertex) { | ||
54 | * find transition(_, v1, s); | ||
55 | * find transition(_, v2, s); | ||
56 | * CompositeElement.regions.vertices(r1, v1); | ||
57 | * CompositeElement.regions.vertices(r2, v2); | ||
58 | * r1 != r2; | ||
59 | * } or { | ||
60 | * find transition(_, s, v1); | ||
61 | * find transition(_, s, v2); | ||
62 | * CompositeElement.regions.vertices(r1, v1); | ||
63 | * CompositeElement.regions.vertices(r2, v2); | ||
64 | * r1 != r2; | ||
65 | * } | ||
66 | * </pre></code> | ||
67 | * | ||
68 | * @see Matcher | ||
69 | * @see Match | ||
70 | * | ||
71 | */ | ||
72 | @SuppressWarnings("all") | ||
73 | public final class SynchronizedRegionsAreNotSiblings extends BaseGeneratedEMFQuerySpecification<SynchronizedRegionsAreNotSiblings.Matcher> { | ||
74 | /** | ||
75 | * Pattern-specific match representation of the ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.SynchronizedRegionsAreNotSiblings pattern, | ||
76 | * to be used in conjunction with {@link Matcher}. | ||
77 | * | ||
78 | * <p>Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned. | ||
79 | * Each instance is a (possibly partial) substitution of pattern parameters, | ||
80 | * usable to represent a match of the pattern in the result of a query, | ||
81 | * or to specify the bound (fixed) input parameters when issuing a query. | ||
82 | * | ||
83 | * @see Matcher | ||
84 | * | ||
85 | */ | ||
86 | public static abstract class Match extends BasePatternMatch { | ||
87 | private Synchronization fS; | ||
88 | |||
89 | private Vertex fV1; | ||
90 | |||
91 | private Vertex fV2; | ||
92 | |||
93 | private static List<String> parameterNames = makeImmutableList("s", "v1", "v2"); | ||
94 | |||
95 | private Match(final Synchronization pS, final Vertex pV1, final Vertex pV2) { | ||
96 | this.fS = pS; | ||
97 | this.fV1 = pV1; | ||
98 | this.fV2 = pV2; | ||
99 | } | ||
100 | |||
101 | @Override | ||
102 | public Object get(final String parameterName) { | ||
103 | if ("s".equals(parameterName)) return this.fS; | ||
104 | if ("v1".equals(parameterName)) return this.fV1; | ||
105 | if ("v2".equals(parameterName)) return this.fV2; | ||
106 | return null; | ||
107 | } | ||
108 | |||
109 | public Synchronization getS() { | ||
110 | return this.fS; | ||
111 | } | ||
112 | |||
113 | public Vertex getV1() { | ||
114 | return this.fV1; | ||
115 | } | ||
116 | |||
117 | public Vertex getV2() { | ||
118 | return this.fV2; | ||
119 | } | ||
120 | |||
121 | @Override | ||
122 | public boolean set(final String parameterName, final Object newValue) { | ||
123 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
124 | if ("s".equals(parameterName) ) { | ||
125 | this.fS = (Synchronization) newValue; | ||
126 | return true; | ||
127 | } | ||
128 | if ("v1".equals(parameterName) ) { | ||
129 | this.fV1 = (Vertex) newValue; | ||
130 | return true; | ||
131 | } | ||
132 | if ("v2".equals(parameterName) ) { | ||
133 | this.fV2 = (Vertex) newValue; | ||
134 | return true; | ||
135 | } | ||
136 | return false; | ||
137 | } | ||
138 | |||
139 | public void setS(final Synchronization pS) { | ||
140 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
141 | this.fS = pS; | ||
142 | } | ||
143 | |||
144 | public void setV1(final Vertex pV1) { | ||
145 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
146 | this.fV1 = pV1; | ||
147 | } | ||
148 | |||
149 | public void setV2(final Vertex pV2) { | ||
150 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
151 | this.fV2 = pV2; | ||
152 | } | ||
153 | |||
154 | @Override | ||
155 | public String patternName() { | ||
156 | return "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.SynchronizedRegionsAreNotSiblings"; | ||
157 | } | ||
158 | |||
159 | @Override | ||
160 | public List<String> parameterNames() { | ||
161 | return SynchronizedRegionsAreNotSiblings.Match.parameterNames; | ||
162 | } | ||
163 | |||
164 | @Override | ||
165 | public Object[] toArray() { | ||
166 | return new Object[]{fS, fV1, fV2}; | ||
167 | } | ||
168 | |||
169 | @Override | ||
170 | public SynchronizedRegionsAreNotSiblings.Match toImmutable() { | ||
171 | return isMutable() ? newMatch(fS, fV1, fV2) : this; | ||
172 | } | ||
173 | |||
174 | @Override | ||
175 | public String prettyPrint() { | ||
176 | StringBuilder result = new StringBuilder(); | ||
177 | result.append("\"s\"=" + prettyPrintValue(fS) + ", "); | ||
178 | result.append("\"v1\"=" + prettyPrintValue(fV1) + ", "); | ||
179 | result.append("\"v2\"=" + prettyPrintValue(fV2)); | ||
180 | return result.toString(); | ||
181 | } | ||
182 | |||
183 | @Override | ||
184 | public int hashCode() { | ||
185 | return Objects.hash(fS, fV1, fV2); | ||
186 | } | ||
187 | |||
188 | @Override | ||
189 | public boolean equals(final Object obj) { | ||
190 | if (this == obj) | ||
191 | return true; | ||
192 | if (obj == null) { | ||
193 | return false; | ||
194 | } | ||
195 | if ((obj instanceof SynchronizedRegionsAreNotSiblings.Match)) { | ||
196 | SynchronizedRegionsAreNotSiblings.Match other = (SynchronizedRegionsAreNotSiblings.Match) obj; | ||
197 | return Objects.equals(fS, other.fS) && Objects.equals(fV1, other.fV1) && Objects.equals(fV2, other.fV2); | ||
198 | } else { | ||
199 | // this should be infrequent | ||
200 | if (!(obj instanceof IPatternMatch)) { | ||
201 | return false; | ||
202 | } | ||
203 | IPatternMatch otherSig = (IPatternMatch) obj; | ||
204 | return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray()); | ||
205 | } | ||
206 | } | ||
207 | |||
208 | @Override | ||
209 | public SynchronizedRegionsAreNotSiblings specification() { | ||
210 | return SynchronizedRegionsAreNotSiblings.instance(); | ||
211 | } | ||
212 | |||
213 | /** | ||
214 | * Returns an empty, mutable match. | ||
215 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
216 | * | ||
217 | * @return the empty match. | ||
218 | * | ||
219 | */ | ||
220 | public static SynchronizedRegionsAreNotSiblings.Match newEmptyMatch() { | ||
221 | return new Mutable(null, null, null); | ||
222 | } | ||
223 | |||
224 | /** | ||
225 | * Returns a mutable (partial) match. | ||
226 | * Fields of the mutable match can be filled to create a partial match, usable as matcher input. | ||
227 | * | ||
228 | * @param pS the fixed value of pattern parameter s, or null if not bound. | ||
229 | * @param pV1 the fixed value of pattern parameter v1, or null if not bound. | ||
230 | * @param pV2 the fixed value of pattern parameter v2, or null if not bound. | ||
231 | * @return the new, mutable (partial) match object. | ||
232 | * | ||
233 | */ | ||
234 | public static SynchronizedRegionsAreNotSiblings.Match newMutableMatch(final Synchronization pS, final Vertex pV1, final Vertex pV2) { | ||
235 | return new Mutable(pS, pV1, pV2); | ||
236 | } | ||
237 | |||
238 | /** | ||
239 | * Returns a new (partial) match. | ||
240 | * This can be used e.g. to call the matcher with a partial match. | ||
241 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
242 | * @param pS the fixed value of pattern parameter s, or null if not bound. | ||
243 | * @param pV1 the fixed value of pattern parameter v1, or null if not bound. | ||
244 | * @param pV2 the fixed value of pattern parameter v2, or null if not bound. | ||
245 | * @return the (partial) match object. | ||
246 | * | ||
247 | */ | ||
248 | public static SynchronizedRegionsAreNotSiblings.Match newMatch(final Synchronization pS, final Vertex pV1, final Vertex pV2) { | ||
249 | return new Immutable(pS, pV1, pV2); | ||
250 | } | ||
251 | |||
252 | private static final class Mutable extends SynchronizedRegionsAreNotSiblings.Match { | ||
253 | Mutable(final Synchronization pS, final Vertex pV1, final Vertex pV2) { | ||
254 | super(pS, pV1, pV2); | ||
255 | } | ||
256 | |||
257 | @Override | ||
258 | public boolean isMutable() { | ||
259 | return true; | ||
260 | } | ||
261 | } | ||
262 | |||
263 | private static final class Immutable extends SynchronizedRegionsAreNotSiblings.Match { | ||
264 | Immutable(final Synchronization pS, final Vertex pV1, final Vertex pV2) { | ||
265 | super(pS, pV1, pV2); | ||
266 | } | ||
267 | |||
268 | @Override | ||
269 | public boolean isMutable() { | ||
270 | return false; | ||
271 | } | ||
272 | } | ||
273 | } | ||
274 | |||
275 | /** | ||
276 | * Generated pattern matcher API of the ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.SynchronizedRegionsAreNotSiblings pattern, | ||
277 | * providing pattern-specific query methods. | ||
278 | * | ||
279 | * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)}, | ||
280 | * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}. | ||
281 | * | ||
282 | * <p>Matches of the pattern will be represented as {@link Match}. | ||
283 | * | ||
284 | * <p>Original source: | ||
285 | * <code><pre> | ||
286 | * {@literal @}Constraint(severity="error", message="error", key = {s}) | ||
287 | * pattern SynchronizedRegionsAreNotSiblings(s : Synchronization, v1 : Vertex, v2 : Vertex) { | ||
288 | * find transition(_, v1, s); | ||
289 | * find transition(_, v2, s); | ||
290 | * CompositeElement.regions.vertices(r1, v1); | ||
291 | * CompositeElement.regions.vertices(r2, v2); | ||
292 | * r1 != r2; | ||
293 | * } or { | ||
294 | * find transition(_, s, v1); | ||
295 | * find transition(_, s, v2); | ||
296 | * CompositeElement.regions.vertices(r1, v1); | ||
297 | * CompositeElement.regions.vertices(r2, v2); | ||
298 | * r1 != r2; | ||
299 | * } | ||
300 | * </pre></code> | ||
301 | * | ||
302 | * @see Match | ||
303 | * @see SynchronizedRegionsAreNotSiblings | ||
304 | * | ||
305 | */ | ||
306 | public static class Matcher extends BaseMatcher<SynchronizedRegionsAreNotSiblings.Match> { | ||
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 | public static SynchronizedRegionsAreNotSiblings.Matcher on(final ViatraQueryEngine engine) { | ||
316 | // check if matcher already exists | ||
317 | Matcher matcher = engine.getExistingMatcher(querySpecification()); | ||
318 | if (matcher == null) { | ||
319 | matcher = (Matcher)engine.getMatcher(querySpecification()); | ||
320 | } | ||
321 | return matcher; | ||
322 | } | ||
323 | |||
324 | /** | ||
325 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
326 | * @return an initialized matcher | ||
327 | * @noreference This method is for internal matcher initialization by the framework, do not call it manually. | ||
328 | * | ||
329 | */ | ||
330 | public static SynchronizedRegionsAreNotSiblings.Matcher create() { | ||
331 | return new Matcher(); | ||
332 | } | ||
333 | |||
334 | private final static int POSITION_S = 0; | ||
335 | |||
336 | private final static int POSITION_V1 = 1; | ||
337 | |||
338 | private final static int POSITION_V2 = 2; | ||
339 | |||
340 | private final static Logger LOGGER = ViatraQueryLoggingUtil.getLogger(SynchronizedRegionsAreNotSiblings.Matcher.class); | ||
341 | |||
342 | /** | ||
343 | * Initializes the pattern matcher within an existing VIATRA Query engine. | ||
344 | * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. | ||
345 | * | ||
346 | * @param engine the existing VIATRA Query engine in which this matcher will be created. | ||
347 | * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation | ||
348 | * | ||
349 | */ | ||
350 | private Matcher() { | ||
351 | super(querySpecification()); | ||
352 | } | ||
353 | |||
354 | /** | ||
355 | * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters. | ||
356 | * @param pS the fixed value of pattern parameter s, or null if not bound. | ||
357 | * @param pV1 the fixed value of pattern parameter v1, or null if not bound. | ||
358 | * @param pV2 the fixed value of pattern parameter v2, or null if not bound. | ||
359 | * @return matches represented as a Match object. | ||
360 | * | ||
361 | */ | ||
362 | public Collection<SynchronizedRegionsAreNotSiblings.Match> getAllMatches(final Synchronization pS, final Vertex pV1, final Vertex pV2) { | ||
363 | return rawStreamAllMatches(new Object[]{pS, pV1, pV2}).collect(Collectors.toSet()); | ||
364 | } | ||
365 | |||
366 | /** | ||
367 | * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. | ||
368 | * </p> | ||
369 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
370 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
371 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
372 | * @param pS the fixed value of pattern parameter s, or null if not bound. | ||
373 | * @param pV1 the fixed value of pattern parameter v1, or null if not bound. | ||
374 | * @param pV2 the fixed value of pattern parameter v2, or null if not bound. | ||
375 | * @return a stream of matches represented as a Match object. | ||
376 | * | ||
377 | */ | ||
378 | public Stream<SynchronizedRegionsAreNotSiblings.Match> streamAllMatches(final Synchronization pS, final Vertex pV1, final Vertex pV2) { | ||
379 | return rawStreamAllMatches(new Object[]{pS, pV1, pV2}); | ||
380 | } | ||
381 | |||
382 | /** | ||
383 | * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
384 | * Neither determinism nor randomness of selection is guaranteed. | ||
385 | * @param pS the fixed value of pattern parameter s, or null if not bound. | ||
386 | * @param pV1 the fixed value of pattern parameter v1, or null if not bound. | ||
387 | * @param pV2 the fixed value of pattern parameter v2, or null if not bound. | ||
388 | * @return a match represented as a Match object, or null if no match is found. | ||
389 | * | ||
390 | */ | ||
391 | public Optional<SynchronizedRegionsAreNotSiblings.Match> getOneArbitraryMatch(final Synchronization pS, final Vertex pV1, final Vertex pV2) { | ||
392 | return rawGetOneArbitraryMatch(new Object[]{pS, pV1, pV2}); | ||
393 | } | ||
394 | |||
395 | /** | ||
396 | * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, | ||
397 | * under any possible substitution of the unspecified parameters (if any). | ||
398 | * @param pS the fixed value of pattern parameter s, or null if not bound. | ||
399 | * @param pV1 the fixed value of pattern parameter v1, or null if not bound. | ||
400 | * @param pV2 the fixed value of pattern parameter v2, or null if not bound. | ||
401 | * @return true if the input is a valid (partial) match of the pattern. | ||
402 | * | ||
403 | */ | ||
404 | public boolean hasMatch(final Synchronization pS, final Vertex pV1, final Vertex pV2) { | ||
405 | return rawHasMatch(new Object[]{pS, pV1, pV2}); | ||
406 | } | ||
407 | |||
408 | /** | ||
409 | * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters. | ||
410 | * @param pS the fixed value of pattern parameter s, or null if not bound. | ||
411 | * @param pV1 the fixed value of pattern parameter v1, or null if not bound. | ||
412 | * @param pV2 the fixed value of pattern parameter v2, or null if not bound. | ||
413 | * @return the number of pattern matches found. | ||
414 | * | ||
415 | */ | ||
416 | public int countMatches(final Synchronization pS, final Vertex pV1, final Vertex pV2) { | ||
417 | return rawCountMatches(new Object[]{pS, pV1, pV2}); | ||
418 | } | ||
419 | |||
420 | /** | ||
421 | * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. | ||
422 | * Neither determinism nor randomness of selection is guaranteed. | ||
423 | * @param pS the fixed value of pattern parameter s, or null if not bound. | ||
424 | * @param pV1 the fixed value of pattern parameter v1, or null if not bound. | ||
425 | * @param pV2 the fixed value of pattern parameter v2, or null if not bound. | ||
426 | * @param processor the action that will process the selected match. | ||
427 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | ||
428 | * | ||
429 | */ | ||
430 | public boolean forOneArbitraryMatch(final Synchronization pS, final Vertex pV1, final Vertex pV2, final Consumer<? super SynchronizedRegionsAreNotSiblings.Match> processor) { | ||
431 | return rawForOneArbitraryMatch(new Object[]{pS, pV1, pV2}, processor); | ||
432 | } | ||
433 | |||
434 | /** | ||
435 | * Returns a new (partial) match. | ||
436 | * This can be used e.g. to call the matcher with a partial match. | ||
437 | * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object. | ||
438 | * @param pS the fixed value of pattern parameter s, or null if not bound. | ||
439 | * @param pV1 the fixed value of pattern parameter v1, or null if not bound. | ||
440 | * @param pV2 the fixed value of pattern parameter v2, or null if not bound. | ||
441 | * @return the (partial) match object. | ||
442 | * | ||
443 | */ | ||
444 | public SynchronizedRegionsAreNotSiblings.Match newMatch(final Synchronization pS, final Vertex pV1, final Vertex pV2) { | ||
445 | return SynchronizedRegionsAreNotSiblings.Match.newMatch(pS, pV1, pV2); | ||
446 | } | ||
447 | |||
448 | /** | ||
449 | * Retrieve the set of values that occur in matches for s. | ||
450 | * @return the Set of all values or empty set if there are no matches | ||
451 | * | ||
452 | */ | ||
453 | protected Stream<Synchronization> rawStreamAllValuesOfs(final Object[] parameters) { | ||
454 | return rawStreamAllValues(POSITION_S, parameters).map(Synchronization.class::cast); | ||
455 | } | ||
456 | |||
457 | /** | ||
458 | * Retrieve the set of values that occur in matches for s. | ||
459 | * @return the Set of all values or empty set if there are no matches | ||
460 | * | ||
461 | */ | ||
462 | public Set<Synchronization> getAllValuesOfs() { | ||
463 | return rawStreamAllValuesOfs(emptyArray()).collect(Collectors.toSet()); | ||
464 | } | ||
465 | |||
466 | /** | ||
467 | * Retrieve the set of values that occur in matches for s. | ||
468 | * @return the Set of all values or empty set if there are no matches | ||
469 | * | ||
470 | */ | ||
471 | public Stream<Synchronization> streamAllValuesOfs() { | ||
472 | return rawStreamAllValuesOfs(emptyArray()); | ||
473 | } | ||
474 | |||
475 | /** | ||
476 | * Retrieve the set of values that occur in matches for s. | ||
477 | * </p> | ||
478 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
479 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
480 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
481 | * | ||
482 | * @return the Stream of all values or empty set if there are no matches | ||
483 | * | ||
484 | */ | ||
485 | public Stream<Synchronization> streamAllValuesOfs(final SynchronizedRegionsAreNotSiblings.Match partialMatch) { | ||
486 | return rawStreamAllValuesOfs(partialMatch.toArray()); | ||
487 | } | ||
488 | |||
489 | /** | ||
490 | * Retrieve the set of values that occur in matches for s. | ||
491 | * </p> | ||
492 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
493 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
494 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
495 | * | ||
496 | * @return the Stream of all values or empty set if there are no matches | ||
497 | * | ||
498 | */ | ||
499 | public Stream<Synchronization> streamAllValuesOfs(final Vertex pV1, final Vertex pV2) { | ||
500 | return rawStreamAllValuesOfs(new Object[]{null, pV1, pV2}); | ||
501 | } | ||
502 | |||
503 | /** | ||
504 | * Retrieve the set of values that occur in matches for s. | ||
505 | * @return the Set of all values or empty set if there are no matches | ||
506 | * | ||
507 | */ | ||
508 | public Set<Synchronization> getAllValuesOfs(final SynchronizedRegionsAreNotSiblings.Match partialMatch) { | ||
509 | return rawStreamAllValuesOfs(partialMatch.toArray()).collect(Collectors.toSet()); | ||
510 | } | ||
511 | |||
512 | /** | ||
513 | * Retrieve the set of values that occur in matches for s. | ||
514 | * @return the Set of all values or empty set if there are no matches | ||
515 | * | ||
516 | */ | ||
517 | public Set<Synchronization> getAllValuesOfs(final Vertex pV1, final Vertex pV2) { | ||
518 | return rawStreamAllValuesOfs(new Object[]{null, pV1, pV2}).collect(Collectors.toSet()); | ||
519 | } | ||
520 | |||
521 | /** | ||
522 | * Retrieve the set of values that occur in matches for v1. | ||
523 | * @return the Set of all values or empty set if there are no matches | ||
524 | * | ||
525 | */ | ||
526 | protected Stream<Vertex> rawStreamAllValuesOfv1(final Object[] parameters) { | ||
527 | return rawStreamAllValues(POSITION_V1, parameters).map(Vertex.class::cast); | ||
528 | } | ||
529 | |||
530 | /** | ||
531 | * Retrieve the set of values that occur in matches for v1. | ||
532 | * @return the Set of all values or empty set if there are no matches | ||
533 | * | ||
534 | */ | ||
535 | public Set<Vertex> getAllValuesOfv1() { | ||
536 | return rawStreamAllValuesOfv1(emptyArray()).collect(Collectors.toSet()); | ||
537 | } | ||
538 | |||
539 | /** | ||
540 | * Retrieve the set of values that occur in matches for v1. | ||
541 | * @return the Set of all values or empty set if there are no matches | ||
542 | * | ||
543 | */ | ||
544 | public Stream<Vertex> streamAllValuesOfv1() { | ||
545 | return rawStreamAllValuesOfv1(emptyArray()); | ||
546 | } | ||
547 | |||
548 | /** | ||
549 | * Retrieve the set of values that occur in matches for v1. | ||
550 | * </p> | ||
551 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
552 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
553 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
554 | * | ||
555 | * @return the Stream of all values or empty set if there are no matches | ||
556 | * | ||
557 | */ | ||
558 | public Stream<Vertex> streamAllValuesOfv1(final SynchronizedRegionsAreNotSiblings.Match partialMatch) { | ||
559 | return rawStreamAllValuesOfv1(partialMatch.toArray()); | ||
560 | } | ||
561 | |||
562 | /** | ||
563 | * Retrieve the set of values that occur in matches for v1. | ||
564 | * </p> | ||
565 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
566 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
567 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
568 | * | ||
569 | * @return the Stream of all values or empty set if there are no matches | ||
570 | * | ||
571 | */ | ||
572 | public Stream<Vertex> streamAllValuesOfv1(final Synchronization pS, final Vertex pV2) { | ||
573 | return rawStreamAllValuesOfv1(new Object[]{pS, null, pV2}); | ||
574 | } | ||
575 | |||
576 | /** | ||
577 | * Retrieve the set of values that occur in matches for v1. | ||
578 | * @return the Set of all values or empty set if there are no matches | ||
579 | * | ||
580 | */ | ||
581 | public Set<Vertex> getAllValuesOfv1(final SynchronizedRegionsAreNotSiblings.Match partialMatch) { | ||
582 | return rawStreamAllValuesOfv1(partialMatch.toArray()).collect(Collectors.toSet()); | ||
583 | } | ||
584 | |||
585 | /** | ||
586 | * Retrieve the set of values that occur in matches for v1. | ||
587 | * @return the Set of all values or empty set if there are no matches | ||
588 | * | ||
589 | */ | ||
590 | public Set<Vertex> getAllValuesOfv1(final Synchronization pS, final Vertex pV2) { | ||
591 | return rawStreamAllValuesOfv1(new Object[]{pS, null, pV2}).collect(Collectors.toSet()); | ||
592 | } | ||
593 | |||
594 | /** | ||
595 | * Retrieve the set of values that occur in matches for v2. | ||
596 | * @return the Set of all values or empty set if there are no matches | ||
597 | * | ||
598 | */ | ||
599 | protected Stream<Vertex> rawStreamAllValuesOfv2(final Object[] parameters) { | ||
600 | return rawStreamAllValues(POSITION_V2, parameters).map(Vertex.class::cast); | ||
601 | } | ||
602 | |||
603 | /** | ||
604 | * Retrieve the set of values that occur in matches for v2. | ||
605 | * @return the Set of all values or empty set if there are no matches | ||
606 | * | ||
607 | */ | ||
608 | public Set<Vertex> getAllValuesOfv2() { | ||
609 | return rawStreamAllValuesOfv2(emptyArray()).collect(Collectors.toSet()); | ||
610 | } | ||
611 | |||
612 | /** | ||
613 | * Retrieve the set of values that occur in matches for v2. | ||
614 | * @return the Set of all values or empty set if there are no matches | ||
615 | * | ||
616 | */ | ||
617 | public Stream<Vertex> streamAllValuesOfv2() { | ||
618 | return rawStreamAllValuesOfv2(emptyArray()); | ||
619 | } | ||
620 | |||
621 | /** | ||
622 | * Retrieve the set of values that occur in matches for v2. | ||
623 | * </p> | ||
624 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
625 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
626 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
627 | * | ||
628 | * @return the Stream of all values or empty set if there are no matches | ||
629 | * | ||
630 | */ | ||
631 | public Stream<Vertex> streamAllValuesOfv2(final SynchronizedRegionsAreNotSiblings.Match partialMatch) { | ||
632 | return rawStreamAllValuesOfv2(partialMatch.toArray()); | ||
633 | } | ||
634 | |||
635 | /** | ||
636 | * Retrieve the set of values that occur in matches for v2. | ||
637 | * </p> | ||
638 | * <strong>NOTE</strong>: It is important not to modify the source model while the stream is being processed. | ||
639 | * If the match set of the pattern changes during processing, the contents of the stream is <strong>undefined</strong>. | ||
640 | * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code. | ||
641 | * | ||
642 | * @return the Stream of all values or empty set if there are no matches | ||
643 | * | ||
644 | */ | ||
645 | public Stream<Vertex> streamAllValuesOfv2(final Synchronization pS, final Vertex pV1) { | ||
646 | return rawStreamAllValuesOfv2(new Object[]{pS, pV1, null}); | ||
647 | } | ||
648 | |||
649 | /** | ||
650 | * Retrieve the set of values that occur in matches for v2. | ||
651 | * @return the Set of all values or empty set if there are no matches | ||
652 | * | ||
653 | */ | ||
654 | public Set<Vertex> getAllValuesOfv2(final SynchronizedRegionsAreNotSiblings.Match partialMatch) { | ||
655 | return rawStreamAllValuesOfv2(partialMatch.toArray()).collect(Collectors.toSet()); | ||
656 | } | ||
657 | |||
658 | /** | ||
659 | * Retrieve the set of values that occur in matches for v2. | ||
660 | * @return the Set of all values or empty set if there are no matches | ||
661 | * | ||
662 | */ | ||
663 | public Set<Vertex> getAllValuesOfv2(final Synchronization pS, final Vertex pV1) { | ||
664 | return rawStreamAllValuesOfv2(new Object[]{pS, pV1, null}).collect(Collectors.toSet()); | ||
665 | } | ||
666 | |||
667 | @Override | ||
668 | protected SynchronizedRegionsAreNotSiblings.Match tupleToMatch(final Tuple t) { | ||
669 | try { | ||
670 | return SynchronizedRegionsAreNotSiblings.Match.newMatch((Synchronization) t.get(POSITION_S), (Vertex) t.get(POSITION_V1), (Vertex) t.get(POSITION_V2)); | ||
671 | } catch(ClassCastException e) { | ||
672 | LOGGER.error("Element(s) in tuple not properly typed!",e); | ||
673 | return null; | ||
674 | } | ||
675 | } | ||
676 | |||
677 | @Override | ||
678 | protected SynchronizedRegionsAreNotSiblings.Match arrayToMatch(final Object[] match) { | ||
679 | try { | ||
680 | return SynchronizedRegionsAreNotSiblings.Match.newMatch((Synchronization) match[POSITION_S], (Vertex) match[POSITION_V1], (Vertex) match[POSITION_V2]); | ||
681 | } catch(ClassCastException e) { | ||
682 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
683 | return null; | ||
684 | } | ||
685 | } | ||
686 | |||
687 | @Override | ||
688 | protected SynchronizedRegionsAreNotSiblings.Match arrayToMatchMutable(final Object[] match) { | ||
689 | try { | ||
690 | return SynchronizedRegionsAreNotSiblings.Match.newMutableMatch((Synchronization) match[POSITION_S], (Vertex) match[POSITION_V1], (Vertex) match[POSITION_V2]); | ||
691 | } catch(ClassCastException e) { | ||
692 | LOGGER.error("Element(s) in array not properly typed!",e); | ||
693 | return null; | ||
694 | } | ||
695 | } | ||
696 | |||
697 | /** | ||
698 | * @return the singleton instance of the query specification of this pattern | ||
699 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
700 | * | ||
701 | */ | ||
702 | public static IQuerySpecification<SynchronizedRegionsAreNotSiblings.Matcher> querySpecification() { | ||
703 | return SynchronizedRegionsAreNotSiblings.instance(); | ||
704 | } | ||
705 | } | ||
706 | |||
707 | private SynchronizedRegionsAreNotSiblings() { | ||
708 | super(GeneratedPQuery.INSTANCE); | ||
709 | } | ||
710 | |||
711 | /** | ||
712 | * @return the singleton instance of the query specification | ||
713 | * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded | ||
714 | * | ||
715 | */ | ||
716 | public static SynchronizedRegionsAreNotSiblings instance() { | ||
717 | try{ | ||
718 | return LazyHolder.INSTANCE; | ||
719 | } catch (ExceptionInInitializerError err) { | ||
720 | throw processInitializerError(err); | ||
721 | } | ||
722 | } | ||
723 | |||
724 | @Override | ||
725 | protected SynchronizedRegionsAreNotSiblings.Matcher instantiate(final ViatraQueryEngine engine) { | ||
726 | return SynchronizedRegionsAreNotSiblings.Matcher.on(engine); | ||
727 | } | ||
728 | |||
729 | @Override | ||
730 | public SynchronizedRegionsAreNotSiblings.Matcher instantiate() { | ||
731 | return SynchronizedRegionsAreNotSiblings.Matcher.create(); | ||
732 | } | ||
733 | |||
734 | @Override | ||
735 | public SynchronizedRegionsAreNotSiblings.Match newEmptyMatch() { | ||
736 | return SynchronizedRegionsAreNotSiblings.Match.newEmptyMatch(); | ||
737 | } | ||
738 | |||
739 | @Override | ||
740 | public SynchronizedRegionsAreNotSiblings.Match newMatch(final Object... parameters) { | ||
741 | return SynchronizedRegionsAreNotSiblings.Match.newMatch((ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Synchronization) parameters[0], (ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Vertex) parameters[1], (ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Vertex) parameters[2]); | ||
742 | } | ||
743 | |||
744 | /** | ||
745 | * Inner class allowing the singleton instance of {@link JvmGenericType: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.SynchronizedRegionsAreNotSiblings (visibility: PUBLIC, simpleName: SynchronizedRegionsAreNotSiblings, identifier: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.SynchronizedRegionsAreNotSiblings, 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 | ||
746 | * <b>not</b> at the class load time of the outer class, | ||
747 | * but rather at the first call to {@link JvmGenericType: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.SynchronizedRegionsAreNotSiblings (visibility: PUBLIC, simpleName: SynchronizedRegionsAreNotSiblings, identifier: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.SynchronizedRegionsAreNotSiblings, deprecated: <unset>) (abstract: false, static: false, final: true, packageName: ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}. | ||
748 | * | ||
749 | * <p> This workaround is required e.g. to support recursion. | ||
750 | * | ||
751 | */ | ||
752 | private static class LazyHolder { | ||
753 | private final static SynchronizedRegionsAreNotSiblings INSTANCE = new SynchronizedRegionsAreNotSiblings(); | ||
754 | |||
755 | /** | ||
756 | * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned. | ||
757 | * This initialization order is required to support indirect recursion. | ||
758 | * | ||
759 | * <p> The static initializer is defined using a helper field to work around limitations of the code generator. | ||
760 | * | ||
761 | */ | ||
762 | private final static Object STATIC_INITIALIZER = ensureInitialized(); | ||
763 | |||
764 | public static Object ensureInitialized() { | ||
765 | INSTANCE.ensureInitializedInternal(); | ||
766 | return null; | ||
767 | } | ||
768 | } | ||
769 | |||
770 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | ||
771 | private final static SynchronizedRegionsAreNotSiblings.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
772 | |||
773 | private final PParameter parameter_s = new PParameter("s", "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Synchronization", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("YakinduMetamodel", "Synchronization")), PParameterDirection.INOUT); | ||
774 | |||
775 | private final PParameter parameter_v1 = new PParameter("v1", "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Vertex", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("YakinduMetamodel", "Vertex")), PParameterDirection.INOUT); | ||
776 | |||
777 | private final PParameter parameter_v2 = new PParameter("v2", "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Vertex", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("YakinduMetamodel", "Vertex")), PParameterDirection.INOUT); | ||
778 | |||
779 | private final List<PParameter> parameters = Arrays.asList(parameter_s, parameter_v1, parameter_v2); | ||
780 | |||
781 | private GeneratedPQuery() { | ||
782 | super(PVisibility.PUBLIC); | ||
783 | } | ||
784 | |||
785 | @Override | ||
786 | public String getFullyQualifiedName() { | ||
787 | return "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.SynchronizedRegionsAreNotSiblings"; | ||
788 | } | ||
789 | |||
790 | @Override | ||
791 | public List<String> getParameterNames() { | ||
792 | return Arrays.asList("s","v1","v2"); | ||
793 | } | ||
794 | |||
795 | @Override | ||
796 | public List<PParameter> getParameters() { | ||
797 | return parameters; | ||
798 | } | ||
799 | |||
800 | @Override | ||
801 | public Set<PBody> doGetContainedBodies() { | ||
802 | setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED)); | ||
803 | Set<PBody> bodies = new LinkedHashSet<>(); | ||
804 | { | ||
805 | PBody body = new PBody(this); | ||
806 | PVariable var_s = body.getOrCreateVariableByName("s"); | ||
807 | PVariable var_v1 = body.getOrCreateVariableByName("v1"); | ||
808 | PVariable var_v2 = body.getOrCreateVariableByName("v2"); | ||
809 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | ||
810 | PVariable var___1_ = body.getOrCreateVariableByName("_<1>"); | ||
811 | PVariable var_r1 = body.getOrCreateVariableByName("r1"); | ||
812 | PVariable var_r2 = body.getOrCreateVariableByName("r2"); | ||
813 | new TypeConstraint(body, Tuples.flatTupleOf(var_s), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Synchronization"))); | ||
814 | new TypeConstraint(body, Tuples.flatTupleOf(var_v1), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Vertex"))); | ||
815 | new TypeConstraint(body, Tuples.flatTupleOf(var_v2), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Vertex"))); | ||
816 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
817 | new ExportedParameter(body, var_s, parameter_s), | ||
818 | new ExportedParameter(body, var_v1, parameter_v1), | ||
819 | new ExportedParameter(body, var_v2, parameter_v2) | ||
820 | )); | ||
821 | // find transition(_, v1, s) | ||
822 | new PositivePatternCall(body, Tuples.flatTupleOf(var___0_, var_v1, var_s), Transition.instance().getInternalQueryRepresentation()); | ||
823 | // find transition(_, v2, s) | ||
824 | new PositivePatternCall(body, Tuples.flatTupleOf(var___1_, var_v2, var_s), Transition.instance().getInternalQueryRepresentation()); | ||
825 | // CompositeElement.regions.vertices(r1, v1) | ||
826 | new TypeConstraint(body, Tuples.flatTupleOf(var_r1), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "CompositeElement"))); | ||
827 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
828 | new TypeConstraint(body, Tuples.flatTupleOf(var_r1, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("YakinduMetamodel", "CompositeElement", "regions"))); | ||
829 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Region"))); | ||
830 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
831 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("YakinduMetamodel", "Region", "vertices"))); | ||
832 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Vertex"))); | ||
833 | new Equality(body, var__virtual_1_, var_v1); | ||
834 | // CompositeElement.regions.vertices(r2, v2) | ||
835 | new TypeConstraint(body, Tuples.flatTupleOf(var_r2), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "CompositeElement"))); | ||
836 | PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); | ||
837 | new TypeConstraint(body, Tuples.flatTupleOf(var_r2, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("YakinduMetamodel", "CompositeElement", "regions"))); | ||
838 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Region"))); | ||
839 | PVariable var__virtual_3_ = body.getOrCreateVariableByName(".virtual{3}"); | ||
840 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_, var__virtual_3_), new EStructuralFeatureInstancesKey(getFeatureLiteral("YakinduMetamodel", "Region", "vertices"))); | ||
841 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_3_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Vertex"))); | ||
842 | new Equality(body, var__virtual_3_, var_v2); | ||
843 | // r1 != r2 | ||
844 | new Inequality(body, var_r1, var_r2); | ||
845 | bodies.add(body); | ||
846 | } | ||
847 | { | ||
848 | PBody body = new PBody(this); | ||
849 | PVariable var_s = body.getOrCreateVariableByName("s"); | ||
850 | PVariable var_v1 = body.getOrCreateVariableByName("v1"); | ||
851 | PVariable var_v2 = body.getOrCreateVariableByName("v2"); | ||
852 | PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); | ||
853 | PVariable var___1_ = body.getOrCreateVariableByName("_<1>"); | ||
854 | PVariable var_r1 = body.getOrCreateVariableByName("r1"); | ||
855 | PVariable var_r2 = body.getOrCreateVariableByName("r2"); | ||
856 | new TypeConstraint(body, Tuples.flatTupleOf(var_s), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Synchronization"))); | ||
857 | new TypeConstraint(body, Tuples.flatTupleOf(var_v1), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Vertex"))); | ||
858 | new TypeConstraint(body, Tuples.flatTupleOf(var_v2), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Vertex"))); | ||
859 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
860 | new ExportedParameter(body, var_s, parameter_s), | ||
861 | new ExportedParameter(body, var_v1, parameter_v1), | ||
862 | new ExportedParameter(body, var_v2, parameter_v2) | ||
863 | )); | ||
864 | // find transition(_, s, v1) | ||
865 | new PositivePatternCall(body, Tuples.flatTupleOf(var___0_, var_s, var_v1), Transition.instance().getInternalQueryRepresentation()); | ||
866 | // find transition(_, s, v2) | ||
867 | new PositivePatternCall(body, Tuples.flatTupleOf(var___1_, var_s, var_v2), Transition.instance().getInternalQueryRepresentation()); | ||
868 | // CompositeElement.regions.vertices(r1, v1) | ||
869 | new TypeConstraint(body, Tuples.flatTupleOf(var_r1), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "CompositeElement"))); | ||
870 | PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); | ||
871 | new TypeConstraint(body, Tuples.flatTupleOf(var_r1, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("YakinduMetamodel", "CompositeElement", "regions"))); | ||
872 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Region"))); | ||
873 | PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}"); | ||
874 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("YakinduMetamodel", "Region", "vertices"))); | ||
875 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Vertex"))); | ||
876 | new Equality(body, var__virtual_1_, var_v1); | ||
877 | // CompositeElement.regions.vertices(r2, v2) | ||
878 | new TypeConstraint(body, Tuples.flatTupleOf(var_r2), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "CompositeElement"))); | ||
879 | PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}"); | ||
880 | new TypeConstraint(body, Tuples.flatTupleOf(var_r2, var__virtual_2_), new EStructuralFeatureInstancesKey(getFeatureLiteral("YakinduMetamodel", "CompositeElement", "regions"))); | ||
881 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Region"))); | ||
882 | PVariable var__virtual_3_ = body.getOrCreateVariableByName(".virtual{3}"); | ||
883 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_2_, var__virtual_3_), new EStructuralFeatureInstancesKey(getFeatureLiteral("YakinduMetamodel", "Region", "vertices"))); | ||
884 | new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_3_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("YakinduMetamodel", "Vertex"))); | ||
885 | new Equality(body, var__virtual_3_, var_v2); | ||
886 | // r1 != r2 | ||
887 | new Inequality(body, var_r1, var_r2); | ||
888 | bodies.add(body); | ||
889 | } | ||
890 | { | ||
891 | PAnnotation annotation = new PAnnotation("Constraint"); | ||
892 | annotation.addAttribute("severity", "error"); | ||
893 | annotation.addAttribute("message", "error"); | ||
894 | annotation.addAttribute("key", Arrays.asList(new Object[] { | ||
895 | new ParameterReference("s") | ||
896 | })); | ||
897 | addAnnotation(annotation); | ||
898 | } | ||
899 | return bodies; | ||
900 | } | ||
901 | } | ||
902 | } | ||