diff options
author | 2020-08-28 18:58:37 +0200 | |
---|---|---|
committer | 2020-08-28 18:58:37 +0200 | |
commit | 4fe7fce97aedbd516109ef81afc33e00112b7b68 (patch) | |
tree | 7eaa7c4e9b31b2a1488e49de48721b4dbad31fae /Domains/ca.mcgill.rtgmrt.example.modes3/vql-gen/modes3/queries/TooManyInputsOfSegment.java | |
parent | MoDeS3 unit propagation WIP (diff) | |
download | VIATRA-Generator-4fe7fce97aedbd516109ef81afc33e00112b7b68.tar.gz VIATRA-Generator-4fe7fce97aedbd516109ef81afc33e00112b7b68.tar.zst VIATRA-Generator-4fe7fce97aedbd516109ef81afc33e00112b7b68.zip |
Must unit propagation
Diffstat (limited to 'Domains/ca.mcgill.rtgmrt.example.modes3/vql-gen/modes3/queries/TooManyInputsOfSegment.java')
-rw-r--r-- | Domains/ca.mcgill.rtgmrt.example.modes3/vql-gen/modes3/queries/TooManyInputsOfSegment.java | 64 |
1 files changed, 29 insertions, 35 deletions
diff --git a/Domains/ca.mcgill.rtgmrt.example.modes3/vql-gen/modes3/queries/TooManyInputsOfSegment.java b/Domains/ca.mcgill.rtgmrt.example.modes3/vql-gen/modes3/queries/TooManyInputsOfSegment.java index e5e8827c..ff82dda1 100644 --- a/Domains/ca.mcgill.rtgmrt.example.modes3/vql-gen/modes3/queries/TooManyInputsOfSegment.java +++ b/Domains/ca.mcgill.rtgmrt.example.modes3/vql-gen/modes3/queries/TooManyInputsOfSegment.java | |||
@@ -13,9 +13,8 @@ import java.util.Set; | |||
13 | import java.util.function.Consumer; | 13 | import java.util.function.Consumer; |
14 | import java.util.stream.Collectors; | 14 | import java.util.stream.Collectors; |
15 | import java.util.stream.Stream; | 15 | import java.util.stream.Stream; |
16 | import modes3.Segment; | 16 | import modes3.SimpleSegment; |
17 | import modes3.queries.Output; | 17 | import modes3.queries.Output; |
18 | import modes3.queries.Turnout; | ||
19 | import org.apache.log4j.Logger; | 18 | import org.apache.log4j.Logger; |
20 | import org.eclipse.emf.ecore.EClass; | 19 | import org.eclipse.emf.ecore.EClass; |
21 | import org.eclipse.viatra.query.runtime.api.IPatternMatch; | 20 | import org.eclipse.viatra.query.runtime.api.IPatternMatch; |
@@ -33,7 +32,6 @@ import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation | |||
33 | import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference; | 32 | import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference; |
34 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; | 33 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter; |
35 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Inequality; | 34 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Inequality; |
36 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall; | ||
37 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; | 35 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall; |
38 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; | 36 | import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint; |
39 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; | 37 | import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; |
@@ -55,8 +53,7 @@ import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; | |||
55 | * //} | 53 | * //} |
56 | * | 54 | * |
57 | * {@literal @}Constraint(message = "tooManyInputsOfSegment", severity = "error", key = { S }) | 55 | * {@literal @}Constraint(message = "tooManyInputsOfSegment", severity = "error", key = { S }) |
58 | * pattern tooManyInputsOfSegment(S : Segment) { | 56 | * pattern tooManyInputsOfSegment(S : SimpleSegment) { |
59 | * neg find turnout(S); | ||
60 | * find output(I1, S); | 57 | * find output(I1, S); |
61 | * find output(I2, S); | 58 | * find output(I2, S); |
62 | * find output(I3, S); | 59 | * find output(I3, S); |
@@ -85,11 +82,11 @@ public final class TooManyInputsOfSegment extends BaseGeneratedEMFQuerySpecifica | |||
85 | * | 82 | * |
86 | */ | 83 | */ |
87 | public static abstract class Match extends BasePatternMatch { | 84 | public static abstract class Match extends BasePatternMatch { |
88 | private Segment fS; | 85 | private SimpleSegment fS; |
89 | 86 | ||
90 | private static List<String> parameterNames = makeImmutableList("S"); | 87 | private static List<String> parameterNames = makeImmutableList("S"); |
91 | 88 | ||
92 | private Match(final Segment pS) { | 89 | private Match(final SimpleSegment pS) { |
93 | this.fS = pS; | 90 | this.fS = pS; |
94 | } | 91 | } |
95 | 92 | ||
@@ -109,7 +106,7 @@ public final class TooManyInputsOfSegment extends BaseGeneratedEMFQuerySpecifica | |||
109 | } | 106 | } |
110 | } | 107 | } |
111 | 108 | ||
112 | public Segment getS() { | 109 | public SimpleSegment getS() { |
113 | return this.fS; | 110 | return this.fS; |
114 | } | 111 | } |
115 | 112 | ||
@@ -117,13 +114,13 @@ public final class TooManyInputsOfSegment extends BaseGeneratedEMFQuerySpecifica | |||
117 | public boolean set(final String parameterName, final Object newValue) { | 114 | public boolean set(final String parameterName, final Object newValue) { |
118 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | 115 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); |
119 | if ("S".equals(parameterName) ) { | 116 | if ("S".equals(parameterName) ) { |
120 | this.fS = (Segment) newValue; | 117 | this.fS = (SimpleSegment) newValue; |
121 | return true; | 118 | return true; |
122 | } | 119 | } |
123 | return false; | 120 | return false; |
124 | } | 121 | } |
125 | 122 | ||
126 | public void setS(final Segment pS) { | 123 | public void setS(final SimpleSegment pS) { |
127 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); | 124 | if (!isMutable()) throw new java.lang.UnsupportedOperationException(); |
128 | this.fS = pS; | 125 | this.fS = pS; |
129 | } | 126 | } |
@@ -204,7 +201,7 @@ public final class TooManyInputsOfSegment extends BaseGeneratedEMFQuerySpecifica | |||
204 | * @return the new, mutable (partial) match object. | 201 | * @return the new, mutable (partial) match object. |
205 | * | 202 | * |
206 | */ | 203 | */ |
207 | public static TooManyInputsOfSegment.Match newMutableMatch(final Segment pS) { | 204 | public static TooManyInputsOfSegment.Match newMutableMatch(final SimpleSegment pS) { |
208 | return new Mutable(pS); | 205 | return new Mutable(pS); |
209 | } | 206 | } |
210 | 207 | ||
@@ -216,12 +213,12 @@ public final class TooManyInputsOfSegment extends BaseGeneratedEMFQuerySpecifica | |||
216 | * @return the (partial) match object. | 213 | * @return the (partial) match object. |
217 | * | 214 | * |
218 | */ | 215 | */ |
219 | public static TooManyInputsOfSegment.Match newMatch(final Segment pS) { | 216 | public static TooManyInputsOfSegment.Match newMatch(final SimpleSegment pS) { |
220 | return new Immutable(pS); | 217 | return new Immutable(pS); |
221 | } | 218 | } |
222 | 219 | ||
223 | private static final class Mutable extends TooManyInputsOfSegment.Match { | 220 | private static final class Mutable extends TooManyInputsOfSegment.Match { |
224 | Mutable(final Segment pS) { | 221 | Mutable(final SimpleSegment pS) { |
225 | super(pS); | 222 | super(pS); |
226 | } | 223 | } |
227 | 224 | ||
@@ -232,7 +229,7 @@ public final class TooManyInputsOfSegment extends BaseGeneratedEMFQuerySpecifica | |||
232 | } | 229 | } |
233 | 230 | ||
234 | private static final class Immutable extends TooManyInputsOfSegment.Match { | 231 | private static final class Immutable extends TooManyInputsOfSegment.Match { |
235 | Immutable(final Segment pS) { | 232 | Immutable(final SimpleSegment pS) { |
236 | super(pS); | 233 | super(pS); |
237 | } | 234 | } |
238 | 235 | ||
@@ -261,8 +258,7 @@ public final class TooManyInputsOfSegment extends BaseGeneratedEMFQuerySpecifica | |||
261 | * //} | 258 | * //} |
262 | * | 259 | * |
263 | * {@literal @}Constraint(message = "tooManyInputsOfSegment", severity = "error", key = { S }) | 260 | * {@literal @}Constraint(message = "tooManyInputsOfSegment", severity = "error", key = { S }) |
264 | * pattern tooManyInputsOfSegment(S : Segment) { | 261 | * pattern tooManyInputsOfSegment(S : SimpleSegment) { |
265 | * neg find turnout(S); | ||
266 | * find output(I1, S); | 262 | * find output(I1, S); |
267 | * find output(I2, S); | 263 | * find output(I2, S); |
268 | * find output(I3, S); | 264 | * find output(I3, S); |
@@ -326,7 +322,7 @@ public final class TooManyInputsOfSegment extends BaseGeneratedEMFQuerySpecifica | |||
326 | * @return matches represented as a Match object. | 322 | * @return matches represented as a Match object. |
327 | * | 323 | * |
328 | */ | 324 | */ |
329 | public Collection<TooManyInputsOfSegment.Match> getAllMatches(final Segment pS) { | 325 | public Collection<TooManyInputsOfSegment.Match> getAllMatches(final SimpleSegment pS) { |
330 | return rawStreamAllMatches(new Object[]{pS}).collect(Collectors.toSet()); | 326 | return rawStreamAllMatches(new Object[]{pS}).collect(Collectors.toSet()); |
331 | } | 327 | } |
332 | 328 | ||
@@ -340,7 +336,7 @@ public final class TooManyInputsOfSegment extends BaseGeneratedEMFQuerySpecifica | |||
340 | * @return a stream of matches represented as a Match object. | 336 | * @return a stream of matches represented as a Match object. |
341 | * | 337 | * |
342 | */ | 338 | */ |
343 | public Stream<TooManyInputsOfSegment.Match> streamAllMatches(final Segment pS) { | 339 | public Stream<TooManyInputsOfSegment.Match> streamAllMatches(final SimpleSegment pS) { |
344 | return rawStreamAllMatches(new Object[]{pS}); | 340 | return rawStreamAllMatches(new Object[]{pS}); |
345 | } | 341 | } |
346 | 342 | ||
@@ -351,7 +347,7 @@ public final class TooManyInputsOfSegment extends BaseGeneratedEMFQuerySpecifica | |||
351 | * @return a match represented as a Match object, or null if no match is found. | 347 | * @return a match represented as a Match object, or null if no match is found. |
352 | * | 348 | * |
353 | */ | 349 | */ |
354 | public Optional<TooManyInputsOfSegment.Match> getOneArbitraryMatch(final Segment pS) { | 350 | public Optional<TooManyInputsOfSegment.Match> getOneArbitraryMatch(final SimpleSegment pS) { |
355 | return rawGetOneArbitraryMatch(new Object[]{pS}); | 351 | return rawGetOneArbitraryMatch(new Object[]{pS}); |
356 | } | 352 | } |
357 | 353 | ||
@@ -362,7 +358,7 @@ public final class TooManyInputsOfSegment extends BaseGeneratedEMFQuerySpecifica | |||
362 | * @return true if the input is a valid (partial) match of the pattern. | 358 | * @return true if the input is a valid (partial) match of the pattern. |
363 | * | 359 | * |
364 | */ | 360 | */ |
365 | public boolean hasMatch(final Segment pS) { | 361 | public boolean hasMatch(final SimpleSegment pS) { |
366 | return rawHasMatch(new Object[]{pS}); | 362 | return rawHasMatch(new Object[]{pS}); |
367 | } | 363 | } |
368 | 364 | ||
@@ -372,7 +368,7 @@ public final class TooManyInputsOfSegment extends BaseGeneratedEMFQuerySpecifica | |||
372 | * @return the number of pattern matches found. | 368 | * @return the number of pattern matches found. |
373 | * | 369 | * |
374 | */ | 370 | */ |
375 | public int countMatches(final Segment pS) { | 371 | public int countMatches(final SimpleSegment pS) { |
376 | return rawCountMatches(new Object[]{pS}); | 372 | return rawCountMatches(new Object[]{pS}); |
377 | } | 373 | } |
378 | 374 | ||
@@ -384,7 +380,7 @@ public final class TooManyInputsOfSegment extends BaseGeneratedEMFQuerySpecifica | |||
384 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked | 380 | * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked |
385 | * | 381 | * |
386 | */ | 382 | */ |
387 | public boolean forOneArbitraryMatch(final Segment pS, final Consumer<? super TooManyInputsOfSegment.Match> processor) { | 383 | public boolean forOneArbitraryMatch(final SimpleSegment pS, final Consumer<? super TooManyInputsOfSegment.Match> processor) { |
388 | return rawForOneArbitraryMatch(new Object[]{pS}, processor); | 384 | return rawForOneArbitraryMatch(new Object[]{pS}, processor); |
389 | } | 385 | } |
390 | 386 | ||
@@ -396,7 +392,7 @@ public final class TooManyInputsOfSegment extends BaseGeneratedEMFQuerySpecifica | |||
396 | * @return the (partial) match object. | 392 | * @return the (partial) match object. |
397 | * | 393 | * |
398 | */ | 394 | */ |
399 | public TooManyInputsOfSegment.Match newMatch(final Segment pS) { | 395 | public TooManyInputsOfSegment.Match newMatch(final SimpleSegment pS) { |
400 | return TooManyInputsOfSegment.Match.newMatch(pS); | 396 | return TooManyInputsOfSegment.Match.newMatch(pS); |
401 | } | 397 | } |
402 | 398 | ||
@@ -405,8 +401,8 @@ public final class TooManyInputsOfSegment extends BaseGeneratedEMFQuerySpecifica | |||
405 | * @return the Set of all values or empty set if there are no matches | 401 | * @return the Set of all values or empty set if there are no matches |
406 | * | 402 | * |
407 | */ | 403 | */ |
408 | protected Stream<Segment> rawStreamAllValuesOfS(final Object[] parameters) { | 404 | protected Stream<SimpleSegment> rawStreamAllValuesOfS(final Object[] parameters) { |
409 | return rawStreamAllValues(POSITION_S, parameters).map(Segment.class::cast); | 405 | return rawStreamAllValues(POSITION_S, parameters).map(SimpleSegment.class::cast); |
410 | } | 406 | } |
411 | 407 | ||
412 | /** | 408 | /** |
@@ -414,7 +410,7 @@ public final class TooManyInputsOfSegment extends BaseGeneratedEMFQuerySpecifica | |||
414 | * @return the Set of all values or empty set if there are no matches | 410 | * @return the Set of all values or empty set if there are no matches |
415 | * | 411 | * |
416 | */ | 412 | */ |
417 | public Set<Segment> getAllValuesOfS() { | 413 | public Set<SimpleSegment> getAllValuesOfS() { |
418 | return rawStreamAllValuesOfS(emptyArray()).collect(Collectors.toSet()); | 414 | return rawStreamAllValuesOfS(emptyArray()).collect(Collectors.toSet()); |
419 | } | 415 | } |
420 | 416 | ||
@@ -423,14 +419,14 @@ public final class TooManyInputsOfSegment extends BaseGeneratedEMFQuerySpecifica | |||
423 | * @return the Set of all values or empty set if there are no matches | 419 | * @return the Set of all values or empty set if there are no matches |
424 | * | 420 | * |
425 | */ | 421 | */ |
426 | public Stream<Segment> streamAllValuesOfS() { | 422 | public Stream<SimpleSegment> streamAllValuesOfS() { |
427 | return rawStreamAllValuesOfS(emptyArray()); | 423 | return rawStreamAllValuesOfS(emptyArray()); |
428 | } | 424 | } |
429 | 425 | ||
430 | @Override | 426 | @Override |
431 | protected TooManyInputsOfSegment.Match tupleToMatch(final Tuple t) { | 427 | protected TooManyInputsOfSegment.Match tupleToMatch(final Tuple t) { |
432 | try { | 428 | try { |
433 | return TooManyInputsOfSegment.Match.newMatch((Segment) t.get(POSITION_S)); | 429 | return TooManyInputsOfSegment.Match.newMatch((SimpleSegment) t.get(POSITION_S)); |
434 | } catch(ClassCastException e) { | 430 | } catch(ClassCastException e) { |
435 | LOGGER.error("Element(s) in tuple not properly typed!",e); | 431 | LOGGER.error("Element(s) in tuple not properly typed!",e); |
436 | return null; | 432 | return null; |
@@ -440,7 +436,7 @@ public final class TooManyInputsOfSegment extends BaseGeneratedEMFQuerySpecifica | |||
440 | @Override | 436 | @Override |
441 | protected TooManyInputsOfSegment.Match arrayToMatch(final Object[] match) { | 437 | protected TooManyInputsOfSegment.Match arrayToMatch(final Object[] match) { |
442 | try { | 438 | try { |
443 | return TooManyInputsOfSegment.Match.newMatch((Segment) match[POSITION_S]); | 439 | return TooManyInputsOfSegment.Match.newMatch((SimpleSegment) match[POSITION_S]); |
444 | } catch(ClassCastException e) { | 440 | } catch(ClassCastException e) { |
445 | LOGGER.error("Element(s) in array not properly typed!",e); | 441 | LOGGER.error("Element(s) in array not properly typed!",e); |
446 | return null; | 442 | return null; |
@@ -450,7 +446,7 @@ public final class TooManyInputsOfSegment extends BaseGeneratedEMFQuerySpecifica | |||
450 | @Override | 446 | @Override |
451 | protected TooManyInputsOfSegment.Match arrayToMatchMutable(final Object[] match) { | 447 | protected TooManyInputsOfSegment.Match arrayToMatchMutable(final Object[] match) { |
452 | try { | 448 | try { |
453 | return TooManyInputsOfSegment.Match.newMutableMatch((Segment) match[POSITION_S]); | 449 | return TooManyInputsOfSegment.Match.newMutableMatch((SimpleSegment) match[POSITION_S]); |
454 | } catch(ClassCastException e) { | 450 | } catch(ClassCastException e) { |
455 | LOGGER.error("Element(s) in array not properly typed!",e); | 451 | LOGGER.error("Element(s) in array not properly typed!",e); |
456 | return null; | 452 | return null; |
@@ -501,7 +497,7 @@ public final class TooManyInputsOfSegment extends BaseGeneratedEMFQuerySpecifica | |||
501 | 497 | ||
502 | @Override | 498 | @Override |
503 | public TooManyInputsOfSegment.Match newMatch(final Object... parameters) { | 499 | public TooManyInputsOfSegment.Match newMatch(final Object... parameters) { |
504 | return TooManyInputsOfSegment.Match.newMatch((modes3.Segment) parameters[0]); | 500 | return TooManyInputsOfSegment.Match.newMatch((modes3.SimpleSegment) parameters[0]); |
505 | } | 501 | } |
506 | 502 | ||
507 | /** | 503 | /** |
@@ -533,7 +529,7 @@ public final class TooManyInputsOfSegment extends BaseGeneratedEMFQuerySpecifica | |||
533 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { | 529 | private static class GeneratedPQuery extends BaseGeneratedEMFPQuery { |
534 | private static final TooManyInputsOfSegment.GeneratedPQuery INSTANCE = new GeneratedPQuery(); | 530 | private static final TooManyInputsOfSegment.GeneratedPQuery INSTANCE = new GeneratedPQuery(); |
535 | 531 | ||
536 | private final PParameter parameter_S = new PParameter("S", "modes3.Segment", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.ece.mcgill.ca/wcet/modes3", "Segment")), PParameterDirection.INOUT); | 532 | private final PParameter parameter_S = new PParameter("S", "modes3.SimpleSegment", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.ece.mcgill.ca/wcet/modes3", "SimpleSegment")), PParameterDirection.INOUT); |
537 | 533 | ||
538 | private final List<PParameter> parameters = Arrays.asList(parameter_S); | 534 | private final List<PParameter> parameters = Arrays.asList(parameter_S); |
539 | 535 | ||
@@ -566,12 +562,10 @@ public final class TooManyInputsOfSegment extends BaseGeneratedEMFQuerySpecifica | |||
566 | PVariable var_I1 = body.getOrCreateVariableByName("I1"); | 562 | PVariable var_I1 = body.getOrCreateVariableByName("I1"); |
567 | PVariable var_I2 = body.getOrCreateVariableByName("I2"); | 563 | PVariable var_I2 = body.getOrCreateVariableByName("I2"); |
568 | PVariable var_I3 = body.getOrCreateVariableByName("I3"); | 564 | PVariable var_I3 = body.getOrCreateVariableByName("I3"); |
569 | new TypeConstraint(body, Tuples.flatTupleOf(var_S), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.ece.mcgill.ca/wcet/modes3", "Segment"))); | 565 | new TypeConstraint(body, Tuples.flatTupleOf(var_S), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.ece.mcgill.ca/wcet/modes3", "SimpleSegment"))); |
570 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( | 566 | body.setSymbolicParameters(Arrays.<ExportedParameter>asList( |
571 | new ExportedParameter(body, var_S, parameter_S) | 567 | new ExportedParameter(body, var_S, parameter_S) |
572 | )); | 568 | )); |
573 | // neg find turnout(S) | ||
574 | new NegativePatternCall(body, Tuples.flatTupleOf(var_S), Turnout.instance().getInternalQueryRepresentation()); | ||
575 | // find output(I1, S) | 569 | // find output(I1, S) |
576 | new PositivePatternCall(body, Tuples.flatTupleOf(var_I1, var_S), Output.instance().getInternalQueryRepresentation()); | 570 | new PositivePatternCall(body, Tuples.flatTupleOf(var_I1, var_S), Output.instance().getInternalQueryRepresentation()); |
577 | // find output(I2, S) | 571 | // find output(I2, S) |