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