diff options
Diffstat (limited to 'Tests/MODELS2020-CaseStudies/case.study.pledge.queries/src-gen/queries/Inv48.java')
-rw-r--r-- | Tests/MODELS2020-CaseStudies/case.study.pledge.queries/src-gen/queries/Inv48.java | 566 |
1 files changed, 566 insertions, 0 deletions
diff --git a/Tests/MODELS2020-CaseStudies/case.study.pledge.queries/src-gen/queries/Inv48.java b/Tests/MODELS2020-CaseStudies/case.study.pledge.queries/src-gen/queries/Inv48.java new file mode 100644 index 00000000..66c66988 --- /dev/null +++ b/Tests/MODELS2020-CaseStudies/case.study.pledge.queries/src-gen/queries/Inv48.java | |||
@@ -0,0 +1,566 @@ | |||
1 | /** | ||
2 | * Generated from platform:/resource/case.study.a.queries/src/queries/case_study_A.vql | ||
3 | */ | ||
4 | package queries; | ||
5 | |||
6 | import Taxation.Physical_Person; | ||
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_inv48_Dis; | ||
42 | import queries.X_inv48_notDis; | ||
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 | * //inv48-attributes-handled by multiplicity | ||
50 | * {@literal @}Constraint(message = "inv48", severity = "error", key = {p}) | ||
51 | * pattern inv48(p : Physical_Person) { | ||
52 | * neg find x_inv48_notDis(p); | ||
53 | * neg find x_inv48_Dis(p); | ||
54 | * } | ||
55 | * </pre></code> | ||
56 | * | ||
57 | * @see Matcher | ||
58 | * @see Match | ||
59 | * | ||
60 | */ | ||
61 | @SuppressWarnings("all") | ||
62 | public final class Inv48 extends BaseGeneratedEMFQuerySpecification<Inv48.Matcher> { | ||
63 | /** | ||
64 | * Pattern-specific match representation of the queries.inv48 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 Physical_Person fP; | ||
77 | |||
78 | private static List<String> parameterNames = makeImmutableList("p"); | ||
79 | |||
80 | private Match(final Physical_Person pP) { | ||
81 | this.fP = pP; | ||
82 | } | ||
83 | |||
84 | @Override | ||
85 | public Object get(final String parameterName) { | ||
86 | switch(parameterName) { | ||
87 | case "p": return this.fP; | ||
88 | default: return null; | ||
89 | } | ||
90 | } | ||
91 | |||
92 | @Override | ||
93 | public Object get(final int index) { | ||
94 | switch(index) { | ||
95 | case 0: return this.fP; | ||
96 | default: return null; | ||
97 | } | ||
98 | } | ||
99 | |||
100 | public Physical_Person getP() { | ||
101 | return this.fP; | ||
102 | } | ||
103 | |||
104 | @Override | ||
105 | public boolean set(final String parameterName, final Object newValue) { | ||
106 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
107 | if ("p".equals(parameterName) ) { | ||
108 | this.fP = (Physical_Person) newValue; | ||
109 | return true; | ||
110 | } | ||
111 | return false; | ||
112 | } | ||
113 | |||
114 | public void setP(final Physical_Person pP) { | ||
115 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | ||
116 | this.fP = pP; | ||
117 | } | ||
118 | |||
119 | @Override | ||
120 | public String patternName() { | ||
121 | return "queries.inv48"; | ||
122 | } | ||
123 | |||
124 | @Override | ||
125 | public List<String> parameterNames() { | ||
126 | return Inv48.Match.parameterNames; | ||
127 | } | ||
128 | |||
129 | @Override | ||
130 | public Object[] toArray() { | ||
131 | return new Object[]{fP}; | ||
132 | } | ||
133 | |||
134 | @Override | ||
135 | public Inv48.Match toImmutable() { | ||
136 | return isMutable() ? newMatch(fP) : this; | ||
137 | } | ||
138 | |||
139 | @Override | ||
140 | public String prettyPrint() { | ||
141 | StringBuilder result = new StringBuilder(); | ||
142 | result.append("\"p\"=" + prettyPrintValue(fP)); | ||
143 | return result.toString(); | ||
144 | } | ||
145 | |||
146 | @Override | ||
147 | public int hashCode() { | ||
148 | return Objects.hash(fP); | ||
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 Inv48.Match)) { | ||
159 | Inv48.Match other = (Inv48.Match) obj; | ||
160 | return Objects.equals(fP, other.fP); | ||
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 Inv48 specification() { | ||
173 | return Inv48.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 Inv48.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 pP the fixed value of pattern parameter p, or null if not bound. | ||
192 | * @return the new, mutable (partial) match object. | ||
193 | * | ||
194 | */ | ||
195 | public static Inv48.Match newMutableMatch(final Physical_Person pP) { | ||
196 | return new Mutable(pP); | ||
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 pP the fixed value of pattern parameter p, or null if not bound. | ||
204 | * @return the (partial) match object. | ||
205 | * | ||
206 | */ | ||
207 | public static Inv48.Match newMatch(final Physical_Person pP) { | ||
208 | return new Immutable(pP); | ||
209 | } | ||
210 | |||
211 | private static final class Mutable extends Inv48.Match { | ||
212 | Mutable(final Physical_Person pP) { | ||
213 | super(pP); | ||
214 | } | ||
215 | |||
216 | @Override | ||
217 | public boolean isMutable() { | ||
218 | return true; | ||
219 | } | ||
220 | } | ||
221 | |||
222 | private static final class Immutable extends Inv48.Match { | ||
223 | Immutable(final Physical_Person pP) { | ||
224 | super(pP); | ||
225 | } | ||
226 | |||
227 | @Override | ||
228 | public boolean isMutable() { | ||
229 | return false; | ||
230 | } | ||
231 | } | ||
232 | } | ||
233 | |||
234 | /** | ||
235 | * Generated pattern matcher API of the queries.inv48 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 | * //inv48-attributes-handled by multiplicity | ||
246 | * {@literal @}Constraint(message = "inv48", severity = "error", key = {p}) | ||
247 | * pattern inv48(p : Physical_Person) { | ||
248 | * neg find x_inv48_notDis(p); | ||
249 | * neg find x_inv48_Dis(p); | ||
250 | * } | ||
251 | * </pre></code> | ||
252 | * | ||
253 | * @see Match | ||
254 | * @see Inv48 | ||
255 | * | ||
256 | */ | ||
257 | public static class Matcher extends BaseMatcher<Inv48.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 Inv48.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 Inv48.Matcher create() { | ||
282 | return new Matcher(); | ||
283 | } | ||
284 | |||
285 | private static final int POSITION_P = 0; | ||
286 | |||
287 | private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(Inv48.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 pP the fixed value of pattern parameter p, or null if not bound. | ||
304 | * @return matches represented as a Match object. | ||
305 | * | ||
306 | */ | ||
307 | public Collection<Inv48.Match> getAllMatches(final Physical_Person pP) { | ||
308 | return rawStreamAllMatches(new Object[]{pP}).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 pP the fixed value of pattern parameter p, or null if not bound. | ||
318 | * @return a stream of matches represented as a Match object. | ||
319 | * | ||
320 | */ | ||
321 | public Stream<Inv48.Match> streamAllMatches(final Physical_Person pP) { | ||
322 | return rawStreamAllMatches(new Object[]{pP}); | ||
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 pP the fixed value of pattern parameter p, 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<Inv48.Match> getOneArbitraryMatch(final Physical_Person pP) { | ||
333 | return rawGetOneArbitraryMatch(new Object[]{pP}); | ||
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 pP the fixed value of pattern parameter p, 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 Physical_Person pP) { | ||
344 | return rawHasMatch(new Object[]{pP}); | ||
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 pP the fixed value of pattern parameter p, or null if not bound. | ||
350 | * @return the number of pattern matches found. | ||
351 | * | ||
352 | */ | ||
353 | public int countMatches(final Physical_Person pP) { | ||
354 | return rawCountMatches(new Object[]{pP}); | ||
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 pP the fixed value of pattern parameter p, 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 Physical_Person pP, final Consumer<? super Inv48.Match> processor) { | ||
366 | return rawForOneArbitraryMatch(new Object[]{pP}, 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 pP the fixed value of pattern parameter p, or null if not bound. | ||
374 | * @return the (partial) match object. | ||
375 | * | ||
376 | */ | ||
377 | public Inv48.Match newMatch(final Physical_Person pP) { | ||
378 | return Inv48.Match.newMatch(pP); | ||
379 | } | ||
380 | |||
381 | /** | ||
382 | * Retrieve the set of values that occur in matches for p. | ||
383 | * @return the Set of all values or empty set if there are no matches | ||
384 | * | ||
385 | */ | ||
386 | protected Stream<Physical_Person> rawStreamAllValuesOfp(final Object[] parameters) { | ||
387 | return rawStreamAllValues(POSITION_P, parameters).map(Physical_Person.class::cast); | ||
388 | } | ||
389 | |||
390 | /** | ||
391 | * Retrieve the set of values that occur in matches for p. | ||
392 | * @return the Set of all values or empty set if there are no matches | ||
393 | * | ||
394 | */ | ||
395 | public Set<Physical_Person> getAllValuesOfp() { | ||
396 | return rawStreamAllValuesOfp(emptyArray()).collect(Collectors.toSet()); | ||
397 | } | ||
398 | |||
399 | /** | ||
400 | * Retrieve the set of values that occur in matches for p. | ||
401 | * @return the Set of all values or empty set if there are no matches | ||
402 | * | ||
403 | */ | ||
404 | public Stream<Physical_Person> streamAllValuesOfp() { | ||
405 | return rawStreamAllValuesOfp(emptyArray()); | ||
406 | } | ||
407 | |||
408 | @Override | ||
409 | protected Inv48.Match tupleToMatch(final Tuple t) { | ||
410 | try { | ||
411 | return Inv48.Match.newMatch((Physical_Person) t.get(POSITION_P)); | ||
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 Inv48.Match arrayToMatch(final Object[] match) { | ||
420 | try { | ||
421 | return Inv48.Match.newMatch((Physical_Person) match[POSITION_P]); | ||
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 Inv48.Match arrayToMatchMutable(final Object[] match) { | ||
430 | try { | ||
431 | return Inv48.Match.newMutableMatch((Physical_Person) match[POSITION_P]); | ||
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<Inv48.Matcher> querySpecification() { | ||
444 | return Inv48.instance(); | ||
445 | } | ||
446 | } | ||
447 | |||
448 | private Inv48() { | ||
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 Inv48 instance() { | ||
458 | try{ | ||
459 | return LazyHolder.INSTANCE; | ||
460 | } catch (ExceptionInInitializerError err) { | ||
461 | throw processInitializerError(err); | ||
462 | } | ||
463 | } | ||
464 | |||
465 | @Override | ||
466 | protected Inv48.Matcher instantiate(final ViatraQueryEngine engine) { | ||
467 | return Inv48.Matcher.on(engine); | ||
468 | } | ||
469 | |||
470 | @Override | ||
471 | public Inv48.Matcher instantiate() { | ||
472 | return Inv48.Matcher.create(); | ||
473 | } | ||
474 | |||
475 | @Override | ||
476 | public Inv48.Match newEmptyMatch() { | ||
477 | return Inv48.Match.newEmptyMatch(); | ||
478 | } | ||
479 | |||
480 | @Override | ||
481 | public Inv48.Match newMatch(final Object... parameters) { | ||
482 | return Inv48.Match.newMatch((Taxation.Physical_Person) parameters[0]); | ||
483 | } | ||
484 | |||
485 | /** | ||
486 | * Inner class allowing the singleton instance of {@link Inv48} 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 Inv48#instance()}. | ||
489 | * | ||
490 | * <p> This workaround is required e.g. to support recursion. | ||
491 | * | ||
492 | */ | ||
493 | private static class LazyHolder { | ||
494 | private static final Inv48 INSTANCE = new Inv48(); | ||
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 Inv48.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | ||
513 | |||
514 | private final PParameter parameter_p = new PParameter("p", "Taxation.Physical_Person", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http:///TaxCard.ecore", "Physical_Person")), PParameterDirection.INOUT); | ||
515 | |||
516 | private final List<PParameter> parameters = Arrays.asList(parameter_p); | ||
517 | |||
518 | private GeneratedPQuery() { | ||
519 | super(PVisibility.PUBLIC); | ||
520 | } | ||
521 | |||
522 | @Override | ||
523 | public String getFullyQualifiedName() { | ||
524 | return "queries.inv48"; | ||
525 | } | ||
526 | |||
527 | @Override | ||
528 | public List<String> getParameterNames() { | ||
529 | return Arrays.asList("p"); | ||
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_p = body.getOrCreateVariableByName("p"); | ||
544 | new TypeConstraint(body, Tuples.flatTupleOf(var_p), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http:///TaxCard.ecore", "Physical_Person"))); | ||
545 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | ||
546 | new ExportedParameter(body, var_p, parameter_p) | ||
547 | )); | ||
548 | // neg find x_inv48_notDis(p) | ||
549 | new NegativePatternCall(body, Tuples.flatTupleOf(var_p), X_inv48_notDis.instance().getInternalQueryRepresentation()); | ||
550 | // neg find x_inv48_Dis(p) | ||
551 | new NegativePatternCall(body, Tuples.flatTupleOf(var_p), X_inv48_Dis.instance().getInternalQueryRepresentation()); | ||
552 | bodies.add(body); | ||
553 | } | ||
554 | { | ||
555 | PAnnotation annotation = new PAnnotation("Constraint"); | ||
556 | annotation.addAttribute("message", "inv48"); | ||
557 | annotation.addAttribute("severity", "error"); | ||
558 | annotation.addAttribute("key", Arrays.asList(new Object[] { | ||
559 | new ParameterReference("p") | ||
560 | })); | ||
561 | addAnnotation(annotation); | ||
562 | } | ||
563 | return bodies; | ||
564 | } | ||
565 | } | ||
566 | } | ||