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