/** * Generated from platform:/resource/hu.bme.mit.inf.dslreasoner.domains.alloyexamples/patterns/hu/bme/mit/inf/dslreasoner/domains/alloyexamples/FileSystem.vql */ package hu.bme.mit.inf.dslreasoner.domains.alloyexamples; 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:
*
*
* @see Matcher
* @see Match
*
*/
@SuppressWarnings("all")
public final class Dir extends BaseGeneratedEMFQuerySpecification
* pattern dir(d: Dir) {
* Dir(d);
* }
*
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 hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir fD;
private static List The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
* @param pD the fixed value of pattern parameter d, or null if not bound.
* @return the (partial) match object.
*
*/
public static Dir.Match newMatch(final hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir pD) {
return new Immutable(pD);
}
private static final class Mutable extends Dir.Match {
Mutable(final hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir pD) {
super(pD);
}
@Override
public boolean isMutable() {
return true;
}
}
private static final class Immutable extends Dir.Match {
Immutable(final hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir pD) {
super(pD);
}
@Override
public boolean isMutable() {
return false;
}
}
}
/**
* Generated pattern matcher API of the hu.bme.mit.inf.dslreasoner.domains.alloyexamples.dir 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:
*
*
* @see Match
* @see Dir
*
*/
public static class Matcher extends BaseMatcher
* pattern dir(d: Dir) {
* Dir(d);
* }
*
The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
* @param pD the fixed value of pattern parameter d, or null if not bound.
* @return the (partial) match object.
*
*/
public Dir.Match newMatch(final hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir pD) {
return Dir.Match.newMatch(pD);
}
/**
* Retrieve the set of values that occur in matches for d.
* @return the Set of all values or empty set if there are no matches
*
*/
protected Stream This workaround is required e.g. to support recursion.
*
*/
private static class LazyHolder {
private static final Dir INSTANCE = new Dir();
/**
* 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 Dir.GeneratedPQuery INSTANCE = new GeneratedPQuery();
private final PParameter parameter_d = new PParameter("d", "hu.bme.mit.inf.dslreasoner.domains.alloyexamples.Filesystem.Dir", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("FS", "Dir")), PParameterDirection.INOUT);
private final List