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