querySpecification() {
- return ExtraInputOfTurnout.instance();
- }
- }
-
- private ExtraInputOfTurnout() {
- super(GeneratedPQuery.INSTANCE);
- }
-
- /**
- * @return the singleton instance of the query specification
- * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
- *
- */
- public static ExtraInputOfTurnout instance() {
- try{
- return LazyHolder.INSTANCE;
- } catch (ExceptionInInitializerError err) {
- throw processInitializerError(err);
- }
- }
-
- @Override
- protected ExtraInputOfTurnout.Matcher instantiate(final ViatraQueryEngine engine) {
- return ExtraInputOfTurnout.Matcher.on(engine);
- }
-
- @Override
- public ExtraInputOfTurnout.Matcher instantiate() {
- return ExtraInputOfTurnout.Matcher.create();
- }
-
- @Override
- public ExtraInputOfTurnout.Match newEmptyMatch() {
- return ExtraInputOfTurnout.Match.newEmptyMatch();
- }
-
- @Override
- public ExtraInputOfTurnout.Match newMatch(final Object... parameters) {
- return ExtraInputOfTurnout.Match.newMatch((modes3.Turnout) parameters[0], (modes3.Segment) parameters[1]);
- }
-
- /**
- * Inner class allowing the singleton instance of {@link ExtraInputOfTurnout} to be created
- * not at the class load time of the outer class,
- * but rather at the first call to {@link ExtraInputOfTurnout#instance()}.
- *
- * This workaround is required e.g. to support recursion.
- *
- */
- private static class LazyHolder {
- private static final ExtraInputOfTurnout INSTANCE = new ExtraInputOfTurnout();
-
- /**
- * Statically initializes the query specification after the field {@link #INSTANCE} is assigned.
- * This initialization order is required to support indirect recursion.
- *
- *
The static initializer is defined using a helper field to work around limitations of the code generator.
- *
- */
- private static final Object STATIC_INITIALIZER = ensureInitialized();
-
- public static Object ensureInitialized() {
- INSTANCE.ensureInitializedInternal();
- return null;
- }
- }
-
- private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
- private static final ExtraInputOfTurnout.GeneratedPQuery INSTANCE = new GeneratedPQuery();
-
- private final PParameter parameter_T = new PParameter("T", "modes3.Turnout", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.ece.mcgill.ca/wcet/modes3", "Turnout")), PParameterDirection.INOUT);
-
- private final PParameter parameter_S = new PParameter("S", "modes3.Segment", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.ece.mcgill.ca/wcet/modes3", "Segment")), PParameterDirection.INOUT);
-
- private final List parameters = Arrays.asList(parameter_T, parameter_S);
-
- private GeneratedPQuery() {
- super(PVisibility.PUBLIC);
- }
-
- @Override
- public String getFullyQualifiedName() {
- return "modes3.queries.extraInputOfTurnout";
- }
-
- @Override
- public List getParameterNames() {
- return Arrays.asList("T","S");
- }
-
- @Override
- public List getParameters() {
- return parameters;
- }
-
- @Override
- public Set doGetContainedBodies() {
- setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
- Set bodies = new LinkedHashSet<>();
- {
- PBody body = new PBody(this);
- PVariable var_T = body.getOrCreateVariableByName("T");
- PVariable var_S = body.getOrCreateVariableByName("S");
- PVariable var_Straight = body.getOrCreateVariableByName("Straight");
- PVariable var_Divergent = body.getOrCreateVariableByName("Divergent");
- new TypeConstraint(body, Tuples.flatTupleOf(var_T), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.ece.mcgill.ca/wcet/modes3", "Turnout")));
- new TypeConstraint(body, Tuples.flatTupleOf(var_S), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.ece.mcgill.ca/wcet/modes3", "Segment")));
- body.setSymbolicParameters(Arrays.asList(
- new ExportedParameter(body, var_T, parameter_T),
- new ExportedParameter(body, var_S, parameter_S)
- ));
- // Turnout.straight(T, Straight)
- new TypeConstraint(body, Tuples.flatTupleOf(var_T), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.ece.mcgill.ca/wcet/modes3", "Turnout")));
- PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
- new TypeConstraint(body, Tuples.flatTupleOf(var_T, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.ece.mcgill.ca/wcet/modes3", "Turnout", "straight")));
- new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.ece.mcgill.ca/wcet/modes3", "Segment")));
- new Equality(body, var__virtual_0_, var_Straight);
- // Turnout.divergent(T, Divergent)
- new TypeConstraint(body, Tuples.flatTupleOf(var_T), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.ece.mcgill.ca/wcet/modes3", "Turnout")));
- PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}");
- new TypeConstraint(body, Tuples.flatTupleOf(var_T, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.ece.mcgill.ca/wcet/modes3", "Turnout", "divergent")));
- new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_1_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.ece.mcgill.ca/wcet/modes3", "Segment")));
- new Equality(body, var__virtual_1_, var_Divergent);
- // find output(S, T)
- new PositivePatternCall(body, Tuples.flatTupleOf(var_S, var_T), Output.instance().getInternalQueryRepresentation());
- // S != Straight
- new Inequality(body, var_S, var_Straight);
- // S != Divergent
- new Inequality(body, var_S, var_Divergent);
- bodies.add(body);
- }
- return bodies;
- }
- }
-}
diff --git a/Domains/ca.mcgill.rtgmrt.example.modes3/vql-gen/modes3/queries/InputsOfTurnout.java b/Domains/ca.mcgill.rtgmrt.example.modes3/vql-gen/modes3/queries/InputsOfTurnout.java
new file mode 100644
index 00000000..2f2eea11
--- /dev/null
+++ b/Domains/ca.mcgill.rtgmrt.example.modes3/vql-gen/modes3/queries/InputsOfTurnout.java
@@ -0,0 +1,570 @@
+/**
+ * Generated from platform:/resource/ca.mcgill.rtgmrt.example.modes3/src/modes3/queries/Modes3Queries.vql
+ */
+package modes3.queries;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Set;
+import java.util.function.Consumer;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import modes3.Turnout;
+import modes3.queries.Adjacent;
+import org.apache.log4j.Logger;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.viatra.query.runtime.api.IPatternMatch;
+import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
+import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
+import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
+import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
+import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
+import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
+import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
+import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
+import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
+import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
+import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
+import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Inequality;
+import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall;
+import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
+import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
+import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
+import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
+import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
+import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
+import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
+
+/**
+ * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
+ *
+ * Original source:
+ *
+ * pattern inputsOfTurnout(T : Turnout) {
+ * find adjacent(I1, T);
+ * find adjacent(I2, T);
+ * find adjacent(I3, T);
+ * I1 != I2;
+ * I1 != I3;
+ * I2 != I3;
+ * }
+ *
+ *
+ * @see Matcher
+ * @see Match
+ *
+ */
+@SuppressWarnings("all")
+public final class InputsOfTurnout extends BaseGeneratedEMFQuerySpecification {
+ /**
+ * Pattern-specific match representation of the modes3.queries.inputsOfTurnout pattern,
+ * to be used in conjunction with {@link Matcher}.
+ *
+ * Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
+ * Each instance is a (possibly partial) substitution of pattern parameters,
+ * usable to represent a match of the pattern in the result of a query,
+ * or to specify the bound (fixed) input parameters when issuing a query.
+ *
+ * @see Matcher
+ *
+ */
+ public static abstract class Match extends BasePatternMatch {
+ private Turnout fT;
+
+ private static List parameterNames = makeImmutableList("T");
+
+ private Match(final Turnout pT) {
+ this.fT = pT;
+ }
+
+ @Override
+ public Object get(final String parameterName) {
+ switch(parameterName) {
+ case "T": return this.fT;
+ default: return null;
+ }
+ }
+
+ @Override
+ public Object get(final int index) {
+ switch(index) {
+ case 0: return this.fT;
+ default: return null;
+ }
+ }
+
+ public Turnout getT() {
+ return this.fT;
+ }
+
+ @Override
+ public boolean set(final String parameterName, final Object newValue) {
+ if (!isMutable()) throw new java.lang.UnsupportedOperationException();
+ if ("T".equals(parameterName) ) {
+ this.fT = (Turnout) newValue;
+ return true;
+ }
+ return false;
+ }
+
+ public void setT(final Turnout pT) {
+ if (!isMutable()) throw new java.lang.UnsupportedOperationException();
+ this.fT = pT;
+ }
+
+ @Override
+ public String patternName() {
+ return "modes3.queries.inputsOfTurnout";
+ }
+
+ @Override
+ public List parameterNames() {
+ return InputsOfTurnout.Match.parameterNames;
+ }
+
+ @Override
+ public Object[] toArray() {
+ return new Object[]{fT};
+ }
+
+ @Override
+ public InputsOfTurnout.Match toImmutable() {
+ return isMutable() ? newMatch(fT) : this;
+ }
+
+ @Override
+ public String prettyPrint() {
+ StringBuilder result = new StringBuilder();
+ result.append("\"T\"=" + prettyPrintValue(fT));
+ return result.toString();
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(fT);
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null) {
+ return false;
+ }
+ if ((obj instanceof InputsOfTurnout.Match)) {
+ InputsOfTurnout.Match other = (InputsOfTurnout.Match) obj;
+ return Objects.equals(fT, other.fT);
+ } else {
+ // this should be infrequent
+ if (!(obj instanceof IPatternMatch)) {
+ return false;
+ }
+ IPatternMatch otherSig = (IPatternMatch) obj;
+ return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
+ }
+ }
+
+ @Override
+ public InputsOfTurnout specification() {
+ return InputsOfTurnout.instance();
+ }
+
+ /**
+ * Returns an empty, mutable match.
+ * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
+ *
+ * @return the empty match.
+ *
+ */
+ public static InputsOfTurnout.Match newEmptyMatch() {
+ return new Mutable(null);
+ }
+
+ /**
+ * Returns a mutable (partial) match.
+ * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
+ *
+ * @param pT the fixed value of pattern parameter T, or null if not bound.
+ * @return the new, mutable (partial) match object.
+ *
+ */
+ public static InputsOfTurnout.Match newMutableMatch(final Turnout pT) {
+ return new Mutable(pT);
+ }
+
+ /**
+ * Returns a new (partial) match.
+ * This can be used e.g. to call the matcher with a partial match.
+ * The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
+ * @param pT the fixed value of pattern parameter T, or null if not bound.
+ * @return the (partial) match object.
+ *
+ */
+ public static InputsOfTurnout.Match newMatch(final Turnout pT) {
+ return new Immutable(pT);
+ }
+
+ private static final class Mutable extends InputsOfTurnout.Match {
+ Mutable(final Turnout pT) {
+ super(pT);
+ }
+
+ @Override
+ public boolean isMutable() {
+ return true;
+ }
+ }
+
+ private static final class Immutable extends InputsOfTurnout.Match {
+ Immutable(final Turnout pT) {
+ super(pT);
+ }
+
+ @Override
+ public boolean isMutable() {
+ return false;
+ }
+ }
+ }
+
+ /**
+ * Generated pattern matcher API of the modes3.queries.inputsOfTurnout pattern,
+ * providing pattern-specific query methods.
+ *
+ *
Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
+ * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
+ *
+ *
Matches of the pattern will be represented as {@link Match}.
+ *
+ *
Original source:
+ *
+ * pattern inputsOfTurnout(T : Turnout) {
+ * find adjacent(I1, T);
+ * find adjacent(I2, T);
+ * find adjacent(I3, T);
+ * I1 != I2;
+ * I1 != I3;
+ * I2 != I3;
+ * }
+ *
+ *
+ * @see Match
+ * @see InputsOfTurnout
+ *
+ */
+ public static class Matcher extends BaseMatcher {
+ /**
+ * Initializes the pattern matcher within an existing VIATRA Query engine.
+ * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
+ *
+ * @param engine the existing VIATRA Query engine in which this matcher will be created.
+ * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
+ *
+ */
+ public static InputsOfTurnout.Matcher on(final ViatraQueryEngine engine) {
+ // check if matcher already exists
+ Matcher matcher = engine.getExistingMatcher(querySpecification());
+ if (matcher == null) {
+ matcher = (Matcher)engine.getMatcher(querySpecification());
+ }
+ return matcher;
+ }
+
+ /**
+ * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
+ * @return an initialized matcher
+ * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
+ *
+ */
+ public static InputsOfTurnout.Matcher create() {
+ return new Matcher();
+ }
+
+ private static final int POSITION_T = 0;
+
+ private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(InputsOfTurnout.Matcher.class);
+
+ /**
+ * Initializes the pattern matcher within an existing VIATRA Query engine.
+ * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
+ *
+ * @param engine the existing VIATRA Query engine in which this matcher will be created.
+ * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
+ *
+ */
+ private Matcher() {
+ super(querySpecification());
+ }
+
+ /**
+ * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
+ * @param pT the fixed value of pattern parameter T, or null if not bound.
+ * @return matches represented as a Match object.
+ *
+ */
+ public Collection getAllMatches(final Turnout pT) {
+ return rawStreamAllMatches(new Object[]{pT}).collect(Collectors.toSet());
+ }
+
+ /**
+ * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
+ *
+ * NOTE: It is important not to modify the source model while the stream is being processed.
+ * If the match set of the pattern changes during processing, the contents of the stream is undefined.
+ * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
+ * @param pT the fixed value of pattern parameter T, or null if not bound.
+ * @return a stream of matches represented as a Match object.
+ *
+ */
+ public Stream streamAllMatches(final Turnout pT) {
+ return rawStreamAllMatches(new Object[]{pT});
+ }
+
+ /**
+ * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
+ * Neither determinism nor randomness of selection is guaranteed.
+ * @param pT the fixed value of pattern parameter T, or null if not bound.
+ * @return a match represented as a Match object, or null if no match is found.
+ *
+ */
+ public Optional getOneArbitraryMatch(final Turnout pT) {
+ return rawGetOneArbitraryMatch(new Object[]{pT});
+ }
+
+ /**
+ * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
+ * under any possible substitution of the unspecified parameters (if any).
+ * @param pT the fixed value of pattern parameter T, or null if not bound.
+ * @return true if the input is a valid (partial) match of the pattern.
+ *
+ */
+ public boolean hasMatch(final Turnout pT) {
+ return rawHasMatch(new Object[]{pT});
+ }
+
+ /**
+ * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
+ * @param pT the fixed value of pattern parameter T, or null if not bound.
+ * @return the number of pattern matches found.
+ *
+ */
+ public int countMatches(final Turnout pT) {
+ return rawCountMatches(new Object[]{pT});
+ }
+
+ /**
+ * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
+ * Neither determinism nor randomness of selection is guaranteed.
+ * @param pT the fixed value of pattern parameter T, or null if not bound.
+ * @param processor the action that will process the selected match.
+ * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
+ *
+ */
+ public boolean forOneArbitraryMatch(final Turnout pT, final Consumer super InputsOfTurnout.Match> processor) {
+ return rawForOneArbitraryMatch(new Object[]{pT}, processor);
+ }
+
+ /**
+ * Returns a new (partial) match.
+ * This can be used e.g. to call the matcher with a partial match.
+ * The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
+ * @param pT the fixed value of pattern parameter T, or null if not bound.
+ * @return the (partial) match object.
+ *
+ */
+ public InputsOfTurnout.Match newMatch(final Turnout pT) {
+ return InputsOfTurnout.Match.newMatch(pT);
+ }
+
+ /**
+ * Retrieve the set of values that occur in matches for T.
+ * @return the Set of all values or empty set if there are no matches
+ *
+ */
+ protected Stream rawStreamAllValuesOfT(final Object[] parameters) {
+ return rawStreamAllValues(POSITION_T, parameters).map(Turnout.class::cast);
+ }
+
+ /**
+ * Retrieve the set of values that occur in matches for T.
+ * @return the Set of all values or empty set if there are no matches
+ *
+ */
+ public Set getAllValuesOfT() {
+ return rawStreamAllValuesOfT(emptyArray()).collect(Collectors.toSet());
+ }
+
+ /**
+ * Retrieve the set of values that occur in matches for T.
+ * @return the Set of all values or empty set if there are no matches
+ *
+ */
+ public Stream streamAllValuesOfT() {
+ return rawStreamAllValuesOfT(emptyArray());
+ }
+
+ @Override
+ protected InputsOfTurnout.Match tupleToMatch(final Tuple t) {
+ try {
+ return InputsOfTurnout.Match.newMatch((Turnout) t.get(POSITION_T));
+ } catch(ClassCastException e) {
+ LOGGER.error("Element(s) in tuple not properly typed!",e);
+ return null;
+ }
+ }
+
+ @Override
+ protected InputsOfTurnout.Match arrayToMatch(final Object[] match) {
+ try {
+ return InputsOfTurnout.Match.newMatch((Turnout) match[POSITION_T]);
+ } catch(ClassCastException e) {
+ LOGGER.error("Element(s) in array not properly typed!",e);
+ return null;
+ }
+ }
+
+ @Override
+ protected InputsOfTurnout.Match arrayToMatchMutable(final Object[] match) {
+ try {
+ return InputsOfTurnout.Match.newMutableMatch((Turnout) match[POSITION_T]);
+ } catch(ClassCastException e) {
+ LOGGER.error("Element(s) in array not properly typed!",e);
+ return null;
+ }
+ }
+
+ /**
+ * @return the singleton instance of the query specification of this pattern
+ * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
+ *
+ */
+ public static IQuerySpecification querySpecification() {
+ return InputsOfTurnout.instance();
+ }
+ }
+
+ private InputsOfTurnout() {
+ super(GeneratedPQuery.INSTANCE);
+ }
+
+ /**
+ * @return the singleton instance of the query specification
+ * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
+ *
+ */
+ public static InputsOfTurnout instance() {
+ try{
+ return LazyHolder.INSTANCE;
+ } catch (ExceptionInInitializerError err) {
+ throw processInitializerError(err);
+ }
+ }
+
+ @Override
+ protected InputsOfTurnout.Matcher instantiate(final ViatraQueryEngine engine) {
+ return InputsOfTurnout.Matcher.on(engine);
+ }
+
+ @Override
+ public InputsOfTurnout.Matcher instantiate() {
+ return InputsOfTurnout.Matcher.create();
+ }
+
+ @Override
+ public InputsOfTurnout.Match newEmptyMatch() {
+ return InputsOfTurnout.Match.newEmptyMatch();
+ }
+
+ @Override
+ public InputsOfTurnout.Match newMatch(final Object... parameters) {
+ return InputsOfTurnout.Match.newMatch((modes3.Turnout) parameters[0]);
+ }
+
+ /**
+ * Inner class allowing the singleton instance of {@link InputsOfTurnout} to be created
+ * not at the class load time of the outer class,
+ * but rather at the first call to {@link InputsOfTurnout#instance()}.
+ *
+ * This workaround is required e.g. to support recursion.
+ *
+ */
+ private static class LazyHolder {
+ private static final InputsOfTurnout INSTANCE = new InputsOfTurnout();
+
+ /**
+ * Statically initializes the query specification after the field {@link #INSTANCE} is assigned.
+ * This initialization order is required to support indirect recursion.
+ *
+ *
The static initializer is defined using a helper field to work around limitations of the code generator.
+ *
+ */
+ private static final Object STATIC_INITIALIZER = ensureInitialized();
+
+ public static Object ensureInitialized() {
+ INSTANCE.ensureInitializedInternal();
+ return null;
+ }
+ }
+
+ private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
+ private static final InputsOfTurnout.GeneratedPQuery INSTANCE = new GeneratedPQuery();
+
+ private final PParameter parameter_T = new PParameter("T", "modes3.Turnout", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.ece.mcgill.ca/wcet/modes3", "Turnout")), PParameterDirection.INOUT);
+
+ private final List parameters = Arrays.asList(parameter_T);
+
+ private GeneratedPQuery() {
+ super(PVisibility.PUBLIC);
+ }
+
+ @Override
+ public String getFullyQualifiedName() {
+ return "modes3.queries.inputsOfTurnout";
+ }
+
+ @Override
+ public List getParameterNames() {
+ return Arrays.asList("T");
+ }
+
+ @Override
+ public List getParameters() {
+ return parameters;
+ }
+
+ @Override
+ public Set doGetContainedBodies() {
+ setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
+ Set bodies = new LinkedHashSet<>();
+ {
+ PBody body = new PBody(this);
+ PVariable var_T = body.getOrCreateVariableByName("T");
+ PVariable var_I1 = body.getOrCreateVariableByName("I1");
+ PVariable var_I2 = body.getOrCreateVariableByName("I2");
+ PVariable var_I3 = body.getOrCreateVariableByName("I3");
+ new TypeConstraint(body, Tuples.flatTupleOf(var_T), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.ece.mcgill.ca/wcet/modes3", "Turnout")));
+ body.setSymbolicParameters(Arrays.asList(
+ new ExportedParameter(body, var_T, parameter_T)
+ ));
+ // find adjacent(I1, T)
+ new PositivePatternCall(body, Tuples.flatTupleOf(var_I1, var_T), Adjacent.instance().getInternalQueryRepresentation());
+ // find adjacent(I2, T)
+ new PositivePatternCall(body, Tuples.flatTupleOf(var_I2, var_T), Adjacent.instance().getInternalQueryRepresentation());
+ // find adjacent(I3, T)
+ new PositivePatternCall(body, Tuples.flatTupleOf(var_I3, var_T), Adjacent.instance().getInternalQueryRepresentation());
+ // I1 != I2
+ new Inequality(body, var_I1, var_I2);
+ // I1 != I3
+ new Inequality(body, var_I1, var_I3);
+ // I2 != I3
+ new Inequality(body, var_I2, var_I3);
+ bodies.add(body);
+ }
+ return bodies;
+ }
+ }
+}
diff --git a/Domains/ca.mcgill.rtgmrt.example.modes3/vql-gen/modes3/queries/Modes3Queries.java b/Domains/ca.mcgill.rtgmrt.example.modes3/vql-gen/modes3/queries/Modes3Queries.java
index 01ec77a1..6e244430 100644
--- a/Domains/ca.mcgill.rtgmrt.example.modes3/vql-gen/modes3/queries/Modes3Queries.java
+++ b/Domains/ca.mcgill.rtgmrt.example.modes3/vql-gen/modes3/queries/Modes3Queries.java
@@ -7,16 +7,14 @@ import modes3.queries.Adjacent;
import modes3.queries.ConnectedTo;
import modes3.queries.ConnectedToNotSymmetric;
import modes3.queries.ConnectedToReflexive;
-import modes3.queries.ExtraInputOfTurnout;
-import modes3.queries.NoExtraInputOfTurnout;
+import modes3.queries.InputsOfTurnout;
import modes3.queries.Output;
import modes3.queries.OutputReflexive;
import modes3.queries.Reachable;
-import modes3.queries.TooManyExtraInputsOfTurnout;
+import modes3.queries.TooFewInputsOfTurnout;
import modes3.queries.TooManyInputsOfSegment;
-import modes3.queries.Turnout;
+import modes3.queries.TooManyInputsOfTurnout;
import modes3.queries.TurnoutConnectedToBothOutputs;
-import modes3.queries.TurnoutInSegments;
import modes3.queries.TurnoutOutput;
import modes3.queries.TurnoutOutputsAreSame;
import modes3.queries.Unreachable;
@@ -31,21 +29,19 @@ import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup;
* in order to achieve better performance than one-by-one on-demand matcher initialization.
*
* From package modes3.queries, the group contains the definition of the following patterns:
- * - turnoutInSegments
* - connectedTo
* - connectedToNotSymmetric
* - connectedToReflexive
* - turnoutOutput
* - outputReflexive
* - turnoutOutputsAreSame
- * - turnout
* - output
* - tooManyInputsOfSegment
* - turnoutConnectedToBothOutputs
- * - extraInputOfTurnout
- * - noExtraInputOfTurnout
- * - tooManyExtraInputsOfTurnout
* - adjacent
+ * - tooManyInputsOfTurnout
+ * - inputsOfTurnout
+ * - tooFewInputsOfTurnout
* - reachable
* - unreachable
*
@@ -72,33 +68,23 @@ public final class Modes3Queries extends BaseGeneratedPatternGroup {
private static Modes3Queries INSTANCE;
private Modes3Queries() {
- querySpecifications.add(TurnoutInSegments.instance());
querySpecifications.add(ConnectedTo.instance());
querySpecifications.add(ConnectedToNotSymmetric.instance());
querySpecifications.add(ConnectedToReflexive.instance());
querySpecifications.add(TurnoutOutput.instance());
querySpecifications.add(OutputReflexive.instance());
querySpecifications.add(TurnoutOutputsAreSame.instance());
- querySpecifications.add(Turnout.instance());
querySpecifications.add(Output.instance());
querySpecifications.add(TooManyInputsOfSegment.instance());
querySpecifications.add(TurnoutConnectedToBothOutputs.instance());
- querySpecifications.add(ExtraInputOfTurnout.instance());
- querySpecifications.add(NoExtraInputOfTurnout.instance());
- querySpecifications.add(TooManyExtraInputsOfTurnout.instance());
querySpecifications.add(Adjacent.instance());
+ querySpecifications.add(TooManyInputsOfTurnout.instance());
+ querySpecifications.add(InputsOfTurnout.instance());
+ querySpecifications.add(TooFewInputsOfTurnout.instance());
querySpecifications.add(Reachable.instance());
querySpecifications.add(Unreachable.instance());
}
- public TurnoutInSegments getTurnoutInSegments() {
- return TurnoutInSegments.instance();
- }
-
- public TurnoutInSegments.Matcher getTurnoutInSegments(final ViatraQueryEngine engine) {
- return TurnoutInSegments.Matcher.on(engine);
- }
-
public ConnectedTo getConnectedTo() {
return ConnectedTo.instance();
}
@@ -147,14 +133,6 @@ public final class Modes3Queries extends BaseGeneratedPatternGroup {
return TurnoutOutputsAreSame.Matcher.on(engine);
}
- public Turnout getTurnout() {
- return Turnout.instance();
- }
-
- public Turnout.Matcher getTurnout(final ViatraQueryEngine engine) {
- return Turnout.Matcher.on(engine);
- }
-
public Output getOutput() {
return Output.instance();
}
@@ -179,36 +157,36 @@ public final class Modes3Queries extends BaseGeneratedPatternGroup {
return TurnoutConnectedToBothOutputs.Matcher.on(engine);
}
- public ExtraInputOfTurnout getExtraInputOfTurnout() {
- return ExtraInputOfTurnout.instance();
+ public Adjacent getAdjacent() {
+ return Adjacent.instance();
}
- public ExtraInputOfTurnout.Matcher getExtraInputOfTurnout(final ViatraQueryEngine engine) {
- return ExtraInputOfTurnout.Matcher.on(engine);
+ public Adjacent.Matcher getAdjacent(final ViatraQueryEngine engine) {
+ return Adjacent.Matcher.on(engine);
}
- public NoExtraInputOfTurnout getNoExtraInputOfTurnout() {
- return NoExtraInputOfTurnout.instance();
+ public TooManyInputsOfTurnout getTooManyInputsOfTurnout() {
+ return TooManyInputsOfTurnout.instance();
}
- public NoExtraInputOfTurnout.Matcher getNoExtraInputOfTurnout(final ViatraQueryEngine engine) {
- return NoExtraInputOfTurnout.Matcher.on(engine);
+ public TooManyInputsOfTurnout.Matcher getTooManyInputsOfTurnout(final ViatraQueryEngine engine) {
+ return TooManyInputsOfTurnout.Matcher.on(engine);
}
- public TooManyExtraInputsOfTurnout getTooManyExtraInputsOfTurnout() {
- return TooManyExtraInputsOfTurnout.instance();
+ public InputsOfTurnout getInputsOfTurnout() {
+ return InputsOfTurnout.instance();
}
- public TooManyExtraInputsOfTurnout.Matcher getTooManyExtraInputsOfTurnout(final ViatraQueryEngine engine) {
- return TooManyExtraInputsOfTurnout.Matcher.on(engine);
+ public InputsOfTurnout.Matcher getInputsOfTurnout(final ViatraQueryEngine engine) {
+ return InputsOfTurnout.Matcher.on(engine);
}
- public Adjacent getAdjacent() {
- return Adjacent.instance();
+ public TooFewInputsOfTurnout getTooFewInputsOfTurnout() {
+ return TooFewInputsOfTurnout.instance();
}
- public Adjacent.Matcher getAdjacent(final ViatraQueryEngine engine) {
- return Adjacent.Matcher.on(engine);
+ public TooFewInputsOfTurnout.Matcher getTooFewInputsOfTurnout(final ViatraQueryEngine engine) {
+ return TooFewInputsOfTurnout.Matcher.on(engine);
}
public Reachable getReachable() {
diff --git a/Domains/ca.mcgill.rtgmrt.example.modes3/vql-gen/modes3/queries/NoExtraInputOfTurnout.java b/Domains/ca.mcgill.rtgmrt.example.modes3/vql-gen/modes3/queries/NoExtraInputOfTurnout.java
deleted file mode 100644
index 621d736f..00000000
--- a/Domains/ca.mcgill.rtgmrt.example.modes3/vql-gen/modes3/queries/NoExtraInputOfTurnout.java
+++ /dev/null
@@ -1,560 +0,0 @@
-/**
- * Generated from platform:/resource/ca.mcgill.rtgmrt.example.modes3/src/modes3/queries/Modes3Queries.vql
- */
-package modes3.queries;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Objects;
-import java.util.Optional;
-import java.util.Set;
-import java.util.function.Consumer;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-import modes3.Turnout;
-import modes3.queries.ExtraInputOfTurnout;
-import org.apache.log4j.Logger;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.viatra.query.runtime.api.IPatternMatch;
-import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
-import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
-import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
-import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
-import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
-import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
-import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
-import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
-import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
-import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
-import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation;
-import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference;
-import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
-import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall;
-import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
-import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
-import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
-import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
-import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
-import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
-import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
-
-/**
- * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
- *
- * Original source:
- *
- * {@literal @}Constraint(message = "noExtraInputOfTurnout", severity = "error", key = { T })
- * pattern noExtraInputOfTurnout(T : Turnout) {
- * neg find extraInputOfTurnout(T, _);
- * }
- *
- *
- * @see Matcher
- * @see Match
- *
- */
-@SuppressWarnings("all")
-public final class NoExtraInputOfTurnout extends BaseGeneratedEMFQuerySpecification {
- /**
- * Pattern-specific match representation of the modes3.queries.noExtraInputOfTurnout pattern,
- * to be used in conjunction with {@link Matcher}.
- *
- * Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
- * Each instance is a (possibly partial) substitution of pattern parameters,
- * usable to represent a match of the pattern in the result of a query,
- * or to specify the bound (fixed) input parameters when issuing a query.
- *
- * @see Matcher
- *
- */
- public static abstract class Match extends BasePatternMatch {
- private Turnout fT;
-
- private static List parameterNames = makeImmutableList("T");
-
- private Match(final Turnout pT) {
- this.fT = pT;
- }
-
- @Override
- public Object get(final String parameterName) {
- switch(parameterName) {
- case "T": return this.fT;
- default: return null;
- }
- }
-
- @Override
- public Object get(final int index) {
- switch(index) {
- case 0: return this.fT;
- default: return null;
- }
- }
-
- public Turnout getT() {
- return this.fT;
- }
-
- @Override
- public boolean set(final String parameterName, final Object newValue) {
- if (!isMutable()) throw new java.lang.UnsupportedOperationException();
- if ("T".equals(parameterName) ) {
- this.fT = (Turnout) newValue;
- return true;
- }
- return false;
- }
-
- public void setT(final Turnout pT) {
- if (!isMutable()) throw new java.lang.UnsupportedOperationException();
- this.fT = pT;
- }
-
- @Override
- public String patternName() {
- return "modes3.queries.noExtraInputOfTurnout";
- }
-
- @Override
- public List parameterNames() {
- return NoExtraInputOfTurnout.Match.parameterNames;
- }
-
- @Override
- public Object[] toArray() {
- return new Object[]{fT};
- }
-
- @Override
- public NoExtraInputOfTurnout.Match toImmutable() {
- return isMutable() ? newMatch(fT) : this;
- }
-
- @Override
- public String prettyPrint() {
- StringBuilder result = new StringBuilder();
- result.append("\"T\"=" + prettyPrintValue(fT));
- return result.toString();
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(fT);
- }
-
- @Override
- public boolean equals(final Object obj) {
- if (this == obj)
- return true;
- if (obj == null) {
- return false;
- }
- if ((obj instanceof NoExtraInputOfTurnout.Match)) {
- NoExtraInputOfTurnout.Match other = (NoExtraInputOfTurnout.Match) obj;
- return Objects.equals(fT, other.fT);
- } else {
- // this should be infrequent
- if (!(obj instanceof IPatternMatch)) {
- return false;
- }
- IPatternMatch otherSig = (IPatternMatch) obj;
- return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
- }
- }
-
- @Override
- public NoExtraInputOfTurnout specification() {
- return NoExtraInputOfTurnout.instance();
- }
-
- /**
- * Returns an empty, mutable match.
- * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
- *
- * @return the empty match.
- *
- */
- public static NoExtraInputOfTurnout.Match newEmptyMatch() {
- return new Mutable(null);
- }
-
- /**
- * Returns a mutable (partial) match.
- * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
- *
- * @param pT the fixed value of pattern parameter T, or null if not bound.
- * @return the new, mutable (partial) match object.
- *
- */
- public static NoExtraInputOfTurnout.Match newMutableMatch(final Turnout pT) {
- return new Mutable(pT);
- }
-
- /**
- * Returns a new (partial) match.
- * This can be used e.g. to call the matcher with a partial match.
- * The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
- * @param pT the fixed value of pattern parameter T, or null if not bound.
- * @return the (partial) match object.
- *
- */
- public static NoExtraInputOfTurnout.Match newMatch(final Turnout pT) {
- return new Immutable(pT);
- }
-
- private static final class Mutable extends NoExtraInputOfTurnout.Match {
- Mutable(final Turnout pT) {
- super(pT);
- }
-
- @Override
- public boolean isMutable() {
- return true;
- }
- }
-
- private static final class Immutable extends NoExtraInputOfTurnout.Match {
- Immutable(final Turnout pT) {
- super(pT);
- }
-
- @Override
- public boolean isMutable() {
- return false;
- }
- }
- }
-
- /**
- * Generated pattern matcher API of the modes3.queries.noExtraInputOfTurnout pattern,
- * providing pattern-specific query methods.
- *
- *
Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
- * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
- *
- *
Matches of the pattern will be represented as {@link Match}.
- *
- *
Original source:
- *
- * {@literal @}Constraint(message = "noExtraInputOfTurnout", severity = "error", key = { T })
- * pattern noExtraInputOfTurnout(T : Turnout) {
- * neg find extraInputOfTurnout(T, _);
- * }
- *
- *
- * @see Match
- * @see NoExtraInputOfTurnout
- *
- */
- public static class Matcher extends BaseMatcher {
- /**
- * Initializes the pattern matcher within an existing VIATRA Query engine.
- * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
- *
- * @param engine the existing VIATRA Query engine in which this matcher will be created.
- * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
- *
- */
- public static NoExtraInputOfTurnout.Matcher on(final ViatraQueryEngine engine) {
- // check if matcher already exists
- Matcher matcher = engine.getExistingMatcher(querySpecification());
- if (matcher == null) {
- matcher = (Matcher)engine.getMatcher(querySpecification());
- }
- return matcher;
- }
-
- /**
- * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
- * @return an initialized matcher
- * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
- *
- */
- public static NoExtraInputOfTurnout.Matcher create() {
- return new Matcher();
- }
-
- private static final int POSITION_T = 0;
-
- private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(NoExtraInputOfTurnout.Matcher.class);
-
- /**
- * Initializes the pattern matcher within an existing VIATRA Query engine.
- * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
- *
- * @param engine the existing VIATRA Query engine in which this matcher will be created.
- * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
- *
- */
- private Matcher() {
- super(querySpecification());
- }
-
- /**
- * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
- * @param pT the fixed value of pattern parameter T, or null if not bound.
- * @return matches represented as a Match object.
- *
- */
- public Collection getAllMatches(final Turnout pT) {
- return rawStreamAllMatches(new Object[]{pT}).collect(Collectors.toSet());
- }
-
- /**
- * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
- *
- * NOTE: It is important not to modify the source model while the stream is being processed.
- * If the match set of the pattern changes during processing, the contents of the stream is undefined.
- * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
- * @param pT the fixed value of pattern parameter T, or null if not bound.
- * @return a stream of matches represented as a Match object.
- *
- */
- public Stream streamAllMatches(final Turnout pT) {
- return rawStreamAllMatches(new Object[]{pT});
- }
-
- /**
- * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
- * Neither determinism nor randomness of selection is guaranteed.
- * @param pT the fixed value of pattern parameter T, or null if not bound.
- * @return a match represented as a Match object, or null if no match is found.
- *
- */
- public Optional getOneArbitraryMatch(final Turnout pT) {
- return rawGetOneArbitraryMatch(new Object[]{pT});
- }
-
- /**
- * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
- * under any possible substitution of the unspecified parameters (if any).
- * @param pT the fixed value of pattern parameter T, or null if not bound.
- * @return true if the input is a valid (partial) match of the pattern.
- *
- */
- public boolean hasMatch(final Turnout pT) {
- return rawHasMatch(new Object[]{pT});
- }
-
- /**
- * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
- * @param pT the fixed value of pattern parameter T, or null if not bound.
- * @return the number of pattern matches found.
- *
- */
- public int countMatches(final Turnout pT) {
- return rawCountMatches(new Object[]{pT});
- }
-
- /**
- * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
- * Neither determinism nor randomness of selection is guaranteed.
- * @param pT the fixed value of pattern parameter T, or null if not bound.
- * @param processor the action that will process the selected match.
- * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
- *
- */
- public boolean forOneArbitraryMatch(final Turnout pT, final Consumer super NoExtraInputOfTurnout.Match> processor) {
- return rawForOneArbitraryMatch(new Object[]{pT}, processor);
- }
-
- /**
- * Returns a new (partial) match.
- * This can be used e.g. to call the matcher with a partial match.
- * The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
- * @param pT the fixed value of pattern parameter T, or null if not bound.
- * @return the (partial) match object.
- *
- */
- public NoExtraInputOfTurnout.Match newMatch(final Turnout pT) {
- return NoExtraInputOfTurnout.Match.newMatch(pT);
- }
-
- /**
- * Retrieve the set of values that occur in matches for T.
- * @return the Set of all values or empty set if there are no matches
- *
- */
- protected Stream rawStreamAllValuesOfT(final Object[] parameters) {
- return rawStreamAllValues(POSITION_T, parameters).map(Turnout.class::cast);
- }
-
- /**
- * Retrieve the set of values that occur in matches for T.
- * @return the Set of all values or empty set if there are no matches
- *
- */
- public Set getAllValuesOfT() {
- return rawStreamAllValuesOfT(emptyArray()).collect(Collectors.toSet());
- }
-
- /**
- * Retrieve the set of values that occur in matches for T.
- * @return the Set of all values or empty set if there are no matches
- *
- */
- public Stream streamAllValuesOfT() {
- return rawStreamAllValuesOfT(emptyArray());
- }
-
- @Override
- protected NoExtraInputOfTurnout.Match tupleToMatch(final Tuple t) {
- try {
- return NoExtraInputOfTurnout.Match.newMatch((Turnout) t.get(POSITION_T));
- } catch(ClassCastException e) {
- LOGGER.error("Element(s) in tuple not properly typed!",e);
- return null;
- }
- }
-
- @Override
- protected NoExtraInputOfTurnout.Match arrayToMatch(final Object[] match) {
- try {
- return NoExtraInputOfTurnout.Match.newMatch((Turnout) match[POSITION_T]);
- } catch(ClassCastException e) {
- LOGGER.error("Element(s) in array not properly typed!",e);
- return null;
- }
- }
-
- @Override
- protected NoExtraInputOfTurnout.Match arrayToMatchMutable(final Object[] match) {
- try {
- return NoExtraInputOfTurnout.Match.newMutableMatch((Turnout) match[POSITION_T]);
- } catch(ClassCastException e) {
- LOGGER.error("Element(s) in array not properly typed!",e);
- return null;
- }
- }
-
- /**
- * @return the singleton instance of the query specification of this pattern
- * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
- *
- */
- public static IQuerySpecification querySpecification() {
- return NoExtraInputOfTurnout.instance();
- }
- }
-
- private NoExtraInputOfTurnout() {
- super(GeneratedPQuery.INSTANCE);
- }
-
- /**
- * @return the singleton instance of the query specification
- * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
- *
- */
- public static NoExtraInputOfTurnout instance() {
- try{
- return LazyHolder.INSTANCE;
- } catch (ExceptionInInitializerError err) {
- throw processInitializerError(err);
- }
- }
-
- @Override
- protected NoExtraInputOfTurnout.Matcher instantiate(final ViatraQueryEngine engine) {
- return NoExtraInputOfTurnout.Matcher.on(engine);
- }
-
- @Override
- public NoExtraInputOfTurnout.Matcher instantiate() {
- return NoExtraInputOfTurnout.Matcher.create();
- }
-
- @Override
- public NoExtraInputOfTurnout.Match newEmptyMatch() {
- return NoExtraInputOfTurnout.Match.newEmptyMatch();
- }
-
- @Override
- public NoExtraInputOfTurnout.Match newMatch(final Object... parameters) {
- return NoExtraInputOfTurnout.Match.newMatch((modes3.Turnout) parameters[0]);
- }
-
- /**
- * Inner class allowing the singleton instance of {@link NoExtraInputOfTurnout} to be created
- * not at the class load time of the outer class,
- * but rather at the first call to {@link NoExtraInputOfTurnout#instance()}.
- *
- * This workaround is required e.g. to support recursion.
- *
- */
- private static class LazyHolder {
- private static final NoExtraInputOfTurnout INSTANCE = new NoExtraInputOfTurnout();
-
- /**
- * Statically initializes the query specification after the field {@link #INSTANCE} is assigned.
- * This initialization order is required to support indirect recursion.
- *
- *
The static initializer is defined using a helper field to work around limitations of the code generator.
- *
- */
- private static final Object STATIC_INITIALIZER = ensureInitialized();
-
- public static Object ensureInitialized() {
- INSTANCE.ensureInitializedInternal();
- return null;
- }
- }
-
- private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
- private static final NoExtraInputOfTurnout.GeneratedPQuery INSTANCE = new GeneratedPQuery();
-
- private final PParameter parameter_T = new PParameter("T", "modes3.Turnout", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.ece.mcgill.ca/wcet/modes3", "Turnout")), PParameterDirection.INOUT);
-
- private final List parameters = Arrays.asList(parameter_T);
-
- private GeneratedPQuery() {
- super(PVisibility.PUBLIC);
- }
-
- @Override
- public String getFullyQualifiedName() {
- return "modes3.queries.noExtraInputOfTurnout";
- }
-
- @Override
- public List getParameterNames() {
- return Arrays.asList("T");
- }
-
- @Override
- public List getParameters() {
- return parameters;
- }
-
- @Override
- public Set doGetContainedBodies() {
- setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
- Set bodies = new LinkedHashSet<>();
- {
- PBody body = new PBody(this);
- PVariable var_T = body.getOrCreateVariableByName("T");
- PVariable var___0_ = body.getOrCreateVariableByName("_<0>");
- new TypeConstraint(body, Tuples.flatTupleOf(var_T), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.ece.mcgill.ca/wcet/modes3", "Turnout")));
- body.setSymbolicParameters(Arrays.asList(
- new ExportedParameter(body, var_T, parameter_T)
- ));
- // neg find extraInputOfTurnout(T, _)
- new NegativePatternCall(body, Tuples.flatTupleOf(var_T, var___0_), ExtraInputOfTurnout.instance().getInternalQueryRepresentation());
- bodies.add(body);
- }
- {
- PAnnotation annotation = new PAnnotation("Constraint");
- annotation.addAttribute("message", "noExtraInputOfTurnout");
- annotation.addAttribute("severity", "error");
- annotation.addAttribute("key", Arrays.asList(new Object[] {
- new ParameterReference("T")
- }));
- addAnnotation(annotation);
- }
- return bodies;
- }
- }
-}
diff --git a/Domains/ca.mcgill.rtgmrt.example.modes3/vql-gen/modes3/queries/TooFewInputsOfTurnout.java b/Domains/ca.mcgill.rtgmrt.example.modes3/vql-gen/modes3/queries/TooFewInputsOfTurnout.java
new file mode 100644
index 00000000..088640ca
--- /dev/null
+++ b/Domains/ca.mcgill.rtgmrt.example.modes3/vql-gen/modes3/queries/TooFewInputsOfTurnout.java
@@ -0,0 +1,559 @@
+/**
+ * Generated from platform:/resource/ca.mcgill.rtgmrt.example.modes3/src/modes3/queries/Modes3Queries.vql
+ */
+package modes3.queries;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Set;
+import java.util.function.Consumer;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import modes3.Turnout;
+import modes3.queries.InputsOfTurnout;
+import org.apache.log4j.Logger;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.viatra.query.runtime.api.IPatternMatch;
+import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
+import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
+import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
+import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
+import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
+import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
+import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
+import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
+import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
+import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
+import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation;
+import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference;
+import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
+import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall;
+import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
+import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
+import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
+import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
+import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
+import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
+import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
+
+/**
+ * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
+ *
+ * Original source:
+ *
+ * {@literal @}Constraint(message = "tooFewInputsOfTurnout", severity = "error", key = { T })
+ * pattern tooFewInputsOfTurnout(T : Turnout) {
+ * neg find inputsOfTurnout(T);
+ * }
+ *
+ *
+ * @see Matcher
+ * @see Match
+ *
+ */
+@SuppressWarnings("all")
+public final class TooFewInputsOfTurnout extends BaseGeneratedEMFQuerySpecification {
+ /**
+ * Pattern-specific match representation of the modes3.queries.tooFewInputsOfTurnout pattern,
+ * to be used in conjunction with {@link Matcher}.
+ *
+ * Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
+ * Each instance is a (possibly partial) substitution of pattern parameters,
+ * usable to represent a match of the pattern in the result of a query,
+ * or to specify the bound (fixed) input parameters when issuing a query.
+ *
+ * @see Matcher
+ *
+ */
+ public static abstract class Match extends BasePatternMatch {
+ private Turnout fT;
+
+ private static List parameterNames = makeImmutableList("T");
+
+ private Match(final Turnout pT) {
+ this.fT = pT;
+ }
+
+ @Override
+ public Object get(final String parameterName) {
+ switch(parameterName) {
+ case "T": return this.fT;
+ default: return null;
+ }
+ }
+
+ @Override
+ public Object get(final int index) {
+ switch(index) {
+ case 0: return this.fT;
+ default: return null;
+ }
+ }
+
+ public Turnout getT() {
+ return this.fT;
+ }
+
+ @Override
+ public boolean set(final String parameterName, final Object newValue) {
+ if (!isMutable()) throw new java.lang.UnsupportedOperationException();
+ if ("T".equals(parameterName) ) {
+ this.fT = (Turnout) newValue;
+ return true;
+ }
+ return false;
+ }
+
+ public void setT(final Turnout pT) {
+ if (!isMutable()) throw new java.lang.UnsupportedOperationException();
+ this.fT = pT;
+ }
+
+ @Override
+ public String patternName() {
+ return "modes3.queries.tooFewInputsOfTurnout";
+ }
+
+ @Override
+ public List parameterNames() {
+ return TooFewInputsOfTurnout.Match.parameterNames;
+ }
+
+ @Override
+ public Object[] toArray() {
+ return new Object[]{fT};
+ }
+
+ @Override
+ public TooFewInputsOfTurnout.Match toImmutable() {
+ return isMutable() ? newMatch(fT) : this;
+ }
+
+ @Override
+ public String prettyPrint() {
+ StringBuilder result = new StringBuilder();
+ result.append("\"T\"=" + prettyPrintValue(fT));
+ return result.toString();
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(fT);
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null) {
+ return false;
+ }
+ if ((obj instanceof TooFewInputsOfTurnout.Match)) {
+ TooFewInputsOfTurnout.Match other = (TooFewInputsOfTurnout.Match) obj;
+ return Objects.equals(fT, other.fT);
+ } else {
+ // this should be infrequent
+ if (!(obj instanceof IPatternMatch)) {
+ return false;
+ }
+ IPatternMatch otherSig = (IPatternMatch) obj;
+ return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
+ }
+ }
+
+ @Override
+ public TooFewInputsOfTurnout specification() {
+ return TooFewInputsOfTurnout.instance();
+ }
+
+ /**
+ * Returns an empty, mutable match.
+ * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
+ *
+ * @return the empty match.
+ *
+ */
+ public static TooFewInputsOfTurnout.Match newEmptyMatch() {
+ return new Mutable(null);
+ }
+
+ /**
+ * Returns a mutable (partial) match.
+ * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
+ *
+ * @param pT the fixed value of pattern parameter T, or null if not bound.
+ * @return the new, mutable (partial) match object.
+ *
+ */
+ public static TooFewInputsOfTurnout.Match newMutableMatch(final Turnout pT) {
+ return new Mutable(pT);
+ }
+
+ /**
+ * Returns a new (partial) match.
+ * This can be used e.g. to call the matcher with a partial match.
+ * The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
+ * @param pT the fixed value of pattern parameter T, or null if not bound.
+ * @return the (partial) match object.
+ *
+ */
+ public static TooFewInputsOfTurnout.Match newMatch(final Turnout pT) {
+ return new Immutable(pT);
+ }
+
+ private static final class Mutable extends TooFewInputsOfTurnout.Match {
+ Mutable(final Turnout pT) {
+ super(pT);
+ }
+
+ @Override
+ public boolean isMutable() {
+ return true;
+ }
+ }
+
+ private static final class Immutable extends TooFewInputsOfTurnout.Match {
+ Immutable(final Turnout pT) {
+ super(pT);
+ }
+
+ @Override
+ public boolean isMutable() {
+ return false;
+ }
+ }
+ }
+
+ /**
+ * Generated pattern matcher API of the modes3.queries.tooFewInputsOfTurnout pattern,
+ * providing pattern-specific query methods.
+ *
+ *
Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
+ * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
+ *
+ *
Matches of the pattern will be represented as {@link Match}.
+ *
+ *
Original source:
+ *
+ * {@literal @}Constraint(message = "tooFewInputsOfTurnout", severity = "error", key = { T })
+ * pattern tooFewInputsOfTurnout(T : Turnout) {
+ * neg find inputsOfTurnout(T);
+ * }
+ *
+ *
+ * @see Match
+ * @see TooFewInputsOfTurnout
+ *
+ */
+ public static class Matcher extends BaseMatcher {
+ /**
+ * Initializes the pattern matcher within an existing VIATRA Query engine.
+ * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
+ *
+ * @param engine the existing VIATRA Query engine in which this matcher will be created.
+ * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
+ *
+ */
+ public static TooFewInputsOfTurnout.Matcher on(final ViatraQueryEngine engine) {
+ // check if matcher already exists
+ Matcher matcher = engine.getExistingMatcher(querySpecification());
+ if (matcher == null) {
+ matcher = (Matcher)engine.getMatcher(querySpecification());
+ }
+ return matcher;
+ }
+
+ /**
+ * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
+ * @return an initialized matcher
+ * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
+ *
+ */
+ public static TooFewInputsOfTurnout.Matcher create() {
+ return new Matcher();
+ }
+
+ private static final int POSITION_T = 0;
+
+ private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(TooFewInputsOfTurnout.Matcher.class);
+
+ /**
+ * Initializes the pattern matcher within an existing VIATRA Query engine.
+ * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
+ *
+ * @param engine the existing VIATRA Query engine in which this matcher will be created.
+ * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
+ *
+ */
+ private Matcher() {
+ super(querySpecification());
+ }
+
+ /**
+ * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
+ * @param pT the fixed value of pattern parameter T, or null if not bound.
+ * @return matches represented as a Match object.
+ *
+ */
+ public Collection getAllMatches(final Turnout pT) {
+ return rawStreamAllMatches(new Object[]{pT}).collect(Collectors.toSet());
+ }
+
+ /**
+ * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
+ *
+ * NOTE: It is important not to modify the source model while the stream is being processed.
+ * If the match set of the pattern changes during processing, the contents of the stream is undefined.
+ * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
+ * @param pT the fixed value of pattern parameter T, or null if not bound.
+ * @return a stream of matches represented as a Match object.
+ *
+ */
+ public Stream streamAllMatches(final Turnout pT) {
+ return rawStreamAllMatches(new Object[]{pT});
+ }
+
+ /**
+ * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
+ * Neither determinism nor randomness of selection is guaranteed.
+ * @param pT the fixed value of pattern parameter T, or null if not bound.
+ * @return a match represented as a Match object, or null if no match is found.
+ *
+ */
+ public Optional getOneArbitraryMatch(final Turnout pT) {
+ return rawGetOneArbitraryMatch(new Object[]{pT});
+ }
+
+ /**
+ * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
+ * under any possible substitution of the unspecified parameters (if any).
+ * @param pT the fixed value of pattern parameter T, or null if not bound.
+ * @return true if the input is a valid (partial) match of the pattern.
+ *
+ */
+ public boolean hasMatch(final Turnout pT) {
+ return rawHasMatch(new Object[]{pT});
+ }
+
+ /**
+ * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
+ * @param pT the fixed value of pattern parameter T, or null if not bound.
+ * @return the number of pattern matches found.
+ *
+ */
+ public int countMatches(final Turnout pT) {
+ return rawCountMatches(new Object[]{pT});
+ }
+
+ /**
+ * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
+ * Neither determinism nor randomness of selection is guaranteed.
+ * @param pT the fixed value of pattern parameter T, or null if not bound.
+ * @param processor the action that will process the selected match.
+ * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
+ *
+ */
+ public boolean forOneArbitraryMatch(final Turnout pT, final Consumer super TooFewInputsOfTurnout.Match> processor) {
+ return rawForOneArbitraryMatch(new Object[]{pT}, processor);
+ }
+
+ /**
+ * Returns a new (partial) match.
+ * This can be used e.g. to call the matcher with a partial match.
+ * The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
+ * @param pT the fixed value of pattern parameter T, or null if not bound.
+ * @return the (partial) match object.
+ *
+ */
+ public TooFewInputsOfTurnout.Match newMatch(final Turnout pT) {
+ return TooFewInputsOfTurnout.Match.newMatch(pT);
+ }
+
+ /**
+ * Retrieve the set of values that occur in matches for T.
+ * @return the Set of all values or empty set if there are no matches
+ *
+ */
+ protected Stream rawStreamAllValuesOfT(final Object[] parameters) {
+ return rawStreamAllValues(POSITION_T, parameters).map(Turnout.class::cast);
+ }
+
+ /**
+ * Retrieve the set of values that occur in matches for T.
+ * @return the Set of all values or empty set if there are no matches
+ *
+ */
+ public Set getAllValuesOfT() {
+ return rawStreamAllValuesOfT(emptyArray()).collect(Collectors.toSet());
+ }
+
+ /**
+ * Retrieve the set of values that occur in matches for T.
+ * @return the Set of all values or empty set if there are no matches
+ *
+ */
+ public Stream streamAllValuesOfT() {
+ return rawStreamAllValuesOfT(emptyArray());
+ }
+
+ @Override
+ protected TooFewInputsOfTurnout.Match tupleToMatch(final Tuple t) {
+ try {
+ return TooFewInputsOfTurnout.Match.newMatch((Turnout) t.get(POSITION_T));
+ } catch(ClassCastException e) {
+ LOGGER.error("Element(s) in tuple not properly typed!",e);
+ return null;
+ }
+ }
+
+ @Override
+ protected TooFewInputsOfTurnout.Match arrayToMatch(final Object[] match) {
+ try {
+ return TooFewInputsOfTurnout.Match.newMatch((Turnout) match[POSITION_T]);
+ } catch(ClassCastException e) {
+ LOGGER.error("Element(s) in array not properly typed!",e);
+ return null;
+ }
+ }
+
+ @Override
+ protected TooFewInputsOfTurnout.Match arrayToMatchMutable(final Object[] match) {
+ try {
+ return TooFewInputsOfTurnout.Match.newMutableMatch((Turnout) match[POSITION_T]);
+ } catch(ClassCastException e) {
+ LOGGER.error("Element(s) in array not properly typed!",e);
+ return null;
+ }
+ }
+
+ /**
+ * @return the singleton instance of the query specification of this pattern
+ * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
+ *
+ */
+ public static IQuerySpecification querySpecification() {
+ return TooFewInputsOfTurnout.instance();
+ }
+ }
+
+ private TooFewInputsOfTurnout() {
+ super(GeneratedPQuery.INSTANCE);
+ }
+
+ /**
+ * @return the singleton instance of the query specification
+ * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
+ *
+ */
+ public static TooFewInputsOfTurnout instance() {
+ try{
+ return LazyHolder.INSTANCE;
+ } catch (ExceptionInInitializerError err) {
+ throw processInitializerError(err);
+ }
+ }
+
+ @Override
+ protected TooFewInputsOfTurnout.Matcher instantiate(final ViatraQueryEngine engine) {
+ return TooFewInputsOfTurnout.Matcher.on(engine);
+ }
+
+ @Override
+ public TooFewInputsOfTurnout.Matcher instantiate() {
+ return TooFewInputsOfTurnout.Matcher.create();
+ }
+
+ @Override
+ public TooFewInputsOfTurnout.Match newEmptyMatch() {
+ return TooFewInputsOfTurnout.Match.newEmptyMatch();
+ }
+
+ @Override
+ public TooFewInputsOfTurnout.Match newMatch(final Object... parameters) {
+ return TooFewInputsOfTurnout.Match.newMatch((modes3.Turnout) parameters[0]);
+ }
+
+ /**
+ * Inner class allowing the singleton instance of {@link TooFewInputsOfTurnout} to be created
+ * not at the class load time of the outer class,
+ * but rather at the first call to {@link TooFewInputsOfTurnout#instance()}.
+ *
+ * This workaround is required e.g. to support recursion.
+ *
+ */
+ private static class LazyHolder {
+ private static final TooFewInputsOfTurnout INSTANCE = new TooFewInputsOfTurnout();
+
+ /**
+ * Statically initializes the query specification after the field {@link #INSTANCE} is assigned.
+ * This initialization order is required to support indirect recursion.
+ *
+ *
The static initializer is defined using a helper field to work around limitations of the code generator.
+ *
+ */
+ private static final Object STATIC_INITIALIZER = ensureInitialized();
+
+ public static Object ensureInitialized() {
+ INSTANCE.ensureInitializedInternal();
+ return null;
+ }
+ }
+
+ private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
+ private static final TooFewInputsOfTurnout.GeneratedPQuery INSTANCE = new GeneratedPQuery();
+
+ private final PParameter parameter_T = new PParameter("T", "modes3.Turnout", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.ece.mcgill.ca/wcet/modes3", "Turnout")), PParameterDirection.INOUT);
+
+ private final List parameters = Arrays.asList(parameter_T);
+
+ private GeneratedPQuery() {
+ super(PVisibility.PUBLIC);
+ }
+
+ @Override
+ public String getFullyQualifiedName() {
+ return "modes3.queries.tooFewInputsOfTurnout";
+ }
+
+ @Override
+ public List getParameterNames() {
+ return Arrays.asList("T");
+ }
+
+ @Override
+ public List getParameters() {
+ return parameters;
+ }
+
+ @Override
+ public Set doGetContainedBodies() {
+ setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
+ Set bodies = new LinkedHashSet<>();
+ {
+ PBody body = new PBody(this);
+ PVariable var_T = body.getOrCreateVariableByName("T");
+ new TypeConstraint(body, Tuples.flatTupleOf(var_T), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.ece.mcgill.ca/wcet/modes3", "Turnout")));
+ body.setSymbolicParameters(Arrays.asList(
+ new ExportedParameter(body, var_T, parameter_T)
+ ));
+ // neg find inputsOfTurnout(T)
+ new NegativePatternCall(body, Tuples.flatTupleOf(var_T), InputsOfTurnout.instance().getInternalQueryRepresentation());
+ bodies.add(body);
+ }
+ {
+ PAnnotation annotation = new PAnnotation("Constraint");
+ annotation.addAttribute("message", "tooFewInputsOfTurnout");
+ annotation.addAttribute("severity", "error");
+ annotation.addAttribute("key", Arrays.asList(new Object[] {
+ new ParameterReference("T")
+ }));
+ addAnnotation(annotation);
+ }
+ return bodies;
+ }
+ }
+}
diff --git a/Domains/ca.mcgill.rtgmrt.example.modes3/vql-gen/modes3/queries/TooManyExtraInputsOfTurnout.java b/Domains/ca.mcgill.rtgmrt.example.modes3/vql-gen/modes3/queries/TooManyExtraInputsOfTurnout.java
deleted file mode 100644
index 9f417795..00000000
--- a/Domains/ca.mcgill.rtgmrt.example.modes3/vql-gen/modes3/queries/TooManyExtraInputsOfTurnout.java
+++ /dev/null
@@ -1,570 +0,0 @@
-/**
- * Generated from platform:/resource/ca.mcgill.rtgmrt.example.modes3/src/modes3/queries/Modes3Queries.vql
- */
-package modes3.queries;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Objects;
-import java.util.Optional;
-import java.util.Set;
-import java.util.function.Consumer;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-import modes3.Turnout;
-import modes3.queries.ExtraInputOfTurnout;
-import org.apache.log4j.Logger;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.viatra.query.runtime.api.IPatternMatch;
-import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
-import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
-import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
-import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
-import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
-import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
-import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
-import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
-import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
-import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
-import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation;
-import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference;
-import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
-import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Inequality;
-import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall;
-import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
-import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
-import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
-import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
-import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
-import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
-import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
-
-/**
- * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
- *
- * Original source:
- *
- * {@literal @}Constraint(message = "tooManyExtraInputsOfTurnout", severity = "error", key = { T })
- * pattern tooManyExtraInputsOfTurnout(T : Turnout) {
- * find extraInputOfTurnout(T, I1);
- * find extraInputOfTurnout(T, I2);
- * I1 != I2;
- * }
- *
- *
- * @see Matcher
- * @see Match
- *
- */
-@SuppressWarnings("all")
-public final class TooManyExtraInputsOfTurnout extends BaseGeneratedEMFQuerySpecification {
- /**
- * Pattern-specific match representation of the modes3.queries.tooManyExtraInputsOfTurnout pattern,
- * to be used in conjunction with {@link Matcher}.
- *
- * Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
- * Each instance is a (possibly partial) substitution of pattern parameters,
- * usable to represent a match of the pattern in the result of a query,
- * or to specify the bound (fixed) input parameters when issuing a query.
- *
- * @see Matcher
- *
- */
- public static abstract class Match extends BasePatternMatch {
- private Turnout fT;
-
- private static List parameterNames = makeImmutableList("T");
-
- private Match(final Turnout pT) {
- this.fT = pT;
- }
-
- @Override
- public Object get(final String parameterName) {
- switch(parameterName) {
- case "T": return this.fT;
- default: return null;
- }
- }
-
- @Override
- public Object get(final int index) {
- switch(index) {
- case 0: return this.fT;
- default: return null;
- }
- }
-
- public Turnout getT() {
- return this.fT;
- }
-
- @Override
- public boolean set(final String parameterName, final Object newValue) {
- if (!isMutable()) throw new java.lang.UnsupportedOperationException();
- if ("T".equals(parameterName) ) {
- this.fT = (Turnout) newValue;
- return true;
- }
- return false;
- }
-
- public void setT(final Turnout pT) {
- if (!isMutable()) throw new java.lang.UnsupportedOperationException();
- this.fT = pT;
- }
-
- @Override
- public String patternName() {
- return "modes3.queries.tooManyExtraInputsOfTurnout";
- }
-
- @Override
- public List parameterNames() {
- return TooManyExtraInputsOfTurnout.Match.parameterNames;
- }
-
- @Override
- public Object[] toArray() {
- return new Object[]{fT};
- }
-
- @Override
- public TooManyExtraInputsOfTurnout.Match toImmutable() {
- return isMutable() ? newMatch(fT) : this;
- }
-
- @Override
- public String prettyPrint() {
- StringBuilder result = new StringBuilder();
- result.append("\"T\"=" + prettyPrintValue(fT));
- return result.toString();
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(fT);
- }
-
- @Override
- public boolean equals(final Object obj) {
- if (this == obj)
- return true;
- if (obj == null) {
- return false;
- }
- if ((obj instanceof TooManyExtraInputsOfTurnout.Match)) {
- TooManyExtraInputsOfTurnout.Match other = (TooManyExtraInputsOfTurnout.Match) obj;
- return Objects.equals(fT, other.fT);
- } else {
- // this should be infrequent
- if (!(obj instanceof IPatternMatch)) {
- return false;
- }
- IPatternMatch otherSig = (IPatternMatch) obj;
- return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
- }
- }
-
- @Override
- public TooManyExtraInputsOfTurnout specification() {
- return TooManyExtraInputsOfTurnout.instance();
- }
-
- /**
- * Returns an empty, mutable match.
- * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
- *
- * @return the empty match.
- *
- */
- public static TooManyExtraInputsOfTurnout.Match newEmptyMatch() {
- return new Mutable(null);
- }
-
- /**
- * Returns a mutable (partial) match.
- * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
- *
- * @param pT the fixed value of pattern parameter T, or null if not bound.
- * @return the new, mutable (partial) match object.
- *
- */
- public static TooManyExtraInputsOfTurnout.Match newMutableMatch(final Turnout pT) {
- return new Mutable(pT);
- }
-
- /**
- * Returns a new (partial) match.
- * This can be used e.g. to call the matcher with a partial match.
- * The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
- * @param pT the fixed value of pattern parameter T, or null if not bound.
- * @return the (partial) match object.
- *
- */
- public static TooManyExtraInputsOfTurnout.Match newMatch(final Turnout pT) {
- return new Immutable(pT);
- }
-
- private static final class Mutable extends TooManyExtraInputsOfTurnout.Match {
- Mutable(final Turnout pT) {
- super(pT);
- }
-
- @Override
- public boolean isMutable() {
- return true;
- }
- }
-
- private static final class Immutable extends TooManyExtraInputsOfTurnout.Match {
- Immutable(final Turnout pT) {
- super(pT);
- }
-
- @Override
- public boolean isMutable() {
- return false;
- }
- }
- }
-
- /**
- * Generated pattern matcher API of the modes3.queries.tooManyExtraInputsOfTurnout pattern,
- * providing pattern-specific query methods.
- *
- *
Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
- * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
- *
- *
Matches of the pattern will be represented as {@link Match}.
- *
- *
Original source:
- *
- * {@literal @}Constraint(message = "tooManyExtraInputsOfTurnout", severity = "error", key = { T })
- * pattern tooManyExtraInputsOfTurnout(T : Turnout) {
- * find extraInputOfTurnout(T, I1);
- * find extraInputOfTurnout(T, I2);
- * I1 != I2;
- * }
- *
- *
- * @see Match
- * @see TooManyExtraInputsOfTurnout
- *
- */
- public static class Matcher extends BaseMatcher {
- /**
- * Initializes the pattern matcher within an existing VIATRA Query engine.
- * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
- *
- * @param engine the existing VIATRA Query engine in which this matcher will be created.
- * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
- *
- */
- public static TooManyExtraInputsOfTurnout.Matcher on(final ViatraQueryEngine engine) {
- // check if matcher already exists
- Matcher matcher = engine.getExistingMatcher(querySpecification());
- if (matcher == null) {
- matcher = (Matcher)engine.getMatcher(querySpecification());
- }
- return matcher;
- }
-
- /**
- * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
- * @return an initialized matcher
- * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
- *
- */
- public static TooManyExtraInputsOfTurnout.Matcher create() {
- return new Matcher();
- }
-
- private static final int POSITION_T = 0;
-
- private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(TooManyExtraInputsOfTurnout.Matcher.class);
-
- /**
- * Initializes the pattern matcher within an existing VIATRA Query engine.
- * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
- *
- * @param engine the existing VIATRA Query engine in which this matcher will be created.
- * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
- *
- */
- private Matcher() {
- super(querySpecification());
- }
-
- /**
- * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
- * @param pT the fixed value of pattern parameter T, or null if not bound.
- * @return matches represented as a Match object.
- *
- */
- public Collection getAllMatches(final Turnout pT) {
- return rawStreamAllMatches(new Object[]{pT}).collect(Collectors.toSet());
- }
-
- /**
- * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
- *
- * NOTE: It is important not to modify the source model while the stream is being processed.
- * If the match set of the pattern changes during processing, the contents of the stream is undefined.
- * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
- * @param pT the fixed value of pattern parameter T, or null if not bound.
- * @return a stream of matches represented as a Match object.
- *
- */
- public Stream streamAllMatches(final Turnout pT) {
- return rawStreamAllMatches(new Object[]{pT});
- }
-
- /**
- * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
- * Neither determinism nor randomness of selection is guaranteed.
- * @param pT the fixed value of pattern parameter T, or null if not bound.
- * @return a match represented as a Match object, or null if no match is found.
- *
- */
- public Optional getOneArbitraryMatch(final Turnout pT) {
- return rawGetOneArbitraryMatch(new Object[]{pT});
- }
-
- /**
- * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
- * under any possible substitution of the unspecified parameters (if any).
- * @param pT the fixed value of pattern parameter T, or null if not bound.
- * @return true if the input is a valid (partial) match of the pattern.
- *
- */
- public boolean hasMatch(final Turnout pT) {
- return rawHasMatch(new Object[]{pT});
- }
-
- /**
- * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
- * @param pT the fixed value of pattern parameter T, or null if not bound.
- * @return the number of pattern matches found.
- *
- */
- public int countMatches(final Turnout pT) {
- return rawCountMatches(new Object[]{pT});
- }
-
- /**
- * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
- * Neither determinism nor randomness of selection is guaranteed.
- * @param pT the fixed value of pattern parameter T, or null if not bound.
- * @param processor the action that will process the selected match.
- * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
- *
- */
- public boolean forOneArbitraryMatch(final Turnout pT, final Consumer super TooManyExtraInputsOfTurnout.Match> processor) {
- return rawForOneArbitraryMatch(new Object[]{pT}, processor);
- }
-
- /**
- * Returns a new (partial) match.
- * This can be used e.g. to call the matcher with a partial match.
- * The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
- * @param pT the fixed value of pattern parameter T, or null if not bound.
- * @return the (partial) match object.
- *
- */
- public TooManyExtraInputsOfTurnout.Match newMatch(final Turnout pT) {
- return TooManyExtraInputsOfTurnout.Match.newMatch(pT);
- }
-
- /**
- * Retrieve the set of values that occur in matches for T.
- * @return the Set of all values or empty set if there are no matches
- *
- */
- protected Stream rawStreamAllValuesOfT(final Object[] parameters) {
- return rawStreamAllValues(POSITION_T, parameters).map(Turnout.class::cast);
- }
-
- /**
- * Retrieve the set of values that occur in matches for T.
- * @return the Set of all values or empty set if there are no matches
- *
- */
- public Set getAllValuesOfT() {
- return rawStreamAllValuesOfT(emptyArray()).collect(Collectors.toSet());
- }
-
- /**
- * Retrieve the set of values that occur in matches for T.
- * @return the Set of all values or empty set if there are no matches
- *
- */
- public Stream streamAllValuesOfT() {
- return rawStreamAllValuesOfT(emptyArray());
- }
-
- @Override
- protected TooManyExtraInputsOfTurnout.Match tupleToMatch(final Tuple t) {
- try {
- return TooManyExtraInputsOfTurnout.Match.newMatch((Turnout) t.get(POSITION_T));
- } catch(ClassCastException e) {
- LOGGER.error("Element(s) in tuple not properly typed!",e);
- return null;
- }
- }
-
- @Override
- protected TooManyExtraInputsOfTurnout.Match arrayToMatch(final Object[] match) {
- try {
- return TooManyExtraInputsOfTurnout.Match.newMatch((Turnout) match[POSITION_T]);
- } catch(ClassCastException e) {
- LOGGER.error("Element(s) in array not properly typed!",e);
- return null;
- }
- }
-
- @Override
- protected TooManyExtraInputsOfTurnout.Match arrayToMatchMutable(final Object[] match) {
- try {
- return TooManyExtraInputsOfTurnout.Match.newMutableMatch((Turnout) match[POSITION_T]);
- } catch(ClassCastException e) {
- LOGGER.error("Element(s) in array not properly typed!",e);
- return null;
- }
- }
-
- /**
- * @return the singleton instance of the query specification of this pattern
- * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
- *
- */
- public static IQuerySpecification querySpecification() {
- return TooManyExtraInputsOfTurnout.instance();
- }
- }
-
- private TooManyExtraInputsOfTurnout() {
- super(GeneratedPQuery.INSTANCE);
- }
-
- /**
- * @return the singleton instance of the query specification
- * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
- *
- */
- public static TooManyExtraInputsOfTurnout instance() {
- try{
- return LazyHolder.INSTANCE;
- } catch (ExceptionInInitializerError err) {
- throw processInitializerError(err);
- }
- }
-
- @Override
- protected TooManyExtraInputsOfTurnout.Matcher instantiate(final ViatraQueryEngine engine) {
- return TooManyExtraInputsOfTurnout.Matcher.on(engine);
- }
-
- @Override
- public TooManyExtraInputsOfTurnout.Matcher instantiate() {
- return TooManyExtraInputsOfTurnout.Matcher.create();
- }
-
- @Override
- public TooManyExtraInputsOfTurnout.Match newEmptyMatch() {
- return TooManyExtraInputsOfTurnout.Match.newEmptyMatch();
- }
-
- @Override
- public TooManyExtraInputsOfTurnout.Match newMatch(final Object... parameters) {
- return TooManyExtraInputsOfTurnout.Match.newMatch((modes3.Turnout) parameters[0]);
- }
-
- /**
- * Inner class allowing the singleton instance of {@link TooManyExtraInputsOfTurnout} to be created
- * not at the class load time of the outer class,
- * but rather at the first call to {@link TooManyExtraInputsOfTurnout#instance()}.
- *
- * This workaround is required e.g. to support recursion.
- *
- */
- private static class LazyHolder {
- private static final TooManyExtraInputsOfTurnout INSTANCE = new TooManyExtraInputsOfTurnout();
-
- /**
- * Statically initializes the query specification after the field {@link #INSTANCE} is assigned.
- * This initialization order is required to support indirect recursion.
- *
- *
The static initializer is defined using a helper field to work around limitations of the code generator.
- *
- */
- private static final Object STATIC_INITIALIZER = ensureInitialized();
-
- public static Object ensureInitialized() {
- INSTANCE.ensureInitializedInternal();
- return null;
- }
- }
-
- private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
- private static final TooManyExtraInputsOfTurnout.GeneratedPQuery INSTANCE = new GeneratedPQuery();
-
- private final PParameter parameter_T = new PParameter("T", "modes3.Turnout", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.ece.mcgill.ca/wcet/modes3", "Turnout")), PParameterDirection.INOUT);
-
- private final List parameters = Arrays.asList(parameter_T);
-
- private GeneratedPQuery() {
- super(PVisibility.PUBLIC);
- }
-
- @Override
- public String getFullyQualifiedName() {
- return "modes3.queries.tooManyExtraInputsOfTurnout";
- }
-
- @Override
- public List getParameterNames() {
- return Arrays.asList("T");
- }
-
- @Override
- public List getParameters() {
- return parameters;
- }
-
- @Override
- public Set doGetContainedBodies() {
- setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
- Set bodies = new LinkedHashSet<>();
- {
- PBody body = new PBody(this);
- PVariable var_T = body.getOrCreateVariableByName("T");
- PVariable var_I1 = body.getOrCreateVariableByName("I1");
- PVariable var_I2 = body.getOrCreateVariableByName("I2");
- new TypeConstraint(body, Tuples.flatTupleOf(var_T), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.ece.mcgill.ca/wcet/modes3", "Turnout")));
- body.setSymbolicParameters(Arrays.asList(
- new ExportedParameter(body, var_T, parameter_T)
- ));
- // find extraInputOfTurnout(T, I1)
- new PositivePatternCall(body, Tuples.flatTupleOf(var_T, var_I1), ExtraInputOfTurnout.instance().getInternalQueryRepresentation());
- // find extraInputOfTurnout(T, I2)
- new PositivePatternCall(body, Tuples.flatTupleOf(var_T, var_I2), ExtraInputOfTurnout.instance().getInternalQueryRepresentation());
- // I1 != I2
- new Inequality(body, var_I1, var_I2);
- bodies.add(body);
- }
- {
- PAnnotation annotation = new PAnnotation("Constraint");
- annotation.addAttribute("message", "tooManyExtraInputsOfTurnout");
- annotation.addAttribute("severity", "error");
- annotation.addAttribute("key", Arrays.asList(new Object[] {
- new ParameterReference("T")
- }));
- addAnnotation(annotation);
- }
- return bodies;
- }
- }
-}
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;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import java.util.stream.Stream;
-import modes3.Segment;
+import modes3.SimpleSegment;
import modes3.queries.Output;
-import modes3.queries.Turnout;
import org.apache.log4j.Logger;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.viatra.query.runtime.api.IPatternMatch;
@@ -33,7 +32,6 @@ import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation
import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference;
import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Inequality;
-import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.NegativePatternCall;
import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall;
import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
@@ -55,8 +53,7 @@ import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
* //}
*
* {@literal @}Constraint(message = "tooManyInputsOfSegment", severity = "error", key = { S })
- * pattern tooManyInputsOfSegment(S : Segment) {
- * neg find turnout(S);
+ * pattern tooManyInputsOfSegment(S : SimpleSegment) {
* find output(I1, S);
* find output(I2, S);
* find output(I3, S);
@@ -85,11 +82,11 @@ public final class TooManyInputsOfSegment extends BaseGeneratedEMFQuerySpecifica
*
*/
public static abstract class Match extends BasePatternMatch {
- private Segment fS;
+ private SimpleSegment fS;
private static List parameterNames = makeImmutableList("S");
- private Match(final Segment pS) {
+ private Match(final SimpleSegment pS) {
this.fS = pS;
}
@@ -109,7 +106,7 @@ public final class TooManyInputsOfSegment extends BaseGeneratedEMFQuerySpecifica
}
}
- public Segment getS() {
+ public SimpleSegment getS() {
return this.fS;
}
@@ -117,13 +114,13 @@ public final class TooManyInputsOfSegment extends BaseGeneratedEMFQuerySpecifica
public boolean set(final String parameterName, final Object newValue) {
if (!isMutable()) throw new java.lang.UnsupportedOperationException();
if ("S".equals(parameterName) ) {
- this.fS = (Segment) newValue;
+ this.fS = (SimpleSegment) newValue;
return true;
}
return false;
}
- public void setS(final Segment pS) {
+ public void setS(final SimpleSegment pS) {
if (!isMutable()) throw new java.lang.UnsupportedOperationException();
this.fS = pS;
}
@@ -204,7 +201,7 @@ public final class TooManyInputsOfSegment extends BaseGeneratedEMFQuerySpecifica
* @return the new, mutable (partial) match object.
*
*/
- public static TooManyInputsOfSegment.Match newMutableMatch(final Segment pS) {
+ public static TooManyInputsOfSegment.Match newMutableMatch(final SimpleSegment pS) {
return new Mutable(pS);
}
@@ -216,12 +213,12 @@ public final class TooManyInputsOfSegment extends BaseGeneratedEMFQuerySpecifica
* @return the (partial) match object.
*
*/
- public static TooManyInputsOfSegment.Match newMatch(final Segment pS) {
+ public static TooManyInputsOfSegment.Match newMatch(final SimpleSegment pS) {
return new Immutable(pS);
}
private static final class Mutable extends TooManyInputsOfSegment.Match {
- Mutable(final Segment pS) {
+ Mutable(final SimpleSegment pS) {
super(pS);
}
@@ -232,7 +229,7 @@ public final class TooManyInputsOfSegment extends BaseGeneratedEMFQuerySpecifica
}
private static final class Immutable extends TooManyInputsOfSegment.Match {
- Immutable(final Segment pS) {
+ Immutable(final SimpleSegment pS) {
super(pS);
}
@@ -261,8 +258,7 @@ public final class TooManyInputsOfSegment extends BaseGeneratedEMFQuerySpecifica
* //}
*
* {@literal @}Constraint(message = "tooManyInputsOfSegment", severity = "error", key = { S })
- * pattern tooManyInputsOfSegment(S : Segment) {
- * neg find turnout(S);
+ * pattern tooManyInputsOfSegment(S : SimpleSegment) {
* find output(I1, S);
* find output(I2, S);
* find output(I3, S);
@@ -326,7 +322,7 @@ public final class TooManyInputsOfSegment extends BaseGeneratedEMFQuerySpecifica
* @return matches represented as a Match object.
*
*/
- public Collection getAllMatches(final Segment pS) {
+ public Collection getAllMatches(final SimpleSegment pS) {
return rawStreamAllMatches(new Object[]{pS}).collect(Collectors.toSet());
}
@@ -340,7 +336,7 @@ public final class TooManyInputsOfSegment extends BaseGeneratedEMFQuerySpecifica
* @return a stream of matches represented as a Match object.
*
*/
- public Stream streamAllMatches(final Segment pS) {
+ public Stream streamAllMatches(final SimpleSegment pS) {
return rawStreamAllMatches(new Object[]{pS});
}
@@ -351,7 +347,7 @@ public final class TooManyInputsOfSegment extends BaseGeneratedEMFQuerySpecifica
* @return a match represented as a Match object, or null if no match is found.
*
*/
- public Optional getOneArbitraryMatch(final Segment pS) {
+ public Optional getOneArbitraryMatch(final SimpleSegment pS) {
return rawGetOneArbitraryMatch(new Object[]{pS});
}
@@ -362,7 +358,7 @@ public final class TooManyInputsOfSegment extends BaseGeneratedEMFQuerySpecifica
* @return true if the input is a valid (partial) match of the pattern.
*
*/
- public boolean hasMatch(final Segment pS) {
+ public boolean hasMatch(final SimpleSegment pS) {
return rawHasMatch(new Object[]{pS});
}
@@ -372,7 +368,7 @@ public final class TooManyInputsOfSegment extends BaseGeneratedEMFQuerySpecifica
* @return the number of pattern matches found.
*
*/
- public int countMatches(final Segment pS) {
+ public int countMatches(final SimpleSegment pS) {
return rawCountMatches(new Object[]{pS});
}
@@ -384,7 +380,7 @@ public final class TooManyInputsOfSegment extends BaseGeneratedEMFQuerySpecifica
* @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
*
*/
- public boolean forOneArbitraryMatch(final Segment pS, final Consumer super TooManyInputsOfSegment.Match> processor) {
+ public boolean forOneArbitraryMatch(final SimpleSegment pS, final Consumer super TooManyInputsOfSegment.Match> processor) {
return rawForOneArbitraryMatch(new Object[]{pS}, processor);
}
@@ -396,7 +392,7 @@ public final class TooManyInputsOfSegment extends BaseGeneratedEMFQuerySpecifica
* @return the (partial) match object.
*
*/
- public TooManyInputsOfSegment.Match newMatch(final Segment pS) {
+ public TooManyInputsOfSegment.Match newMatch(final SimpleSegment pS) {
return TooManyInputsOfSegment.Match.newMatch(pS);
}
@@ -405,8 +401,8 @@ public final class TooManyInputsOfSegment extends BaseGeneratedEMFQuerySpecifica
* @return the Set of all values or empty set if there are no matches
*
*/
- protected Stream rawStreamAllValuesOfS(final Object[] parameters) {
- return rawStreamAllValues(POSITION_S, parameters).map(Segment.class::cast);
+ protected Stream rawStreamAllValuesOfS(final Object[] parameters) {
+ return rawStreamAllValues(POSITION_S, parameters).map(SimpleSegment.class::cast);
}
/**
@@ -414,7 +410,7 @@ public final class TooManyInputsOfSegment extends BaseGeneratedEMFQuerySpecifica
* @return the Set of all values or empty set if there are no matches
*
*/
- public Set getAllValuesOfS() {
+ public Set getAllValuesOfS() {
return rawStreamAllValuesOfS(emptyArray()).collect(Collectors.toSet());
}
@@ -423,14 +419,14 @@ public final class TooManyInputsOfSegment extends BaseGeneratedEMFQuerySpecifica
* @return the Set of all values or empty set if there are no matches
*
*/
- public Stream streamAllValuesOfS() {
+ public Stream streamAllValuesOfS() {
return rawStreamAllValuesOfS(emptyArray());
}
@Override
protected TooManyInputsOfSegment.Match tupleToMatch(final Tuple t) {
try {
- return TooManyInputsOfSegment.Match.newMatch((Segment) t.get(POSITION_S));
+ return TooManyInputsOfSegment.Match.newMatch((SimpleSegment) t.get(POSITION_S));
} catch(ClassCastException e) {
LOGGER.error("Element(s) in tuple not properly typed!",e);
return null;
@@ -440,7 +436,7 @@ public final class TooManyInputsOfSegment extends BaseGeneratedEMFQuerySpecifica
@Override
protected TooManyInputsOfSegment.Match arrayToMatch(final Object[] match) {
try {
- return TooManyInputsOfSegment.Match.newMatch((Segment) match[POSITION_S]);
+ return TooManyInputsOfSegment.Match.newMatch((SimpleSegment) match[POSITION_S]);
} catch(ClassCastException e) {
LOGGER.error("Element(s) in array not properly typed!",e);
return null;
@@ -450,7 +446,7 @@ public final class TooManyInputsOfSegment extends BaseGeneratedEMFQuerySpecifica
@Override
protected TooManyInputsOfSegment.Match arrayToMatchMutable(final Object[] match) {
try {
- return TooManyInputsOfSegment.Match.newMutableMatch((Segment) match[POSITION_S]);
+ return TooManyInputsOfSegment.Match.newMutableMatch((SimpleSegment) match[POSITION_S]);
} catch(ClassCastException e) {
LOGGER.error("Element(s) in array not properly typed!",e);
return null;
@@ -501,7 +497,7 @@ public final class TooManyInputsOfSegment extends BaseGeneratedEMFQuerySpecifica
@Override
public TooManyInputsOfSegment.Match newMatch(final Object... parameters) {
- return TooManyInputsOfSegment.Match.newMatch((modes3.Segment) parameters[0]);
+ return TooManyInputsOfSegment.Match.newMatch((modes3.SimpleSegment) parameters[0]);
}
/**
@@ -533,7 +529,7 @@ public final class TooManyInputsOfSegment extends BaseGeneratedEMFQuerySpecifica
private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
private static final TooManyInputsOfSegment.GeneratedPQuery INSTANCE = new GeneratedPQuery();
- private final PParameter parameter_S = new PParameter("S", "modes3.Segment", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.ece.mcgill.ca/wcet/modes3", "Segment")), PParameterDirection.INOUT);
+ private final PParameter parameter_S = new PParameter("S", "modes3.SimpleSegment", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.ece.mcgill.ca/wcet/modes3", "SimpleSegment")), PParameterDirection.INOUT);
private final List parameters = Arrays.asList(parameter_S);
@@ -566,12 +562,10 @@ public final class TooManyInputsOfSegment extends BaseGeneratedEMFQuerySpecifica
PVariable var_I1 = body.getOrCreateVariableByName("I1");
PVariable var_I2 = body.getOrCreateVariableByName("I2");
PVariable var_I3 = body.getOrCreateVariableByName("I3");
- new TypeConstraint(body, Tuples.flatTupleOf(var_S), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.ece.mcgill.ca/wcet/modes3", "Segment")));
+ new TypeConstraint(body, Tuples.flatTupleOf(var_S), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.ece.mcgill.ca/wcet/modes3", "SimpleSegment")));
body.setSymbolicParameters(Arrays.asList(
new ExportedParameter(body, var_S, parameter_S)
));
- // neg find turnout(S)
- new NegativePatternCall(body, Tuples.flatTupleOf(var_S), Turnout.instance().getInternalQueryRepresentation());
// find output(I1, S)
new PositivePatternCall(body, Tuples.flatTupleOf(var_I1, var_S), Output.instance().getInternalQueryRepresentation());
// find output(I2, S)
diff --git a/Domains/ca.mcgill.rtgmrt.example.modes3/vql-gen/modes3/queries/TooManyInputsOfTurnout.java b/Domains/ca.mcgill.rtgmrt.example.modes3/vql-gen/modes3/queries/TooManyInputsOfTurnout.java
new file mode 100644
index 00000000..93076cbb
--- /dev/null
+++ b/Domains/ca.mcgill.rtgmrt.example.modes3/vql-gen/modes3/queries/TooManyInputsOfTurnout.java
@@ -0,0 +1,600 @@
+/**
+ * Generated from platform:/resource/ca.mcgill.rtgmrt.example.modes3/src/modes3/queries/Modes3Queries.vql
+ */
+package modes3.queries;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Set;
+import java.util.function.Consumer;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import modes3.Turnout;
+import modes3.queries.Adjacent;
+import org.apache.log4j.Logger;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.viatra.query.runtime.api.IPatternMatch;
+import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
+import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
+import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
+import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
+import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
+import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
+import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
+import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
+import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
+import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
+import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation;
+import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference;
+import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
+import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Inequality;
+import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.PositivePatternCall;
+import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
+import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
+import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
+import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
+import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
+import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
+import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
+
+/**
+ * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
+ *
+ * Original source:
+ *
+ * {@literal @}Constraint(message = "turnoutConnectedToBothOutputs", severity = "error", key = { T })
+ * pattern tooManyInputsOfTurnout(T : Turnout) {
+ * find adjacent(I1, T);
+ * find adjacent(I2, T);
+ * find adjacent(I3, T);
+ * find adjacent(I4, T);
+ * I1 != I2;
+ * I1 != I3;
+ * I1 != I4;
+ * I2 != I3;
+ * I2 != I4;
+ * I3 != I4;
+ * }
+ *
+ *
+ * @see Matcher
+ * @see Match
+ *
+ */
+@SuppressWarnings("all")
+public final class TooManyInputsOfTurnout extends BaseGeneratedEMFQuerySpecification {
+ /**
+ * Pattern-specific match representation of the modes3.queries.tooManyInputsOfTurnout pattern,
+ * to be used in conjunction with {@link Matcher}.
+ *
+ * Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
+ * Each instance is a (possibly partial) substitution of pattern parameters,
+ * usable to represent a match of the pattern in the result of a query,
+ * or to specify the bound (fixed) input parameters when issuing a query.
+ *
+ * @see Matcher
+ *
+ */
+ public static abstract class Match extends BasePatternMatch {
+ private Turnout fT;
+
+ private static List parameterNames = makeImmutableList("T");
+
+ private Match(final Turnout pT) {
+ this.fT = pT;
+ }
+
+ @Override
+ public Object get(final String parameterName) {
+ switch(parameterName) {
+ case "T": return this.fT;
+ default: return null;
+ }
+ }
+
+ @Override
+ public Object get(final int index) {
+ switch(index) {
+ case 0: return this.fT;
+ default: return null;
+ }
+ }
+
+ public Turnout getT() {
+ return this.fT;
+ }
+
+ @Override
+ public boolean set(final String parameterName, final Object newValue) {
+ if (!isMutable()) throw new java.lang.UnsupportedOperationException();
+ if ("T".equals(parameterName) ) {
+ this.fT = (Turnout) newValue;
+ return true;
+ }
+ return false;
+ }
+
+ public void setT(final Turnout pT) {
+ if (!isMutable()) throw new java.lang.UnsupportedOperationException();
+ this.fT = pT;
+ }
+
+ @Override
+ public String patternName() {
+ return "modes3.queries.tooManyInputsOfTurnout";
+ }
+
+ @Override
+ public List parameterNames() {
+ return TooManyInputsOfTurnout.Match.parameterNames;
+ }
+
+ @Override
+ public Object[] toArray() {
+ return new Object[]{fT};
+ }
+
+ @Override
+ public TooManyInputsOfTurnout.Match toImmutable() {
+ return isMutable() ? newMatch(fT) : this;
+ }
+
+ @Override
+ public String prettyPrint() {
+ StringBuilder result = new StringBuilder();
+ result.append("\"T\"=" + prettyPrintValue(fT));
+ return result.toString();
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(fT);
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null) {
+ return false;
+ }
+ if ((obj instanceof TooManyInputsOfTurnout.Match)) {
+ TooManyInputsOfTurnout.Match other = (TooManyInputsOfTurnout.Match) obj;
+ return Objects.equals(fT, other.fT);
+ } else {
+ // this should be infrequent
+ if (!(obj instanceof IPatternMatch)) {
+ return false;
+ }
+ IPatternMatch otherSig = (IPatternMatch) obj;
+ return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
+ }
+ }
+
+ @Override
+ public TooManyInputsOfTurnout specification() {
+ return TooManyInputsOfTurnout.instance();
+ }
+
+ /**
+ * Returns an empty, mutable match.
+ * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
+ *
+ * @return the empty match.
+ *
+ */
+ public static TooManyInputsOfTurnout.Match newEmptyMatch() {
+ return new Mutable(null);
+ }
+
+ /**
+ * Returns a mutable (partial) match.
+ * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
+ *
+ * @param pT the fixed value of pattern parameter T, or null if not bound.
+ * @return the new, mutable (partial) match object.
+ *
+ */
+ public static TooManyInputsOfTurnout.Match newMutableMatch(final Turnout pT) {
+ return new Mutable(pT);
+ }
+
+ /**
+ * Returns a new (partial) match.
+ * This can be used e.g. to call the matcher with a partial match.
+ * The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
+ * @param pT the fixed value of pattern parameter T, or null if not bound.
+ * @return the (partial) match object.
+ *
+ */
+ public static TooManyInputsOfTurnout.Match newMatch(final Turnout pT) {
+ return new Immutable(pT);
+ }
+
+ private static final class Mutable extends TooManyInputsOfTurnout.Match {
+ Mutable(final Turnout pT) {
+ super(pT);
+ }
+
+ @Override
+ public boolean isMutable() {
+ return true;
+ }
+ }
+
+ private static final class Immutable extends TooManyInputsOfTurnout.Match {
+ Immutable(final Turnout pT) {
+ super(pT);
+ }
+
+ @Override
+ public boolean isMutable() {
+ return false;
+ }
+ }
+ }
+
+ /**
+ * Generated pattern matcher API of the modes3.queries.tooManyInputsOfTurnout pattern,
+ * providing pattern-specific query methods.
+ *
+ *
Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
+ * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
+ *
+ *
Matches of the pattern will be represented as {@link Match}.
+ *
+ *
Original source:
+ *
+ * {@literal @}Constraint(message = "turnoutConnectedToBothOutputs", severity = "error", key = { T })
+ * pattern tooManyInputsOfTurnout(T : Turnout) {
+ * find adjacent(I1, T);
+ * find adjacent(I2, T);
+ * find adjacent(I3, T);
+ * find adjacent(I4, T);
+ * I1 != I2;
+ * I1 != I3;
+ * I1 != I4;
+ * I2 != I3;
+ * I2 != I4;
+ * I3 != I4;
+ * }
+ *
+ *
+ * @see Match
+ * @see TooManyInputsOfTurnout
+ *
+ */
+ public static class Matcher extends BaseMatcher {
+ /**
+ * Initializes the pattern matcher within an existing VIATRA Query engine.
+ * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
+ *
+ * @param engine the existing VIATRA Query engine in which this matcher will be created.
+ * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
+ *
+ */
+ public static TooManyInputsOfTurnout.Matcher on(final ViatraQueryEngine engine) {
+ // check if matcher already exists
+ Matcher matcher = engine.getExistingMatcher(querySpecification());
+ if (matcher == null) {
+ matcher = (Matcher)engine.getMatcher(querySpecification());
+ }
+ return matcher;
+ }
+
+ /**
+ * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
+ * @return an initialized matcher
+ * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
+ *
+ */
+ public static TooManyInputsOfTurnout.Matcher create() {
+ return new Matcher();
+ }
+
+ private static final int POSITION_T = 0;
+
+ private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(TooManyInputsOfTurnout.Matcher.class);
+
+ /**
+ * Initializes the pattern matcher within an existing VIATRA Query engine.
+ * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
+ *
+ * @param engine the existing VIATRA Query engine in which this matcher will be created.
+ * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
+ *
+ */
+ private Matcher() {
+ super(querySpecification());
+ }
+
+ /**
+ * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
+ * @param pT the fixed value of pattern parameter T, or null if not bound.
+ * @return matches represented as a Match object.
+ *
+ */
+ public Collection getAllMatches(final Turnout pT) {
+ return rawStreamAllMatches(new Object[]{pT}).collect(Collectors.toSet());
+ }
+
+ /**
+ * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
+ *
+ * NOTE: It is important not to modify the source model while the stream is being processed.
+ * If the match set of the pattern changes during processing, the contents of the stream is undefined.
+ * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
+ * @param pT the fixed value of pattern parameter T, or null if not bound.
+ * @return a stream of matches represented as a Match object.
+ *
+ */
+ public Stream streamAllMatches(final Turnout pT) {
+ return rawStreamAllMatches(new Object[]{pT});
+ }
+
+ /**
+ * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
+ * Neither determinism nor randomness of selection is guaranteed.
+ * @param pT the fixed value of pattern parameter T, or null if not bound.
+ * @return a match represented as a Match object, or null if no match is found.
+ *
+ */
+ public Optional getOneArbitraryMatch(final Turnout pT) {
+ return rawGetOneArbitraryMatch(new Object[]{pT});
+ }
+
+ /**
+ * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
+ * under any possible substitution of the unspecified parameters (if any).
+ * @param pT the fixed value of pattern parameter T, or null if not bound.
+ * @return true if the input is a valid (partial) match of the pattern.
+ *
+ */
+ public boolean hasMatch(final Turnout pT) {
+ return rawHasMatch(new Object[]{pT});
+ }
+
+ /**
+ * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
+ * @param pT the fixed value of pattern parameter T, or null if not bound.
+ * @return the number of pattern matches found.
+ *
+ */
+ public int countMatches(final Turnout pT) {
+ return rawCountMatches(new Object[]{pT});
+ }
+
+ /**
+ * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
+ * Neither determinism nor randomness of selection is guaranteed.
+ * @param pT the fixed value of pattern parameter T, or null if not bound.
+ * @param processor the action that will process the selected match.
+ * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
+ *
+ */
+ public boolean forOneArbitraryMatch(final Turnout pT, final Consumer super TooManyInputsOfTurnout.Match> processor) {
+ return rawForOneArbitraryMatch(new Object[]{pT}, processor);
+ }
+
+ /**
+ * Returns a new (partial) match.
+ * This can be used e.g. to call the matcher with a partial match.
+ * The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
+ * @param pT the fixed value of pattern parameter T, or null if not bound.
+ * @return the (partial) match object.
+ *
+ */
+ public TooManyInputsOfTurnout.Match newMatch(final Turnout pT) {
+ return TooManyInputsOfTurnout.Match.newMatch(pT);
+ }
+
+ /**
+ * Retrieve the set of values that occur in matches for T.
+ * @return the Set of all values or empty set if there are no matches
+ *
+ */
+ protected Stream rawStreamAllValuesOfT(final Object[] parameters) {
+ return rawStreamAllValues(POSITION_T, parameters).map(Turnout.class::cast);
+ }
+
+ /**
+ * Retrieve the set of values that occur in matches for T.
+ * @return the Set of all values or empty set if there are no matches
+ *
+ */
+ public Set getAllValuesOfT() {
+ return rawStreamAllValuesOfT(emptyArray()).collect(Collectors.toSet());
+ }
+
+ /**
+ * Retrieve the set of values that occur in matches for T.
+ * @return the Set of all values or empty set if there are no matches
+ *
+ */
+ public Stream streamAllValuesOfT() {
+ return rawStreamAllValuesOfT(emptyArray());
+ }
+
+ @Override
+ protected TooManyInputsOfTurnout.Match tupleToMatch(final Tuple t) {
+ try {
+ return TooManyInputsOfTurnout.Match.newMatch((Turnout) t.get(POSITION_T));
+ } catch(ClassCastException e) {
+ LOGGER.error("Element(s) in tuple not properly typed!",e);
+ return null;
+ }
+ }
+
+ @Override
+ protected TooManyInputsOfTurnout.Match arrayToMatch(final Object[] match) {
+ try {
+ return TooManyInputsOfTurnout.Match.newMatch((Turnout) match[POSITION_T]);
+ } catch(ClassCastException e) {
+ LOGGER.error("Element(s) in array not properly typed!",e);
+ return null;
+ }
+ }
+
+ @Override
+ protected TooManyInputsOfTurnout.Match arrayToMatchMutable(final Object[] match) {
+ try {
+ return TooManyInputsOfTurnout.Match.newMutableMatch((Turnout) match[POSITION_T]);
+ } catch(ClassCastException e) {
+ LOGGER.error("Element(s) in array not properly typed!",e);
+ return null;
+ }
+ }
+
+ /**
+ * @return the singleton instance of the query specification of this pattern
+ * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
+ *
+ */
+ public static IQuerySpecification querySpecification() {
+ return TooManyInputsOfTurnout.instance();
+ }
+ }
+
+ private TooManyInputsOfTurnout() {
+ super(GeneratedPQuery.INSTANCE);
+ }
+
+ /**
+ * @return the singleton instance of the query specification
+ * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
+ *
+ */
+ public static TooManyInputsOfTurnout instance() {
+ try{
+ return LazyHolder.INSTANCE;
+ } catch (ExceptionInInitializerError err) {
+ throw processInitializerError(err);
+ }
+ }
+
+ @Override
+ protected TooManyInputsOfTurnout.Matcher instantiate(final ViatraQueryEngine engine) {
+ return TooManyInputsOfTurnout.Matcher.on(engine);
+ }
+
+ @Override
+ public TooManyInputsOfTurnout.Matcher instantiate() {
+ return TooManyInputsOfTurnout.Matcher.create();
+ }
+
+ @Override
+ public TooManyInputsOfTurnout.Match newEmptyMatch() {
+ return TooManyInputsOfTurnout.Match.newEmptyMatch();
+ }
+
+ @Override
+ public TooManyInputsOfTurnout.Match newMatch(final Object... parameters) {
+ return TooManyInputsOfTurnout.Match.newMatch((modes3.Turnout) parameters[0]);
+ }
+
+ /**
+ * Inner class allowing the singleton instance of {@link TooManyInputsOfTurnout} to be created
+ * not at the class load time of the outer class,
+ * but rather at the first call to {@link TooManyInputsOfTurnout#instance()}.
+ *
+ * This workaround is required e.g. to support recursion.
+ *
+ */
+ private static class LazyHolder {
+ private static final TooManyInputsOfTurnout INSTANCE = new TooManyInputsOfTurnout();
+
+ /**
+ * Statically initializes the query specification after the field {@link #INSTANCE} is assigned.
+ * This initialization order is required to support indirect recursion.
+ *
+ *
The static initializer is defined using a helper field to work around limitations of the code generator.
+ *
+ */
+ private static final Object STATIC_INITIALIZER = ensureInitialized();
+
+ public static Object ensureInitialized() {
+ INSTANCE.ensureInitializedInternal();
+ return null;
+ }
+ }
+
+ private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
+ private static final TooManyInputsOfTurnout.GeneratedPQuery INSTANCE = new GeneratedPQuery();
+
+ private final PParameter parameter_T = new PParameter("T", "modes3.Turnout", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.ece.mcgill.ca/wcet/modes3", "Turnout")), PParameterDirection.INOUT);
+
+ private final List parameters = Arrays.asList(parameter_T);
+
+ private GeneratedPQuery() {
+ super(PVisibility.PUBLIC);
+ }
+
+ @Override
+ public String getFullyQualifiedName() {
+ return "modes3.queries.tooManyInputsOfTurnout";
+ }
+
+ @Override
+ public List getParameterNames() {
+ return Arrays.asList("T");
+ }
+
+ @Override
+ public List getParameters() {
+ return parameters;
+ }
+
+ @Override
+ public Set doGetContainedBodies() {
+ setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
+ Set bodies = new LinkedHashSet<>();
+ {
+ PBody body = new PBody(this);
+ PVariable var_T = body.getOrCreateVariableByName("T");
+ PVariable var_I1 = body.getOrCreateVariableByName("I1");
+ PVariable var_I2 = body.getOrCreateVariableByName("I2");
+ PVariable var_I3 = body.getOrCreateVariableByName("I3");
+ PVariable var_I4 = body.getOrCreateVariableByName("I4");
+ new TypeConstraint(body, Tuples.flatTupleOf(var_T), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.ece.mcgill.ca/wcet/modes3", "Turnout")));
+ body.setSymbolicParameters(Arrays.asList(
+ new ExportedParameter(body, var_T, parameter_T)
+ ));
+ // find adjacent(I1, T)
+ new PositivePatternCall(body, Tuples.flatTupleOf(var_I1, var_T), Adjacent.instance().getInternalQueryRepresentation());
+ // find adjacent(I2, T)
+ new PositivePatternCall(body, Tuples.flatTupleOf(var_I2, var_T), Adjacent.instance().getInternalQueryRepresentation());
+ // find adjacent(I3, T)
+ new PositivePatternCall(body, Tuples.flatTupleOf(var_I3, var_T), Adjacent.instance().getInternalQueryRepresentation());
+ // find adjacent(I4, T)
+ new PositivePatternCall(body, Tuples.flatTupleOf(var_I4, var_T), Adjacent.instance().getInternalQueryRepresentation());
+ // I1 != I2
+ new Inequality(body, var_I1, var_I2);
+ // I1 != I3
+ new Inequality(body, var_I1, var_I3);
+ // I1 != I4
+ new Inequality(body, var_I1, var_I4);
+ // I2 != I3
+ new Inequality(body, var_I2, var_I3);
+ // I2 != I4
+ new Inequality(body, var_I2, var_I4);
+ // I3 != I4
+ new Inequality(body, var_I3, var_I4);
+ bodies.add(body);
+ }
+ {
+ PAnnotation annotation = new PAnnotation("Constraint");
+ annotation.addAttribute("message", "turnoutConnectedToBothOutputs");
+ annotation.addAttribute("severity", "error");
+ annotation.addAttribute("key", Arrays.asList(new Object[] {
+ new ParameterReference("T")
+ }));
+ addAnnotation(annotation);
+ }
+ return bodies;
+ }
+ }
+}
diff --git a/Domains/ca.mcgill.rtgmrt.example.modes3/vql-gen/modes3/queries/Turnout.java b/Domains/ca.mcgill.rtgmrt.example.modes3/vql-gen/modes3/queries/Turnout.java
deleted file mode 100644
index 34c7631c..00000000
--- a/Domains/ca.mcgill.rtgmrt.example.modes3/vql-gen/modes3/queries/Turnout.java
+++ /dev/null
@@ -1,543 +0,0 @@
-/**
- * Generated from platform:/resource/ca.mcgill.rtgmrt.example.modes3/src/modes3/queries/Modes3Queries.vql
- */
-package modes3.queries;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Objects;
-import java.util.Optional;
-import java.util.Set;
-import java.util.function.Consumer;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-import org.apache.log4j.Logger;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.viatra.query.runtime.api.IPatternMatch;
-import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
-import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
-import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
-import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
-import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
-import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
-import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
-import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
-import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
-import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
-import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
-import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
-import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
-import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
-import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
-import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
-import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
-import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
-
-/**
- * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
- *
- * Original source:
- *
- * pattern turnout(T : Turnout) {
- * Turnout(T);
- * }
- *
- *
- * @see Matcher
- * @see Match
- *
- */
-@SuppressWarnings("all")
-public final class Turnout extends BaseGeneratedEMFQuerySpecification {
- /**
- * Pattern-specific match representation of the modes3.queries.turnout pattern,
- * to be used in conjunction with {@link Matcher}.
- *
- * Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
- * Each instance is a (possibly partial) substitution of pattern parameters,
- * usable to represent a match of the pattern in the result of a query,
- * or to specify the bound (fixed) input parameters when issuing a query.
- *
- * @see Matcher
- *
- */
- public static abstract class Match extends BasePatternMatch {
- private modes3.Turnout fT;
-
- private static List parameterNames = makeImmutableList("T");
-
- private Match(final modes3.Turnout pT) {
- this.fT = pT;
- }
-
- @Override
- public Object get(final String parameterName) {
- switch(parameterName) {
- case "T": return this.fT;
- default: return null;
- }
- }
-
- @Override
- public Object get(final int index) {
- switch(index) {
- case 0: return this.fT;
- default: return null;
- }
- }
-
- public modes3.Turnout getT() {
- return this.fT;
- }
-
- @Override
- public boolean set(final String parameterName, final Object newValue) {
- if (!isMutable()) throw new java.lang.UnsupportedOperationException();
- if ("T".equals(parameterName) ) {
- this.fT = (modes3.Turnout) newValue;
- return true;
- }
- return false;
- }
-
- public void setT(final modes3.Turnout pT) {
- if (!isMutable()) throw new java.lang.UnsupportedOperationException();
- this.fT = pT;
- }
-
- @Override
- public String patternName() {
- return "modes3.queries.turnout";
- }
-
- @Override
- public List parameterNames() {
- return Turnout.Match.parameterNames;
- }
-
- @Override
- public Object[] toArray() {
- return new Object[]{fT};
- }
-
- @Override
- public Turnout.Match toImmutable() {
- return isMutable() ? newMatch(fT) : this;
- }
-
- @Override
- public String prettyPrint() {
- StringBuilder result = new StringBuilder();
- result.append("\"T\"=" + prettyPrintValue(fT));
- return result.toString();
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(fT);
- }
-
- @Override
- public boolean equals(final Object obj) {
- if (this == obj)
- return true;
- if (obj == null) {
- return false;
- }
- if ((obj instanceof Turnout.Match)) {
- Turnout.Match other = (Turnout.Match) obj;
- return Objects.equals(fT, other.fT);
- } else {
- // this should be infrequent
- if (!(obj instanceof IPatternMatch)) {
- return false;
- }
- IPatternMatch otherSig = (IPatternMatch) obj;
- return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
- }
- }
-
- @Override
- public Turnout specification() {
- return Turnout.instance();
- }
-
- /**
- * Returns an empty, mutable match.
- * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
- *
- * @return the empty match.
- *
- */
- public static Turnout.Match newEmptyMatch() {
- return new Mutable(null);
- }
-
- /**
- * Returns a mutable (partial) match.
- * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
- *
- * @param pT the fixed value of pattern parameter T, or null if not bound.
- * @return the new, mutable (partial) match object.
- *
- */
- public static Turnout.Match newMutableMatch(final modes3.Turnout pT) {
- return new Mutable(pT);
- }
-
- /**
- * Returns a new (partial) match.
- * This can be used e.g. to call the matcher with a partial match.
- * The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
- * @param pT the fixed value of pattern parameter T, or null if not bound.
- * @return the (partial) match object.
- *
- */
- public static Turnout.Match newMatch(final modes3.Turnout pT) {
- return new Immutable(pT);
- }
-
- private static final class Mutable extends Turnout.Match {
- Mutable(final modes3.Turnout pT) {
- super(pT);
- }
-
- @Override
- public boolean isMutable() {
- return true;
- }
- }
-
- private static final class Immutable extends Turnout.Match {
- Immutable(final modes3.Turnout pT) {
- super(pT);
- }
-
- @Override
- public boolean isMutable() {
- return false;
- }
- }
- }
-
- /**
- * Generated pattern matcher API of the modes3.queries.turnout pattern,
- * providing pattern-specific query methods.
- *
- *
Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
- * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
- *
- *
Matches of the pattern will be represented as {@link Match}.
- *
- *
Original source:
- *
- * pattern turnout(T : Turnout) {
- * Turnout(T);
- * }
- *
- *
- * @see Match
- * @see Turnout
- *
- */
- public static class Matcher extends BaseMatcher {
- /**
- * Initializes the pattern matcher within an existing VIATRA Query engine.
- * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
- *
- * @param engine the existing VIATRA Query engine in which this matcher will be created.
- * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
- *
- */
- public static Turnout.Matcher on(final ViatraQueryEngine engine) {
- // check if matcher already exists
- Matcher matcher = engine.getExistingMatcher(querySpecification());
- if (matcher == null) {
- matcher = (Matcher)engine.getMatcher(querySpecification());
- }
- return matcher;
- }
-
- /**
- * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
- * @return an initialized matcher
- * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
- *
- */
- public static Turnout.Matcher create() {
- return new Matcher();
- }
-
- private static final int POSITION_T = 0;
-
- private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(Turnout.Matcher.class);
-
- /**
- * Initializes the pattern matcher within an existing VIATRA Query engine.
- * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
- *
- * @param engine the existing VIATRA Query engine in which this matcher will be created.
- * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
- *
- */
- private Matcher() {
- super(querySpecification());
- }
-
- /**
- * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
- * @param pT the fixed value of pattern parameter T, or null if not bound.
- * @return matches represented as a Match object.
- *
- */
- public Collection getAllMatches(final modes3.Turnout pT) {
- return rawStreamAllMatches(new Object[]{pT}).collect(Collectors.toSet());
- }
-
- /**
- * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
- *
- * NOTE: It is important not to modify the source model while the stream is being processed.
- * If the match set of the pattern changes during processing, the contents of the stream is undefined.
- * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
- * @param pT the fixed value of pattern parameter T, or null if not bound.
- * @return a stream of matches represented as a Match object.
- *
- */
- public Stream streamAllMatches(final modes3.Turnout pT) {
- return rawStreamAllMatches(new Object[]{pT});
- }
-
- /**
- * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
- * Neither determinism nor randomness of selection is guaranteed.
- * @param pT the fixed value of pattern parameter T, or null if not bound.
- * @return a match represented as a Match object, or null if no match is found.
- *
- */
- public Optional getOneArbitraryMatch(final modes3.Turnout pT) {
- return rawGetOneArbitraryMatch(new Object[]{pT});
- }
-
- /**
- * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
- * under any possible substitution of the unspecified parameters (if any).
- * @param pT the fixed value of pattern parameter T, or null if not bound.
- * @return true if the input is a valid (partial) match of the pattern.
- *
- */
- public boolean hasMatch(final modes3.Turnout pT) {
- return rawHasMatch(new Object[]{pT});
- }
-
- /**
- * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
- * @param pT the fixed value of pattern parameter T, or null if not bound.
- * @return the number of pattern matches found.
- *
- */
- public int countMatches(final modes3.Turnout pT) {
- return rawCountMatches(new Object[]{pT});
- }
-
- /**
- * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
- * Neither determinism nor randomness of selection is guaranteed.
- * @param pT the fixed value of pattern parameter T, or null if not bound.
- * @param processor the action that will process the selected match.
- * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
- *
- */
- public boolean forOneArbitraryMatch(final modes3.Turnout pT, final Consumer super Turnout.Match> processor) {
- return rawForOneArbitraryMatch(new Object[]{pT}, processor);
- }
-
- /**
- * Returns a new (partial) match.
- * This can be used e.g. to call the matcher with a partial match.
- * The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
- * @param pT the fixed value of pattern parameter T, or null if not bound.
- * @return the (partial) match object.
- *
- */
- public Turnout.Match newMatch(final modes3.Turnout pT) {
- return Turnout.Match.newMatch(pT);
- }
-
- /**
- * Retrieve the set of values that occur in matches for T.
- * @return the Set of all values or empty set if there are no matches
- *
- */
- protected Stream rawStreamAllValuesOfT(final Object[] parameters) {
- return rawStreamAllValues(POSITION_T, parameters).map(modes3.Turnout.class::cast);
- }
-
- /**
- * Retrieve the set of values that occur in matches for T.
- * @return the Set of all values or empty set if there are no matches
- *
- */
- public Set getAllValuesOfT() {
- return rawStreamAllValuesOfT(emptyArray()).collect(Collectors.toSet());
- }
-
- /**
- * Retrieve the set of values that occur in matches for T.
- * @return the Set of all values or empty set if there are no matches
- *
- */
- public Stream streamAllValuesOfT() {
- return rawStreamAllValuesOfT(emptyArray());
- }
-
- @Override
- protected Turnout.Match tupleToMatch(final Tuple t) {
- try {
- return Turnout.Match.newMatch((modes3.Turnout) t.get(POSITION_T));
- } catch(ClassCastException e) {
- LOGGER.error("Element(s) in tuple not properly typed!",e);
- return null;
- }
- }
-
- @Override
- protected Turnout.Match arrayToMatch(final Object[] match) {
- try {
- return Turnout.Match.newMatch((modes3.Turnout) match[POSITION_T]);
- } catch(ClassCastException e) {
- LOGGER.error("Element(s) in array not properly typed!",e);
- return null;
- }
- }
-
- @Override
- protected Turnout.Match arrayToMatchMutable(final Object[] match) {
- try {
- return Turnout.Match.newMutableMatch((modes3.Turnout) match[POSITION_T]);
- } catch(ClassCastException e) {
- LOGGER.error("Element(s) in array not properly typed!",e);
- return null;
- }
- }
-
- /**
- * @return the singleton instance of the query specification of this pattern
- * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
- *
- */
- public static IQuerySpecification querySpecification() {
- return Turnout.instance();
- }
- }
-
- private Turnout() {
- super(GeneratedPQuery.INSTANCE);
- }
-
- /**
- * @return the singleton instance of the query specification
- * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
- *
- */
- public static Turnout instance() {
- try{
- return LazyHolder.INSTANCE;
- } catch (ExceptionInInitializerError err) {
- throw processInitializerError(err);
- }
- }
-
- @Override
- protected Turnout.Matcher instantiate(final ViatraQueryEngine engine) {
- return Turnout.Matcher.on(engine);
- }
-
- @Override
- public Turnout.Matcher instantiate() {
- return Turnout.Matcher.create();
- }
-
- @Override
- public Turnout.Match newEmptyMatch() {
- return Turnout.Match.newEmptyMatch();
- }
-
- @Override
- public Turnout.Match newMatch(final Object... parameters) {
- return Turnout.Match.newMatch((modes3.Turnout) parameters[0]);
- }
-
- /**
- * Inner class allowing the singleton instance of {@link Turnout} to be created
- * not at the class load time of the outer class,
- * but rather at the first call to {@link Turnout#instance()}.
- *
- * This workaround is required e.g. to support recursion.
- *
- */
- private static class LazyHolder {
- private static final Turnout INSTANCE = new Turnout();
-
- /**
- * Statically initializes the query specification after the field {@link #INSTANCE} is assigned.
- * This initialization order is required to support indirect recursion.
- *
- *
The static initializer is defined using a helper field to work around limitations of the code generator.
- *
- */
- private static final Object STATIC_INITIALIZER = ensureInitialized();
-
- public static Object ensureInitialized() {
- INSTANCE.ensureInitializedInternal();
- return null;
- }
- }
-
- private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
- private static final Turnout.GeneratedPQuery INSTANCE = new GeneratedPQuery();
-
- private final PParameter parameter_T = new PParameter("T", "modes3.Turnout", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.ece.mcgill.ca/wcet/modes3", "Turnout")), PParameterDirection.INOUT);
-
- private final List parameters = Arrays.asList(parameter_T);
-
- private GeneratedPQuery() {
- super(PVisibility.PUBLIC);
- }
-
- @Override
- public String getFullyQualifiedName() {
- return "modes3.queries.turnout";
- }
-
- @Override
- public List getParameterNames() {
- return Arrays.asList("T");
- }
-
- @Override
- public List getParameters() {
- return parameters;
- }
-
- @Override
- public Set doGetContainedBodies() {
- setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
- Set bodies = new LinkedHashSet<>();
- {
- PBody body = new PBody(this);
- PVariable var_T = body.getOrCreateVariableByName("T");
- new TypeConstraint(body, Tuples.flatTupleOf(var_T), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.ece.mcgill.ca/wcet/modes3", "Turnout")));
- body.setSymbolicParameters(Arrays.asList(
- new ExportedParameter(body, var_T, parameter_T)
- ));
- // Turnout(T)
- new TypeConstraint(body, Tuples.flatTupleOf(var_T), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.ece.mcgill.ca/wcet/modes3", "Turnout")));
- bodies.add(body);
- }
- return bodies;
- }
- }
-}
diff --git a/Domains/ca.mcgill.rtgmrt.example.modes3/vql-gen/modes3/queries/TurnoutInSegments.java b/Domains/ca.mcgill.rtgmrt.example.modes3/vql-gen/modes3/queries/TurnoutInSegments.java
deleted file mode 100644
index 9c9a5d18..00000000
--- a/Domains/ca.mcgill.rtgmrt.example.modes3/vql-gen/modes3/queries/TurnoutInSegments.java
+++ /dev/null
@@ -1,564 +0,0 @@
-/**
- * Generated from platform:/resource/ca.mcgill.rtgmrt.example.modes3/src/modes3/queries/Modes3Queries.vql
- */
-package modes3.queries;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Objects;
-import java.util.Optional;
-import java.util.Set;
-import java.util.function.Consumer;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-import modes3.Turnout;
-import org.apache.log4j.Logger;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.viatra.query.runtime.api.IPatternMatch;
-import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
-import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
-import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery;
-import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification;
-import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
-import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
-import org.eclipse.viatra.query.runtime.emf.types.EClassTransitiveInstancesKey;
-import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey;
-import org.eclipse.viatra.query.runtime.matchers.backend.QueryEvaluationHint;
-import org.eclipse.viatra.query.runtime.matchers.psystem.PBody;
-import org.eclipse.viatra.query.runtime.matchers.psystem.PVariable;
-import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.PAnnotation;
-import org.eclipse.viatra.query.runtime.matchers.psystem.annotations.ParameterReference;
-import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.Equality;
-import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.ExportedParameter;
-import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeConstraint;
-import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
-import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection;
-import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility;
-import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
-import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples;
-import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
-
-/**
- * A pattern-specific query specification that can instantiate Matcher in a type-safe way.
- *
- * Original source:
- *
- * {@literal @}Constraint(message = "turnoutInSegments", severity = "error", key = { T })
- * pattern turnoutInSegments(T : Turnout) {
- * Modes3ModelRoot.segments(_, T);
- * }
- *
- *
- * @see Matcher
- * @see Match
- *
- */
-@SuppressWarnings("all")
-public final class TurnoutInSegments extends BaseGeneratedEMFQuerySpecification {
- /**
- * Pattern-specific match representation of the modes3.queries.turnoutInSegments pattern,
- * to be used in conjunction with {@link Matcher}.
- *
- * Class fields correspond to parameters of the pattern. Fields with value null are considered unassigned.
- * Each instance is a (possibly partial) substitution of pattern parameters,
- * usable to represent a match of the pattern in the result of a query,
- * or to specify the bound (fixed) input parameters when issuing a query.
- *
- * @see Matcher
- *
- */
- public static abstract class Match extends BasePatternMatch {
- private Turnout fT;
-
- private static List parameterNames = makeImmutableList("T");
-
- private Match(final Turnout pT) {
- this.fT = pT;
- }
-
- @Override
- public Object get(final String parameterName) {
- switch(parameterName) {
- case "T": return this.fT;
- default: return null;
- }
- }
-
- @Override
- public Object get(final int index) {
- switch(index) {
- case 0: return this.fT;
- default: return null;
- }
- }
-
- public Turnout getT() {
- return this.fT;
- }
-
- @Override
- public boolean set(final String parameterName, final Object newValue) {
- if (!isMutable()) throw new java.lang.UnsupportedOperationException();
- if ("T".equals(parameterName) ) {
- this.fT = (Turnout) newValue;
- return true;
- }
- return false;
- }
-
- public void setT(final Turnout pT) {
- if (!isMutable()) throw new java.lang.UnsupportedOperationException();
- this.fT = pT;
- }
-
- @Override
- public String patternName() {
- return "modes3.queries.turnoutInSegments";
- }
-
- @Override
- public List parameterNames() {
- return TurnoutInSegments.Match.parameterNames;
- }
-
- @Override
- public Object[] toArray() {
- return new Object[]{fT};
- }
-
- @Override
- public TurnoutInSegments.Match toImmutable() {
- return isMutable() ? newMatch(fT) : this;
- }
-
- @Override
- public String prettyPrint() {
- StringBuilder result = new StringBuilder();
- result.append("\"T\"=" + prettyPrintValue(fT));
- return result.toString();
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(fT);
- }
-
- @Override
- public boolean equals(final Object obj) {
- if (this == obj)
- return true;
- if (obj == null) {
- return false;
- }
- if ((obj instanceof TurnoutInSegments.Match)) {
- TurnoutInSegments.Match other = (TurnoutInSegments.Match) obj;
- return Objects.equals(fT, other.fT);
- } else {
- // this should be infrequent
- if (!(obj instanceof IPatternMatch)) {
- return false;
- }
- IPatternMatch otherSig = (IPatternMatch) obj;
- return Objects.equals(specification(), otherSig.specification()) && Arrays.deepEquals(toArray(), otherSig.toArray());
- }
- }
-
- @Override
- public TurnoutInSegments specification() {
- return TurnoutInSegments.instance();
- }
-
- /**
- * Returns an empty, mutable match.
- * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
- *
- * @return the empty match.
- *
- */
- public static TurnoutInSegments.Match newEmptyMatch() {
- return new Mutable(null);
- }
-
- /**
- * Returns a mutable (partial) match.
- * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
- *
- * @param pT the fixed value of pattern parameter T, or null if not bound.
- * @return the new, mutable (partial) match object.
- *
- */
- public static TurnoutInSegments.Match newMutableMatch(final Turnout pT) {
- return new Mutable(pT);
- }
-
- /**
- * Returns a new (partial) match.
- * This can be used e.g. to call the matcher with a partial match.
- * The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
- * @param pT the fixed value of pattern parameter T, or null if not bound.
- * @return the (partial) match object.
- *
- */
- public static TurnoutInSegments.Match newMatch(final Turnout pT) {
- return new Immutable(pT);
- }
-
- private static final class Mutable extends TurnoutInSegments.Match {
- Mutable(final Turnout pT) {
- super(pT);
- }
-
- @Override
- public boolean isMutable() {
- return true;
- }
- }
-
- private static final class Immutable extends TurnoutInSegments.Match {
- Immutable(final Turnout pT) {
- super(pT);
- }
-
- @Override
- public boolean isMutable() {
- return false;
- }
- }
- }
-
- /**
- * Generated pattern matcher API of the modes3.queries.turnoutInSegments pattern,
- * providing pattern-specific query methods.
- *
- *
Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
- * e.g. in conjunction with {@link ViatraQueryEngine#on(QueryScope)}.
- *
- *
Matches of the pattern will be represented as {@link Match}.
- *
- *
Original source:
- *
- * {@literal @}Constraint(message = "turnoutInSegments", severity = "error", key = { T })
- * pattern turnoutInSegments(T : Turnout) {
- * Modes3ModelRoot.segments(_, T);
- * }
- *
- *
- * @see Match
- * @see TurnoutInSegments
- *
- */
- public static class Matcher extends BaseMatcher {
- /**
- * Initializes the pattern matcher within an existing VIATRA Query engine.
- * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
- *
- * @param engine the existing VIATRA Query engine in which this matcher will be created.
- * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
- *
- */
- public static TurnoutInSegments.Matcher on(final ViatraQueryEngine engine) {
- // check if matcher already exists
- Matcher matcher = engine.getExistingMatcher(querySpecification());
- if (matcher == null) {
- matcher = (Matcher)engine.getMatcher(querySpecification());
- }
- return matcher;
- }
-
- /**
- * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
- * @return an initialized matcher
- * @noreference This method is for internal matcher initialization by the framework, do not call it manually.
- *
- */
- public static TurnoutInSegments.Matcher create() {
- return new Matcher();
- }
-
- private static final int POSITION_T = 0;
-
- private static final Logger LOGGER = ViatraQueryLoggingUtil.getLogger(TurnoutInSegments.Matcher.class);
-
- /**
- * Initializes the pattern matcher within an existing VIATRA Query engine.
- * If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
- *
- * @param engine the existing VIATRA Query engine in which this matcher will be created.
- * @throws ViatraQueryRuntimeException if an error occurs during pattern matcher creation
- *
- */
- private Matcher() {
- super(querySpecification());
- }
-
- /**
- * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
- * @param pT the fixed value of pattern parameter T, or null if not bound.
- * @return matches represented as a Match object.
- *
- */
- public Collection getAllMatches(final Turnout pT) {
- return rawStreamAllMatches(new Object[]{pT}).collect(Collectors.toSet());
- }
-
- /**
- * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
- *
- * NOTE: It is important not to modify the source model while the stream is being processed.
- * If the match set of the pattern changes during processing, the contents of the stream is undefined.
- * In such cases, either rely on {@link #getAllMatches()} or collect the results of the stream in end-user code.
- * @param pT the fixed value of pattern parameter T, or null if not bound.
- * @return a stream of matches represented as a Match object.
- *
- */
- public Stream streamAllMatches(final Turnout pT) {
- return rawStreamAllMatches(new Object[]{pT});
- }
-
- /**
- * Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
- * Neither determinism nor randomness of selection is guaranteed.
- * @param pT the fixed value of pattern parameter T, or null if not bound.
- * @return a match represented as a Match object, or null if no match is found.
- *
- */
- public Optional getOneArbitraryMatch(final Turnout pT) {
- return rawGetOneArbitraryMatch(new Object[]{pT});
- }
-
- /**
- * Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
- * under any possible substitution of the unspecified parameters (if any).
- * @param pT the fixed value of pattern parameter T, or null if not bound.
- * @return true if the input is a valid (partial) match of the pattern.
- *
- */
- public boolean hasMatch(final Turnout pT) {
- return rawHasMatch(new Object[]{pT});
- }
-
- /**
- * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
- * @param pT the fixed value of pattern parameter T, or null if not bound.
- * @return the number of pattern matches found.
- *
- */
- public int countMatches(final Turnout pT) {
- return rawCountMatches(new Object[]{pT});
- }
-
- /**
- * Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
- * Neither determinism nor randomness of selection is guaranteed.
- * @param pT the fixed value of pattern parameter T, or null if not bound.
- * @param processor the action that will process the selected match.
- * @return true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
- *
- */
- public boolean forOneArbitraryMatch(final Turnout pT, final Consumer super TurnoutInSegments.Match> processor) {
- return rawForOneArbitraryMatch(new Object[]{pT}, processor);
- }
-
- /**
- * Returns a new (partial) match.
- * This can be used e.g. to call the matcher with a partial match.
- * The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
- * @param pT the fixed value of pattern parameter T, or null if not bound.
- * @return the (partial) match object.
- *
- */
- public TurnoutInSegments.Match newMatch(final Turnout pT) {
- return TurnoutInSegments.Match.newMatch(pT);
- }
-
- /**
- * Retrieve the set of values that occur in matches for T.
- * @return the Set of all values or empty set if there are no matches
- *
- */
- protected Stream rawStreamAllValuesOfT(final Object[] parameters) {
- return rawStreamAllValues(POSITION_T, parameters).map(Turnout.class::cast);
- }
-
- /**
- * Retrieve the set of values that occur in matches for T.
- * @return the Set of all values or empty set if there are no matches
- *
- */
- public Set getAllValuesOfT() {
- return rawStreamAllValuesOfT(emptyArray()).collect(Collectors.toSet());
- }
-
- /**
- * Retrieve the set of values that occur in matches for T.
- * @return the Set of all values or empty set if there are no matches
- *
- */
- public Stream streamAllValuesOfT() {
- return rawStreamAllValuesOfT(emptyArray());
- }
-
- @Override
- protected TurnoutInSegments.Match tupleToMatch(final Tuple t) {
- try {
- return TurnoutInSegments.Match.newMatch((Turnout) t.get(POSITION_T));
- } catch(ClassCastException e) {
- LOGGER.error("Element(s) in tuple not properly typed!",e);
- return null;
- }
- }
-
- @Override
- protected TurnoutInSegments.Match arrayToMatch(final Object[] match) {
- try {
- return TurnoutInSegments.Match.newMatch((Turnout) match[POSITION_T]);
- } catch(ClassCastException e) {
- LOGGER.error("Element(s) in array not properly typed!",e);
- return null;
- }
- }
-
- @Override
- protected TurnoutInSegments.Match arrayToMatchMutable(final Object[] match) {
- try {
- return TurnoutInSegments.Match.newMutableMatch((Turnout) match[POSITION_T]);
- } catch(ClassCastException e) {
- LOGGER.error("Element(s) in array not properly typed!",e);
- return null;
- }
- }
-
- /**
- * @return the singleton instance of the query specification of this pattern
- * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
- *
- */
- public static IQuerySpecification querySpecification() {
- return TurnoutInSegments.instance();
- }
- }
-
- private TurnoutInSegments() {
- super(GeneratedPQuery.INSTANCE);
- }
-
- /**
- * @return the singleton instance of the query specification
- * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
- *
- */
- public static TurnoutInSegments instance() {
- try{
- return LazyHolder.INSTANCE;
- } catch (ExceptionInInitializerError err) {
- throw processInitializerError(err);
- }
- }
-
- @Override
- protected TurnoutInSegments.Matcher instantiate(final ViatraQueryEngine engine) {
- return TurnoutInSegments.Matcher.on(engine);
- }
-
- @Override
- public TurnoutInSegments.Matcher instantiate() {
- return TurnoutInSegments.Matcher.create();
- }
-
- @Override
- public TurnoutInSegments.Match newEmptyMatch() {
- return TurnoutInSegments.Match.newEmptyMatch();
- }
-
- @Override
- public TurnoutInSegments.Match newMatch(final Object... parameters) {
- return TurnoutInSegments.Match.newMatch((modes3.Turnout) parameters[0]);
- }
-
- /**
- * Inner class allowing the singleton instance of {@link TurnoutInSegments} to be created
- * not at the class load time of the outer class,
- * but rather at the first call to {@link TurnoutInSegments#instance()}.
- *
- * This workaround is required e.g. to support recursion.
- *
- */
- private static class LazyHolder {
- private static final TurnoutInSegments INSTANCE = new TurnoutInSegments();
-
- /**
- * Statically initializes the query specification after the field {@link #INSTANCE} is assigned.
- * This initialization order is required to support indirect recursion.
- *
- *
The static initializer is defined using a helper field to work around limitations of the code generator.
- *
- */
- private static final Object STATIC_INITIALIZER = ensureInitialized();
-
- public static Object ensureInitialized() {
- INSTANCE.ensureInitializedInternal();
- return null;
- }
- }
-
- private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
- private static final TurnoutInSegments.GeneratedPQuery INSTANCE = new GeneratedPQuery();
-
- private final PParameter parameter_T = new PParameter("T", "modes3.Turnout", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.ece.mcgill.ca/wcet/modes3", "Turnout")), PParameterDirection.INOUT);
-
- private final List parameters = Arrays.asList(parameter_T);
-
- private GeneratedPQuery() {
- super(PVisibility.PUBLIC);
- }
-
- @Override
- public String getFullyQualifiedName() {
- return "modes3.queries.turnoutInSegments";
- }
-
- @Override
- public List getParameterNames() {
- return Arrays.asList("T");
- }
-
- @Override
- public List getParameters() {
- return parameters;
- }
-
- @Override
- public Set doGetContainedBodies() {
- setEvaluationHints(new QueryEvaluationHint(null, QueryEvaluationHint.BackendRequirement.UNSPECIFIED));
- Set bodies = new LinkedHashSet<>();
- {
- PBody body = new PBody(this);
- PVariable var_T = body.getOrCreateVariableByName("T");
- PVariable var___0_ = body.getOrCreateVariableByName("_<0>");
- new TypeConstraint(body, Tuples.flatTupleOf(var_T), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.ece.mcgill.ca/wcet/modes3", "Turnout")));
- body.setSymbolicParameters(Arrays.asList(
- new ExportedParameter(body, var_T, parameter_T)
- ));
- // Modes3ModelRoot.segments(_, T)
- new TypeConstraint(body, Tuples.flatTupleOf(var___0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.ece.mcgill.ca/wcet/modes3", "Modes3ModelRoot")));
- PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
- new TypeConstraint(body, Tuples.flatTupleOf(var___0_, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.ece.mcgill.ca/wcet/modes3", "Modes3ModelRoot", "segments")));
- new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.ece.mcgill.ca/wcet/modes3", "Segment")));
- new Equality(body, var__virtual_0_, var_T);
- bodies.add(body);
- }
- {
- PAnnotation annotation = new PAnnotation("Constraint");
- annotation.addAttribute("message", "turnoutInSegments");
- annotation.addAttribute("severity", "error");
- annotation.addAttribute("key", Arrays.asList(new Object[] {
- new ParameterReference("T")
- }));
- addAnnotation(annotation);
- }
- return bodies;
- }
- }
-}
diff --git a/Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/.Modes3ModelGenerator.xtendbin b/Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/.Modes3ModelGenerator.xtendbin
index 4f542a67..77f1ea6e 100644
Binary files a/Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/.Modes3ModelGenerator.xtendbin and b/Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/.Modes3ModelGenerator.xtendbin differ
diff --git a/Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/.Modes3TypeScopeHint.xtendbin b/Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/.Modes3TypeScopeHint.xtendbin
new file mode 100644
index 00000000..4fdbb71b
Binary files /dev/null and b/Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/.Modes3TypeScopeHint.xtendbin differ
diff --git a/Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/.Modes3UnitPropagationGenerator.xtendbin b/Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/.Modes3UnitPropagationGenerator.xtendbin
index 28e763b9..e5e1b63e 100644
Binary files a/Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/.Modes3UnitPropagationGenerator.xtendbin and b/Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/.Modes3UnitPropagationGenerator.xtendbin differ
diff --git a/Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/.gitignore b/Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/.gitignore
index 53dcf60f..fb94df96 100644
--- a/Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/.gitignore
+++ b/Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/.gitignore
@@ -1,2 +1,3 @@
/.Modes3ModelGenerator.java._trace
/.Modes3UnitPropagationGenerator.java._trace
+/.Modes3TypeScopeHint.java._trace
diff --git a/Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/Modes3ModelGenerator.java b/Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/Modes3ModelGenerator.java
index c7364257..f32a7172 100644
--- a/Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/Modes3ModelGenerator.java
+++ b/Domains/ca.mcgill.rtgmrt.example.modes3/xtend-gen/modes3/run/Modes3ModelGenerator.java
@@ -12,7 +12,9 @@ import hu.bme.mit.inf.dslreasoner.ecore2logic.EcoreMetamodelDescriptor;
import hu.bme.mit.inf.dslreasoner.ecore2logic.ecore2logicannotations.Ecore2logicannotationsFactory;
import hu.bme.mit.inf.dslreasoner.ecore2logic.ecore2logicannotations.Ecore2logicannotationsPackage;
import hu.bme.mit.inf.dslreasoner.ecore2logic.ecore2logicannotations.InverseRelationAssertion;
+import hu.bme.mit.inf.dslreasoner.logic.model.builder.DocumentationLevel;
import hu.bme.mit.inf.dslreasoner.logic.model.builder.LogicProblemBuilder;
+import hu.bme.mit.inf.dslreasoner.logic.model.builder.SolutionScope;
import hu.bme.mit.inf.dslreasoner.logic.model.builder.TracedOutput;
import hu.bme.mit.inf.dslreasoner.logic.model.builder.TypeScopes;
import hu.bme.mit.inf.dslreasoner.logic.model.builder.VariableContext;
@@ -48,6 +50,7 @@ import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.par
import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.partialinterpretation.RelationLink;
import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretation2Gml;
import hu.bme.mit.inf.dslreasoner.viatrasolver.partialinterpretationlanguage.visualisation.PartialInterpretationVisualisation;
+import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.DebugConfiguration;
import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.StateCoderStrategy;
import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasoner;
import hu.bme.mit.inf.dslreasoner.viatrasolver.reasoner.ViatraReasonerConfiguration;
@@ -57,12 +60,13 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.function.Consumer;
import java.util.function.Predicate;
import modes3.Modes3Factory;
import modes3.Modes3ModelRoot;
import modes3.Modes3Package;
import modes3.queries.Modes3Queries;
+import modes3.run.Modes3TypeScopeHint;
+import modes3.run.Modes3UnitPropagationGenerator;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EAttribute;
@@ -175,29 +179,47 @@ public class Modes3ModelGenerator {
it_1.minNewElements = this.modelSize;
it_1.maxNewElements = this.modelSize;
final Procedure1