/**
* Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.satellite/src/hu/bme/mit/inf/dslreasoner/domains/satellite/queries/SatelliteQueries.vql
*/
package hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal;
import java.util.Arrays;
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.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.Tuples;
/**
* A pattern-specific query specification that can instantiate GenericPatternMatcher in a type-safe way.
*
*
Original source:
*
* private pattern matchingCommSubsystem(From : CommSubsystem, To : CommSubsystem) {
* UHFCommSubsystem(From);
* UHFCommSubsystem(To);
* } or {
* XCommSubsystem(From);
* XCommSubsystem(To);
* } or {
* KaCommSubsystem(From);
* KaCommSubsystem(To);
* }
*
*
* @see GenericPatternMatcher
* @see GenericPatternMatch
*
*/
@SuppressWarnings("all")
public final class MatchingCommSubsystem extends BaseGeneratedEMFQuerySpecificationWithGenericMatcher {
private MatchingCommSubsystem() {
super(GeneratedPQuery.INSTANCE);
}
/**
* @return the singleton instance of the query specification
* @throws ViatraQueryRuntimeException if the pattern definition could not be loaded
*
*/
public static MatchingCommSubsystem instance() {
try{
return LazyHolder.INSTANCE;
} catch (ExceptionInInitializerError err) {
throw processInitializerError(err);
}
}
/**
* Inner class allowing the singleton instance of {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MatchingCommSubsystem (visibility: PUBLIC, simpleName: MatchingCommSubsystem, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MatchingCommSubsystem, deprecated: ) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)} to be created
* not at the class load time of the outer class,
* but rather at the first call to {@link JvmGenericType: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MatchingCommSubsystem (visibility: PUBLIC, simpleName: MatchingCommSubsystem, identifier: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal.MatchingCommSubsystem, deprecated: ) (abstract: false, static: false, final: true, packageName: hu.bme.mit.inf.dslreasoner.domains.satellite.queries.internal) (interface: false, strictFloatingPoint: false, anonymous: false)#instance()}.
*
* This workaround is required e.g. to support recursion.
*
*/
private static class LazyHolder {
private static final MatchingCommSubsystem INSTANCE = new MatchingCommSubsystem();
/**
* 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 MatchingCommSubsystem.GeneratedPQuery INSTANCE = new GeneratedPQuery();
private final PParameter parameter_From = new PParameter("From", "satellite.CommSubsystem", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "CommSubsystem")), PParameterDirection.INOUT);
private final PParameter parameter_To = new PParameter("To", "satellite.CommSubsystem", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.example.org/satellite", "CommSubsystem")), PParameterDirection.INOUT);
private final List parameters = Arrays.asList(parameter_From, parameter_To);
private GeneratedPQuery() {
super(PVisibility.PRIVATE);
}
@Override
public String getFullyQualifiedName() {
return "hu.bme.mit.inf.dslreasoner.domains.satellite.queries.matchingCommSubsystem";
}
@Override
public List getParameterNames() {
return Arrays.asList("From","To");
}
@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_From = body.getOrCreateVariableByName("From");
PVariable var_To = body.getOrCreateVariableByName("To");
new TypeConstraint(body, Tuples.flatTupleOf(var_From), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem")));
new TypeConstraint(body, Tuples.flatTupleOf(var_To), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem")));
body.setSymbolicParameters(Arrays.asList(
new ExportedParameter(body, var_From, parameter_From),
new ExportedParameter(body, var_To, parameter_To)
));
// UHFCommSubsystem(From)
new TypeConstraint(body, Tuples.flatTupleOf(var_From), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "UHFCommSubsystem")));
// UHFCommSubsystem(To)
new TypeConstraint(body, Tuples.flatTupleOf(var_To), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "UHFCommSubsystem")));
bodies.add(body);
}
{
PBody body = new PBody(this);
PVariable var_From = body.getOrCreateVariableByName("From");
PVariable var_To = body.getOrCreateVariableByName("To");
new TypeConstraint(body, Tuples.flatTupleOf(var_From), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem")));
new TypeConstraint(body, Tuples.flatTupleOf(var_To), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem")));
body.setSymbolicParameters(Arrays.asList(
new ExportedParameter(body, var_From, parameter_From),
new ExportedParameter(body, var_To, parameter_To)
));
// XCommSubsystem(From)
new TypeConstraint(body, Tuples.flatTupleOf(var_From), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "XCommSubsystem")));
// XCommSubsystem(To)
new TypeConstraint(body, Tuples.flatTupleOf(var_To), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "XCommSubsystem")));
bodies.add(body);
}
{
PBody body = new PBody(this);
PVariable var_From = body.getOrCreateVariableByName("From");
PVariable var_To = body.getOrCreateVariableByName("To");
new TypeConstraint(body, Tuples.flatTupleOf(var_From), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem")));
new TypeConstraint(body, Tuples.flatTupleOf(var_To), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "CommSubsystem")));
body.setSymbolicParameters(Arrays.asList(
new ExportedParameter(body, var_From, parameter_From),
new ExportedParameter(body, var_To, parameter_To)
));
// KaCommSubsystem(From)
new TypeConstraint(body, Tuples.flatTupleOf(var_From), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "KaCommSubsystem")));
// KaCommSubsystem(To)
new TypeConstraint(body, Tuples.flatTupleOf(var_To), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.example.org/satellite", "KaCommSubsystem")));
bodies.add(body);
}
return bodies;
}
}
}