/** * Generated from platform:/resource/ca.mcgill.ecse.dslreasoner.standalone.test/queries/ca/mcgill/ecse/dslreasoner/standalone/test/yakindu/queries/yakinduPatterns.vql */ package ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries; import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Synchronization; import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Vertex; import ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.Transition; 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.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.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:
* 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 Synchronization fS;
private Vertex fV1;
private Vertex fV2;
private static List The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
* @param pS the fixed value of pattern parameter s, or null if not bound.
* @param pV1 the fixed value of pattern parameter v1, or null if not bound.
* @param pV2 the fixed value of pattern parameter v2, or null if not bound.
* @return the (partial) match object.
*
*/
public static SynchronizedRegionsAreNotSiblings.Match newMatch(final Synchronization pS, final Vertex pV1, final Vertex pV2) {
return new Immutable(pS, pV1, pV2);
}
private static final class Mutable extends SynchronizedRegionsAreNotSiblings.Match {
Mutable(final Synchronization pS, final Vertex pV1, final Vertex pV2) {
super(pS, pV1, pV2);
}
@Override
public boolean isMutable() {
return true;
}
}
private static final class Immutable extends SynchronizedRegionsAreNotSiblings.Match {
Immutable(final Synchronization pS, final Vertex pV1, final Vertex pV2) {
super(pS, pV1, pV2);
}
@Override
public boolean isMutable() {
return false;
}
}
}
/**
* Generated pattern matcher API of the ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.queries.SynchronizedRegionsAreNotSiblings 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:
* The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
* @param pS the fixed value of pattern parameter s, or null if not bound.
* @param pV1 the fixed value of pattern parameter v1, or null if not bound.
* @param pV2 the fixed value of pattern parameter v2, or null if not bound.
* @return the (partial) match object.
*
*/
public SynchronizedRegionsAreNotSiblings.Match newMatch(final Synchronization pS, final Vertex pV1, final Vertex pV2) {
return SynchronizedRegionsAreNotSiblings.Match.newMatch(pS, pV1, pV2);
}
/**
* Retrieve the set of values that occur in matches for s.
* @return the Set of all values or empty set if there are no matches
*
*/
protected Stream
*
* @see Matcher
* @see Match
*
*/
@SuppressWarnings("all")
public final class SynchronizedRegionsAreNotSiblings extends BaseGeneratedEMFQuerySpecification
* {@literal @}Constraint(severity="error", message="error", key = {s})
* pattern SynchronizedRegionsAreNotSiblings(s : Synchronization, v1 : Vertex, v2 : Vertex) {
* find transition(_, v1, s);
* find transition(_, v2, s);
* CompositeElement.regions.vertices(r1, v1);
* CompositeElement.regions.vertices(r2, v2);
* r1 != r2;
* } or {
* find transition(_, s, v1);
* find transition(_, s, v2);
* CompositeElement.regions.vertices(r1, v1);
* CompositeElement.regions.vertices(r2, v2);
* r1 != r2;
* }
*
*
* @see Match
* @see SynchronizedRegionsAreNotSiblings
*
*/
public static class Matcher extends BaseMatcher
* {@literal @}Constraint(severity="error", message="error", key = {s})
* pattern SynchronizedRegionsAreNotSiblings(s : Synchronization, v1 : Vertex, v2 : Vertex) {
* find transition(_, v1, s);
* find transition(_, v2, s);
* CompositeElement.regions.vertices(r1, v1);
* CompositeElement.regions.vertices(r2, v2);
* r1 != r2;
* } or {
* find transition(_, s, v1);
* find transition(_, s, v2);
* CompositeElement.regions.vertices(r1, v1);
* CompositeElement.regions.vertices(r2, v2);
* r1 != r2;
* }
*
This workaround is required e.g. to support recursion. * */ private static class LazyHolder { private final static SynchronizedRegionsAreNotSiblings INSTANCE = new SynchronizedRegionsAreNotSiblings(); /** * 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 final static Object STATIC_INITIALIZER = ensureInitialized();
public static Object ensureInitialized() {
INSTANCE.ensureInitializedInternal();
return null;
}
}
private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
private final static SynchronizedRegionsAreNotSiblings.GeneratedPQuery INSTANCE = new GeneratedPQuery();
private final PParameter parameter_s = new PParameter("s", "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Synchronization", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("YakinduMetamodel", "Synchronization")), PParameterDirection.INOUT);
private final PParameter parameter_v1 = new PParameter("v1", "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Vertex", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("YakinduMetamodel", "Vertex")), PParameterDirection.INOUT);
private final PParameter parameter_v2 = new PParameter("v2", "ca.mcgill.ecse.dslreasoner.standalone.test.yakindu.Vertex", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("YakinduMetamodel", "Vertex")), PParameterDirection.INOUT);
private final List