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