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