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