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