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