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