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