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