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