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