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