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