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