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