/** * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.cps/src/hu/bme/mit/inf/dslreasoner/domains/cps/queries/CpsQueries.vql */ package hu.bme.mit.inf.dslreasoner.domains.cps.queries.internal; import java.util.Arrays; import java.util.Collections; import java.util.LinkedHashSet; import java.util.List; import java.util.Set; import org.eclipse.emf.ecore.EClass; import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecificationWithGenericMatcher; 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.basicdeferred.Equality; 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.Tuples; /** * A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way. * *

Original source: *

 *         private pattern unallocatedAppInstance(App : ApplicationInstance) {
 *         	neg ApplicationInstance.allocatedTo(App, _);
 *         }
 * 
* * @see GenericPatternMatcher * @see GenericPatternMatch * */ @SuppressWarnings("all") public final class UnallocatedAppInstance extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher { private UnallocatedAppInstance() { super(GeneratedPQuery.INSTANCE); } /** * @return the singleton instance of the query specification * @throws ViatraQueryRuntimeException if the pattern definition could not be loaded * */ public static UnallocatedAppInstance instance() { try{ return LazyHolder.INSTANCE; } catch (ExceptionInInitializerError err) { throw processInitializerError(err); } } /** * Inner class allowing the singleton instance of {@link UnallocatedAppInstance} to be created * not at the class load time of the outer class, * but rather at the first call to {@link UnallocatedAppInstance#instance()}. * *

This workaround is required e.g. to support recursion. * */ private static class LazyHolder { private static final UnallocatedAppInstance INSTANCE = new UnallocatedAppInstance(); /** * 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 UnallocatedAppInstance.GeneratedPQuery INSTANCE = new GeneratedPQuery(); private final PParameter parameter_App = new PParameter("App", "hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/cps", "ApplicationInstance")), PParameterDirection.INOUT); private final List parameters = Arrays.asList(parameter_App); private class Embedded_1_ApplicationInstance_allocatedTo extends BaseGeneratedEMFPQuery { private final PParameter parameter_p0 = new PParameter("p0", "hu.bme.mit.inf.dslreasoner.domains.cps.ApplicationInstance", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/cps", "ApplicationInstance")), PParameterDirection.INOUT); private final PParameter parameter_p1 = new PParameter("p1", "hu.bme.mit.inf.dslreasoner.domains.cps.HostInstance", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/cps", "HostInstance")), PParameterDirection.INOUT); private final List embeddedParameters = Arrays.asList(parameter_p0, parameter_p1); public Embedded_1_ApplicationInstance_allocatedTo() { super(PVisibility.EMBEDDED); } @Override public String getFullyQualifiedName() { return GeneratedPQuery.this.getFullyQualifiedName() + "$Embedded_1_ApplicationInstance_allocatedTo"; } @Override public List getParameters() { return embeddedParameters; } @Override public Set doGetContainedBodies() { PBody body = new PBody(this); PVariable var_p0 = body.getOrCreateVariableByName("p0"); PVariable var_p1 = body.getOrCreateVariableByName("p1"); body.setSymbolicParameters(Arrays.asList( new ExportedParameter(body, var_p0, parameter_p0), new ExportedParameter(body, var_p1, parameter_p1) )); // ApplicationInstance.allocatedTo(App, _) new TypeConstraint(body, Tuples.flatTupleOf(var_p0), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationInstance"))); PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}"); new TypeConstraint(body, Tuples.flatTupleOf(var_p0, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.example.org/cps", "ApplicationInstance", "allocatedTo"))); new TypeConstraint(body, Tuples.flatTupleOf(var__virtual_0_), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "HostInstance"))); new Equality(body, var__virtual_0_, var_p1); return Collections.singleton(body); } } private GeneratedPQuery() { super(PVisibility.PRIVATE); } @Override public String getFullyQualifiedName() { return "hu.bme.mit.inf.dslreasoner.domains.cps.queries.unallocatedAppInstance"; } @Override public List getParameterNames() { return Arrays.asList("App"); } @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_App = body.getOrCreateVariableByName("App"); PVariable var___0_ = body.getOrCreateVariableByName("_<0>"); new TypeConstraint(body, Tuples.flatTupleOf(var_App), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/cps", "ApplicationInstance"))); body.setSymbolicParameters(Arrays.asList( new ExportedParameter(body, var_App, parameter_App) )); // neg ApplicationInstance.allocatedTo(App, _) new NegativePatternCall(body, Tuples.flatTupleOf(var_App, var___0_), new UnallocatedAppInstance.GeneratedPQuery.Embedded_1_ApplicationInstance_allocatedTo()); bodies.add(body); } return bodies; } } }