Bump compatibility to Viatra 2.0
diff --git a/cps/addons/org.eclipse.viatra.examples.cps.queries.validation/src-gen/org/eclipse/viatra/examples/cps/model/validation/.gitignore b/cps/addons/org.eclipse.viatra.examples.cps.queries.validation/src-gen/org/eclipse/viatra/examples/cps/model/validation/.gitignore
new file mode 100644
index 0000000..162af00
--- /dev/null
+++ b/cps/addons/org.eclipse.viatra.examples.cps.queries.validation/src-gen/org/eclipse/viatra/examples/cps/model/validation/.gitignore
@@ -0,0 +1,12 @@
+/AvailableGreaterThanTotalCpuConstraint0.java
+/AvailableGreaterThanTotalHddConstraint0.java
+/AvailableGreaterThanTotalRamConstraint0.java
+/IdContainsWhitespaceConstraint0.java
+/IdIsNotUniqueConstraint0.java
+/InitialStateNotContainedByStateMachineConstraint0.java
+/MultipleApplicationInstanceInCommunicationGroupConstraint0.java
+/MultipleTransitionsWithSameActionConstraint0.java
+/NodeIpIsNotUniqueConstraint0.java
+/NotAllocatedButRunningConstraint0.java
+/TargetStateNotContainedBySameStateMachineConstraint0.java
+/TransitionWithoutTargetStateConstraint0.java
diff --git a/cps/generator/org.eclipse.viatra.examples.cps.planexecutor/META-INF/MANIFEST.MF b/cps/generator/org.eclipse.viatra.examples.cps.planexecutor/META-INF/MANIFEST.MF
index a6f215b..540f78e 100644
--- a/cps/generator/org.eclipse.viatra.examples.cps.planexecutor/META-INF/MANIFEST.MF
+++ b/cps/generator/org.eclipse.viatra.examples.cps.planexecutor/META-INF/MANIFEST.MF
@@ -6,7 +6,7 @@
Bundle-Vendor: IncQueryLabs Ltd.
Export-Package: org.eclipse.viatra.examples.cps.planexecutor,
org.eclipse.viatra.examples.cps.planexecutor.api
-Require-Bundle: org.eclipse.xtend.lib;bundle-version="2.13.0"
+Require-Bundle: org.eclipse.xtend.lib;bundle-version="2.12.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Import-Package: org.apache.log4j
Automatic-Module-Name: org.eclipse.viatra.examples.cps.planexecutor
diff --git a/cps/transformations/org.eclipse.viatra.examples.cps.xform.serializer.javaio/META-INF/MANIFEST.MF b/cps/transformations/org.eclipse.viatra.examples.cps.xform.serializer.javaio/META-INF/MANIFEST.MF
index 3055e49..a910070 100644
--- a/cps/transformations/org.eclipse.viatra.examples.cps.xform.serializer.javaio/META-INF/MANIFEST.MF
+++ b/cps/transformations/org.eclipse.viatra.examples.cps.xform.serializer.javaio/META-INF/MANIFEST.MF
@@ -10,7 +10,7 @@
org.eclipse.emf.ecore,
org.eclipse.viatra.examples.cps.xform.m2t;bundle-version="0.1.0",
com.google.guava;bundle-version="15.0.0",
- org.eclipse.xtend.lib;bundle-version="2.13.0",
- org.eclipse.xtend.lib.macro;bundle-version="2.13.0"
+ org.eclipse.xtend.lib;bundle-version="2.12.0",
+ org.eclipse.xtend.lib.macro;bundle-version="2.12.0"
Export-Package: org.eclipse.viatra.examples.cps.xform.serializer.javaio
Automatic-Module-Name: org.eclipse.viatra.examples.cps.xform.serializer.javaio
diff --git a/query/headless/org.eclipse.viatra.query.application.queries/.classpath b/query/headless/org.eclipse.viatra.query.application.queries/.classpath
index 9a39368..f0c5549 100644
--- a/query/headless/org.eclipse.viatra.query.application.queries/.classpath
+++ b/query/headless/org.eclipse.viatra.query.application.queries/.classpath
@@ -1,8 +1,8 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="src" path="src-gen"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="src-gen"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/query/headless/org.eclipse.viatra.query.application.queries/.settings/org.eclipse.jdt.core.prefs b/query/headless/org.eclipse.viatra.query.application.queries/.settings/org.eclipse.jdt.core.prefs
index f287d53..0c68a61 100644
--- a/query/headless/org.eclipse.viatra.query.application.queries/.settings/org.eclipse.jdt.core.prefs
+++ b/query/headless/org.eclipse.viatra.query.application.queries/.settings/org.eclipse.jdt.core.prefs
@@ -1,7 +1,7 @@
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.compliance=1.6
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.6
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/query/headless/org.eclipse.viatra.query.application.queries/META-INF/MANIFEST.MF b/query/headless/org.eclipse.viatra.query.application.queries/META-INF/MANIFEST.MF
index 0a72467..d584a50 100644
--- a/query/headless/org.eclipse.viatra.query.application.queries/META-INF/MANIFEST.MF
+++ b/query/headless/org.eclipse.viatra.query.application.queries/META-INF/MANIFEST.MF
@@ -3,12 +3,11 @@
Bundle-Name: VIATRA Headless Example
Bundle-SymbolicName: org.eclipse.viatra.query.application.queries;singleton:=true
Bundle-Version: 1.2.0.qualifier
-Export-Package: org.eclipse.viatra.query.application.queries,
- org.eclipse.viatra.query.application.queries.util
+Export-Package: org.eclipse.viatra.query.application.queries
Require-Bundle: org.eclipse.pde.core,
- org.eclipse.emf.ecore,
- org.eclipse.emf.transaction,
- org.eclipse.xtext.xbase.lib,
- org.eclipse.viatra.query.runtime;bundle-version="[1.2.0,2.0.0)"
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+ org.eclipse.emf.ecore,
+ org.eclipse.emf.transaction,
+ org.eclipse.xtext.xbase.lib,
+ org.eclipse.viatra.query.runtime;bundle-version="[2.0.0,3.0.0)"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Import-Package: org.apache.log4j
diff --git a/query/headless/org.eclipse.viatra.query.application.queries/plugin.xml b/query/headless/org.eclipse.viatra.query.application.queries/plugin.xml
index 305a031..a446aad 100644
--- a/query/headless/org.eclipse.viatra.query.application.queries/plugin.xml
+++ b/query/headless/org.eclipse.viatra.query.application.queries/plugin.xml
@@ -1,5 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?><plugin>
<extension id="org.eclipse.viatra.query.application.queries.HeadlessQueries" point="org.eclipse.viatra.query.runtime.queryspecification">
- <group group="org.eclipse.viatra.query.runtime.extensibility.SingletonExtensionFactory:org.eclipse.viatra.query.application.queries.HeadlessQueries" id="org.eclipse.viatra.query.application.queries.HeadlessQueries"/>
+ <group group="org.eclipse.viatra.query.runtime.extensibility.SingletonExtensionFactory:org.eclipse.viatra.query.application.queries.HeadlessQueries" id="org.eclipse.viatra.query.application.queries.HeadlessQueries">
+ <query-specification fqn="org.eclipse.viatra.query.application.queries.eClassNames"/>
+ <query-specification fqn="org.eclipse.viatra.query.application.queries.eClassNamesKeyword"/>
+ <query-specification fqn="org.eclipse.viatra.query.application.queries.eObject"/>
+ <query-specification fqn="org.eclipse.viatra.query.application.queries.classesInPackage"/>
+ <query-specification fqn="org.eclipse.viatra.query.application.queries.subPackage"/>
+ <query-specification fqn="org.eclipse.viatra.query.application.queries.classesInPackageHierarchy"/>
+ <query-specification fqn="org.eclipse.viatra.query.application.queries.ePackage"/>
+ <query-specification fqn="org.eclipse.viatra.query.application.queries.eClass"/>
+ </group>
</extension>
</plugin>
diff --git a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/.gitignore b/query/headless/org.eclipse.viatra.query.application.queries/src-gen/.gitignore
new file mode 100644
index 0000000..c96a04f
--- /dev/null
+++ b/query/headless/org.eclipse.viatra.query.application.queries/src-gen/.gitignore
@@ -0,0 +1,2 @@
+*
+!.gitignore
\ No newline at end of file
diff --git a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/.gitignore b/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/.gitignore
deleted file mode 100644
index 4c9fa50..0000000
--- a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/.gitignore
+++ /dev/null
@@ -1,17 +0,0 @@
-/.ClassesInPackageHierarchyMatch.java._trace
-/.ClassesInPackageHierarchyMatcher.java._trace
-/.ClassesInPackageMatch.java._trace
-/.ClassesInPackageMatcher.java._trace
-/.EClassMatch.java._trace
-/.EClassMatcher.java._trace
-/.EClassNamesKeywordMatch.java._trace
-/.EClassNamesKeywordMatcher.java._trace
-/.EClassNamesMatch.java._trace
-/.EClassNamesMatcher.java._trace
-/.EObjectMatch.java._trace
-/.EObjectMatcher.java._trace
-/.EPackageMatch.java._trace
-/.EPackageMatcher.java._trace
-/.HeadlessQueries.java._trace
-/.SubPackageMatch.java._trace
-/.SubPackageMatcher.java._trace
diff --git a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/ClassesInPackageHierarchyMatch.java b/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/ClassesInPackageHierarchyMatch.java
deleted file mode 100644
index cf2d46a..0000000
--- a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/ClassesInPackageHierarchyMatch.java
+++ /dev/null
@@ -1,208 +0,0 @@
-package org.eclipse.viatra.query.application.queries;
-
-import java.util.Arrays;
-import java.util.List;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.viatra.query.application.queries.util.ClassesInPackageHierarchyQuerySpecification;
-import org.eclipse.viatra.query.runtime.api.IPatternMatch;
-import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
-import org.eclipse.viatra.query.runtime.exception.ViatraQueryException;
-
-/**
- * Pattern-specific match representation of the org.eclipse.viatra.query.application.queries.classesInPackageHierarchy pattern,
- * to be used in conjunction with {@link ClassesInPackageHierarchyMatcher}.
- *
- * <p>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 ClassesInPackageHierarchyMatcher
- * @see ClassesInPackageHierarchyProcessor
- *
- */
-@SuppressWarnings("all")
-public abstract class ClassesInPackageHierarchyMatch extends BasePatternMatch {
- private EPackage fRootP;
-
- private EClass fContainedClass;
-
- private static List<String> parameterNames = makeImmutableList("rootP", "containedClass");
-
- private ClassesInPackageHierarchyMatch(final EPackage pRootP, final EClass pContainedClass) {
- this.fRootP = pRootP;
- this.fContainedClass = pContainedClass;
- }
-
- @Override
- public Object get(final String parameterName) {
- if ("rootP".equals(parameterName)) return this.fRootP;
- if ("containedClass".equals(parameterName)) return this.fContainedClass;
- return null;
- }
-
- public EPackage getRootP() {
- return this.fRootP;
- }
-
- public EClass getContainedClass() {
- return this.fContainedClass;
- }
-
- @Override
- public boolean set(final String parameterName, final Object newValue) {
- if (!isMutable()) throw new java.lang.UnsupportedOperationException();
- if ("rootP".equals(parameterName) ) {
- this.fRootP = (EPackage) newValue;
- return true;
- }
- if ("containedClass".equals(parameterName) ) {
- this.fContainedClass = (EClass) newValue;
- return true;
- }
- return false;
- }
-
- public void setRootP(final EPackage pRootP) {
- if (!isMutable()) throw new java.lang.UnsupportedOperationException();
- this.fRootP = pRootP;
- }
-
- public void setContainedClass(final EClass pContainedClass) {
- if (!isMutable()) throw new java.lang.UnsupportedOperationException();
- this.fContainedClass = pContainedClass;
- }
-
- @Override
- public String patternName() {
- return "org.eclipse.viatra.query.application.queries.classesInPackageHierarchy";
- }
-
- @Override
- public List<String> parameterNames() {
- return ClassesInPackageHierarchyMatch.parameterNames;
- }
-
- @Override
- public Object[] toArray() {
- return new Object[]{fRootP, fContainedClass};
- }
-
- @Override
- public ClassesInPackageHierarchyMatch toImmutable() {
- return isMutable() ? newMatch(fRootP, fContainedClass) : this;
- }
-
- @Override
- public String prettyPrint() {
- StringBuilder result = new StringBuilder();
- result.append("\"rootP\"=" + prettyPrintValue(fRootP) + ", ");
-
- result.append("\"containedClass\"=" + prettyPrintValue(fContainedClass)
- );
- return result.toString();
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((fRootP == null) ? 0 : fRootP.hashCode());
- result = prime * result + ((fContainedClass == null) ? 0 : fContainedClass.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(final Object obj) {
- if (this == obj)
- return true;
- if (!(obj instanceof ClassesInPackageHierarchyMatch)) { // this should be infrequent
- if (obj == null) {
- return false;
- }
- if (!(obj instanceof IPatternMatch)) {
- return false;
- }
- IPatternMatch otherSig = (IPatternMatch) obj;
- if (!specification().equals(otherSig.specification()))
- return false;
- return Arrays.deepEquals(toArray(), otherSig.toArray());
- }
- ClassesInPackageHierarchyMatch other = (ClassesInPackageHierarchyMatch) obj;
- if (fRootP == null) {if (other.fRootP != null) return false;}
- else if (!fRootP.equals(other.fRootP)) return false;
- if (fContainedClass == null) {if (other.fContainedClass != null) return false;}
- else if (!fContainedClass.equals(other.fContainedClass)) return false;
- return true;
- }
-
- @Override
- public ClassesInPackageHierarchyQuerySpecification specification() {
- try {
- return ClassesInPackageHierarchyQuerySpecification.instance();
- } catch (ViatraQueryException ex) {
- // This cannot happen, as the match object can only be instantiated if the query specification exists
- throw new IllegalStateException (ex);
- }
- }
-
- /**
- * 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 ClassesInPackageHierarchyMatch newEmptyMatch() {
- return new Mutable(null, null);
- }
-
- /**
- * Returns a mutable (partial) match.
- * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
- *
- * @param pRootP the fixed value of pattern parameter rootP, or null if not bound.
- * @param pContainedClass the fixed value of pattern parameter containedClass, or null if not bound.
- * @return the new, mutable (partial) match object.
- *
- */
- public static ClassesInPackageHierarchyMatch newMutableMatch(final EPackage pRootP, final EClass pContainedClass) {
- return new Mutable(pRootP, pContainedClass);
- }
-
- /**
- * Returns a new (partial) match.
- * This can be used e.g. to call the matcher with a partial match.
- * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
- * @param pRootP the fixed value of pattern parameter rootP, or null if not bound.
- * @param pContainedClass the fixed value of pattern parameter containedClass, or null if not bound.
- * @return the (partial) match object.
- *
- */
- public static ClassesInPackageHierarchyMatch newMatch(final EPackage pRootP, final EClass pContainedClass) {
- return new Immutable(pRootP, pContainedClass);
- }
-
- private static final class Mutable extends ClassesInPackageHierarchyMatch {
- Mutable(final EPackage pRootP, final EClass pContainedClass) {
- super(pRootP, pContainedClass);
- }
-
- @Override
- public boolean isMutable() {
- return true;
- }
- }
-
- private static final class Immutable extends ClassesInPackageHierarchyMatch {
- Immutable(final EPackage pRootP, final EClass pContainedClass) {
- super(pRootP, pContainedClass);
- }
-
- @Override
- public boolean isMutable() {
- return false;
- }
- }
-}
diff --git a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/ClassesInPackageHierarchyMatcher.java b/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/ClassesInPackageHierarchyMatcher.java
deleted file mode 100644
index 8f61ca4..0000000
--- a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/ClassesInPackageHierarchyMatcher.java
+++ /dev/null
@@ -1,307 +0,0 @@
-package org.eclipse.viatra.query.application.queries;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-import org.apache.log4j.Logger;
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.viatra.query.application.queries.ClassesInPackageHierarchyMatch;
-import org.eclipse.viatra.query.application.queries.util.ClassesInPackageHierarchyQuerySpecification;
-import org.eclipse.viatra.query.runtime.api.IMatchProcessor;
-import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
-import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
-import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
-import org.eclipse.viatra.query.runtime.exception.ViatraQueryException;
-import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
-import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
-
-/**
- * Generated pattern matcher API of the org.eclipse.viatra.query.application.queries.classesInPackageHierarchy pattern,
- * providing pattern-specific query methods.
- *
- * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
- * e.g. in conjunction with {@link ViatraQueryEngine#on(Notifier)}.
- *
- * <p>Matches of the pattern will be represented as {@link ClassesInPackageHierarchyMatch}.
- *
- * <p>Original source:
- * <code><pre>
- * {@literal @}Edge(source = rootP, target = containedClass, label = "classIn+")
- * {@literal @}Format(color = "#0033ff")
- * pattern classesInPackageHierarchy(rootP: EPackage, containedClass: EClass)
- * {
- * find classesInPackage(rootP,containedClass);
- * } or {
- * find subPackage+(rootP,somePackage);
- * find classesInPackage(somePackage,containedClass);
- * }
- * </pre></code>
- *
- * @see ClassesInPackageHierarchyMatch
- * @see ClassesInPackageHierarchyProcessor
- * @see ClassesInPackageHierarchyQuerySpecification
- *
- */
-@SuppressWarnings("all")
-public class ClassesInPackageHierarchyMatcher extends BaseMatcher<ClassesInPackageHierarchyMatch> {
- /**
- * 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.
- * The match set will be incrementally refreshed upon updates.
- * @param engine the existing VIATRA Query engine in which this matcher will be created.
- * @throws ViatraQueryException if an error occurs during pattern matcher creation
- *
- */
- public static ClassesInPackageHierarchyMatcher on(final ViatraQueryEngine engine) throws ViatraQueryException {
- // check if matcher already exists
- ClassesInPackageHierarchyMatcher matcher = engine.getExistingMatcher(querySpecification());
- if (matcher == null) {
- matcher = new ClassesInPackageHierarchyMatcher(engine);
- // do not have to "put" it into engine.matchers, reportMatcherInitialized() will take care of it
- }
- return matcher;
- }
-
- private final static int POSITION_ROOTP = 0;
-
- private final static int POSITION_CONTAINEDCLASS = 1;
-
- private final static Logger LOGGER = ViatraQueryLoggingUtil.getLogger(ClassesInPackageHierarchyMatcher.class);
-
- /**
- * Initializes the pattern matcher over a given EMF model root (recommended: Resource or ResourceSet).
- * If a pattern matcher is already constructed with the same root, only a light-weight reference is returned.
- * The scope of pattern matching will be the given EMF model root and below (see FAQ for more precise definition).
- * The match set will be incrementally refreshed upon updates from this scope.
- * <p>The matcher will be created within the managed {@link ViatraQueryEngine} belonging to the EMF model root, so
- * multiple matchers will reuse the same engine and benefit from increased performance and reduced memory footprint.
- * @param emfRoot the root of the EMF containment hierarchy where the pattern matcher will operate. Recommended: Resource or ResourceSet.
- * @throws ViatraQueryException if an error occurs during pattern matcher creation
- * @deprecated use {@link #on(ViatraQueryEngine)} instead, e.g. in conjunction with {@link ViatraQueryEngine#on(Notifier)}
- *
- */
- @Deprecated
- public ClassesInPackageHierarchyMatcher(final Notifier emfRoot) throws ViatraQueryException {
- this(ViatraQueryEngine.on(emfRoot));
- }
-
- /**
- * 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.
- * The match set will be incrementally refreshed upon updates.
- * @param engine the existing VIATRA Query engine in which this matcher will be created.
- * @throws ViatraQueryException if an error occurs during pattern matcher creation
- * @deprecated use {@link #on(ViatraQueryEngine)} instead
- *
- */
- @Deprecated
- public ClassesInPackageHierarchyMatcher(final ViatraQueryEngine engine) throws ViatraQueryException {
- super(engine, querySpecification());
- }
-
- /**
- * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
- * @param pRootP the fixed value of pattern parameter rootP, or null if not bound.
- * @param pContainedClass the fixed value of pattern parameter containedClass, or null if not bound.
- * @return matches represented as a ClassesInPackageHierarchyMatch object.
- *
- */
- public Collection<ClassesInPackageHierarchyMatch> getAllMatches(final EPackage pRootP, final EClass pContainedClass) {
- return rawGetAllMatches(new Object[]{pRootP, pContainedClass});
- }
-
- /**
- * 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 pRootP the fixed value of pattern parameter rootP, or null if not bound.
- * @param pContainedClass the fixed value of pattern parameter containedClass, or null if not bound.
- * @return a match represented as a ClassesInPackageHierarchyMatch object, or null if no match is found.
- *
- */
- public ClassesInPackageHierarchyMatch getOneArbitraryMatch(final EPackage pRootP, final EClass pContainedClass) {
- return rawGetOneArbitraryMatch(new Object[]{pRootP, pContainedClass});
- }
-
- /**
- * 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 pRootP the fixed value of pattern parameter rootP, or null if not bound.
- * @param pContainedClass the fixed value of pattern parameter containedClass, or null if not bound.
- * @return true if the input is a valid (partial) match of the pattern.
- *
- */
- public boolean hasMatch(final EPackage pRootP, final EClass pContainedClass) {
- return rawHasMatch(new Object[]{pRootP, pContainedClass});
- }
-
- /**
- * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
- * @param pRootP the fixed value of pattern parameter rootP, or null if not bound.
- * @param pContainedClass the fixed value of pattern parameter containedClass, or null if not bound.
- * @return the number of pattern matches found.
- *
- */
- public int countMatches(final EPackage pRootP, final EClass pContainedClass) {
- return rawCountMatches(new Object[]{pRootP, pContainedClass});
- }
-
- /**
- * Executes the given processor on each match of the pattern that conforms to the given fixed values of some parameters.
- * @param pRootP the fixed value of pattern parameter rootP, or null if not bound.
- * @param pContainedClass the fixed value of pattern parameter containedClass, or null if not bound.
- * @param processor the action that will process each pattern match.
- *
- */
- public void forEachMatch(final EPackage pRootP, final EClass pContainedClass, final IMatchProcessor<? super ClassesInPackageHierarchyMatch> processor) {
- rawForEachMatch(new Object[]{pRootP, pContainedClass}, processor);
- }
-
- /**
- * 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 pRootP the fixed value of pattern parameter rootP, or null if not bound.
- * @param pContainedClass the fixed value of pattern parameter containedClass, 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 EPackage pRootP, final EClass pContainedClass, final IMatchProcessor<? super ClassesInPackageHierarchyMatch> processor) {
- return rawForOneArbitraryMatch(new Object[]{pRootP, pContainedClass}, processor);
- }
-
- /**
- * Returns a new (partial) match.
- * This can be used e.g. to call the matcher with a partial match.
- * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
- * @param pRootP the fixed value of pattern parameter rootP, or null if not bound.
- * @param pContainedClass the fixed value of pattern parameter containedClass, or null if not bound.
- * @return the (partial) match object.
- *
- */
- public ClassesInPackageHierarchyMatch newMatch(final EPackage pRootP, final EClass pContainedClass) {
- return ClassesInPackageHierarchyMatch.newMatch(pRootP, pContainedClass);
- }
-
- /**
- * Retrieve the set of values that occur in matches for rootP.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- protected Set<EPackage> rawAccumulateAllValuesOfrootP(final Object[] parameters) {
- Set<EPackage> results = new HashSet<EPackage>();
- rawAccumulateAllValues(POSITION_ROOTP, parameters, results);
- return results;
- }
-
- /**
- * Retrieve the set of values that occur in matches for rootP.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<EPackage> getAllValuesOfrootP() {
- return rawAccumulateAllValuesOfrootP(emptyArray());
- }
-
- /**
- * Retrieve the set of values that occur in matches for rootP.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<EPackage> getAllValuesOfrootP(final ClassesInPackageHierarchyMatch partialMatch) {
- return rawAccumulateAllValuesOfrootP(partialMatch.toArray());
- }
-
- /**
- * Retrieve the set of values that occur in matches for rootP.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<EPackage> getAllValuesOfrootP(final EClass pContainedClass) {
- return rawAccumulateAllValuesOfrootP(new Object[]{
- null,
- pContainedClass
- });
- }
-
- /**
- * Retrieve the set of values that occur in matches for containedClass.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- protected Set<EClass> rawAccumulateAllValuesOfcontainedClass(final Object[] parameters) {
- Set<EClass> results = new HashSet<EClass>();
- rawAccumulateAllValues(POSITION_CONTAINEDCLASS, parameters, results);
- return results;
- }
-
- /**
- * Retrieve the set of values that occur in matches for containedClass.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<EClass> getAllValuesOfcontainedClass() {
- return rawAccumulateAllValuesOfcontainedClass(emptyArray());
- }
-
- /**
- * Retrieve the set of values that occur in matches for containedClass.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<EClass> getAllValuesOfcontainedClass(final ClassesInPackageHierarchyMatch partialMatch) {
- return rawAccumulateAllValuesOfcontainedClass(partialMatch.toArray());
- }
-
- /**
- * Retrieve the set of values that occur in matches for containedClass.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<EClass> getAllValuesOfcontainedClass(final EPackage pRootP) {
- return rawAccumulateAllValuesOfcontainedClass(new Object[]{
- pRootP,
- null
- });
- }
-
- @Override
- protected ClassesInPackageHierarchyMatch tupleToMatch(final Tuple t) {
- try {
- return ClassesInPackageHierarchyMatch.newMatch((EPackage) t.get(POSITION_ROOTP), (EClass) t.get(POSITION_CONTAINEDCLASS));
- } catch(ClassCastException e) {
- LOGGER.error("Element(s) in tuple not properly typed!",e);
- return null;
- }
- }
-
- @Override
- protected ClassesInPackageHierarchyMatch arrayToMatch(final Object[] match) {
- try {
- return ClassesInPackageHierarchyMatch.newMatch((EPackage) match[POSITION_ROOTP], (EClass) match[POSITION_CONTAINEDCLASS]);
- } catch(ClassCastException e) {
- LOGGER.error("Element(s) in array not properly typed!",e);
- return null;
- }
- }
-
- @Override
- protected ClassesInPackageHierarchyMatch arrayToMatchMutable(final Object[] match) {
- try {
- return ClassesInPackageHierarchyMatch.newMutableMatch((EPackage) match[POSITION_ROOTP], (EClass) match[POSITION_CONTAINEDCLASS]);
- } 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 ViatraQueryException if the pattern definition could not be loaded
- *
- */
- public static IQuerySpecification<ClassesInPackageHierarchyMatcher> querySpecification() throws ViatraQueryException {
- return ClassesInPackageHierarchyQuerySpecification.instance();
- }
-}
diff --git a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/ClassesInPackageMatch.java b/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/ClassesInPackageMatch.java
deleted file mode 100644
index d700694..0000000
--- a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/ClassesInPackageMatch.java
+++ /dev/null
@@ -1,208 +0,0 @@
-package org.eclipse.viatra.query.application.queries;
-
-import java.util.Arrays;
-import java.util.List;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.viatra.query.application.queries.util.ClassesInPackageQuerySpecification;
-import org.eclipse.viatra.query.runtime.api.IPatternMatch;
-import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
-import org.eclipse.viatra.query.runtime.exception.ViatraQueryException;
-
-/**
- * Pattern-specific match representation of the org.eclipse.viatra.query.application.queries.classesInPackage pattern,
- * to be used in conjunction with {@link ClassesInPackageMatcher}.
- *
- * <p>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 ClassesInPackageMatcher
- * @see ClassesInPackageProcessor
- *
- */
-@SuppressWarnings("all")
-public abstract class ClassesInPackageMatch extends BasePatternMatch {
- private EPackage fP;
-
- private EClass fEc;
-
- private static List<String> parameterNames = makeImmutableList("p", "ec");
-
- private ClassesInPackageMatch(final EPackage pP, final EClass pEc) {
- this.fP = pP;
- this.fEc = pEc;
- }
-
- @Override
- public Object get(final String parameterName) {
- if ("p".equals(parameterName)) return this.fP;
- if ("ec".equals(parameterName)) return this.fEc;
- return null;
- }
-
- public EPackage getP() {
- return this.fP;
- }
-
- public EClass getEc() {
- return this.fEc;
- }
-
- @Override
- public boolean set(final String parameterName, final Object newValue) {
- if (!isMutable()) throw new java.lang.UnsupportedOperationException();
- if ("p".equals(parameterName) ) {
- this.fP = (EPackage) newValue;
- return true;
- }
- if ("ec".equals(parameterName) ) {
- this.fEc = (EClass) newValue;
- return true;
- }
- return false;
- }
-
- public void setP(final EPackage pP) {
- if (!isMutable()) throw new java.lang.UnsupportedOperationException();
- this.fP = pP;
- }
-
- public void setEc(final EClass pEc) {
- if (!isMutable()) throw new java.lang.UnsupportedOperationException();
- this.fEc = pEc;
- }
-
- @Override
- public String patternName() {
- return "org.eclipse.viatra.query.application.queries.classesInPackage";
- }
-
- @Override
- public List<String> parameterNames() {
- return ClassesInPackageMatch.parameterNames;
- }
-
- @Override
- public Object[] toArray() {
- return new Object[]{fP, fEc};
- }
-
- @Override
- public ClassesInPackageMatch toImmutable() {
- return isMutable() ? newMatch(fP, fEc) : this;
- }
-
- @Override
- public String prettyPrint() {
- StringBuilder result = new StringBuilder();
- result.append("\"p\"=" + prettyPrintValue(fP) + ", ");
-
- result.append("\"ec\"=" + prettyPrintValue(fEc)
- );
- return result.toString();
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((fP == null) ? 0 : fP.hashCode());
- result = prime * result + ((fEc == null) ? 0 : fEc.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(final Object obj) {
- if (this == obj)
- return true;
- if (!(obj instanceof ClassesInPackageMatch)) { // this should be infrequent
- if (obj == null) {
- return false;
- }
- if (!(obj instanceof IPatternMatch)) {
- return false;
- }
- IPatternMatch otherSig = (IPatternMatch) obj;
- if (!specification().equals(otherSig.specification()))
- return false;
- return Arrays.deepEquals(toArray(), otherSig.toArray());
- }
- ClassesInPackageMatch other = (ClassesInPackageMatch) obj;
- if (fP == null) {if (other.fP != null) return false;}
- else if (!fP.equals(other.fP)) return false;
- if (fEc == null) {if (other.fEc != null) return false;}
- else if (!fEc.equals(other.fEc)) return false;
- return true;
- }
-
- @Override
- public ClassesInPackageQuerySpecification specification() {
- try {
- return ClassesInPackageQuerySpecification.instance();
- } catch (ViatraQueryException ex) {
- // This cannot happen, as the match object can only be instantiated if the query specification exists
- throw new IllegalStateException (ex);
- }
- }
-
- /**
- * 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 ClassesInPackageMatch newEmptyMatch() {
- return new Mutable(null, null);
- }
-
- /**
- * Returns a mutable (partial) match.
- * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
- *
- * @param pP the fixed value of pattern parameter p, or null if not bound.
- * @param pEc the fixed value of pattern parameter ec, or null if not bound.
- * @return the new, mutable (partial) match object.
- *
- */
- public static ClassesInPackageMatch newMutableMatch(final EPackage pP, final EClass pEc) {
- return new Mutable(pP, pEc);
- }
-
- /**
- * Returns a new (partial) match.
- * This can be used e.g. to call the matcher with a partial match.
- * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
- * @param pP the fixed value of pattern parameter p, or null if not bound.
- * @param pEc the fixed value of pattern parameter ec, or null if not bound.
- * @return the (partial) match object.
- *
- */
- public static ClassesInPackageMatch newMatch(final EPackage pP, final EClass pEc) {
- return new Immutable(pP, pEc);
- }
-
- private static final class Mutable extends ClassesInPackageMatch {
- Mutable(final EPackage pP, final EClass pEc) {
- super(pP, pEc);
- }
-
- @Override
- public boolean isMutable() {
- return true;
- }
- }
-
- private static final class Immutable extends ClassesInPackageMatch {
- Immutable(final EPackage pP, final EClass pEc) {
- super(pP, pEc);
- }
-
- @Override
- public boolean isMutable() {
- return false;
- }
- }
-}
diff --git a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/ClassesInPackageMatcher.java b/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/ClassesInPackageMatcher.java
deleted file mode 100644
index 884bfcf..0000000
--- a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/ClassesInPackageMatcher.java
+++ /dev/null
@@ -1,300 +0,0 @@
-package org.eclipse.viatra.query.application.queries;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-import org.apache.log4j.Logger;
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.viatra.query.application.queries.ClassesInPackageMatch;
-import org.eclipse.viatra.query.application.queries.util.ClassesInPackageQuerySpecification;
-import org.eclipse.viatra.query.runtime.api.IMatchProcessor;
-import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
-import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
-import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
-import org.eclipse.viatra.query.runtime.exception.ViatraQueryException;
-import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
-import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
-
-/**
- * Generated pattern matcher API of the org.eclipse.viatra.query.application.queries.classesInPackage pattern,
- * providing pattern-specific query methods.
- *
- * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
- * e.g. in conjunction with {@link ViatraQueryEngine#on(Notifier)}.
- *
- * <p>Matches of the pattern will be represented as {@link ClassesInPackageMatch}.
- *
- * <p>Original source:
- * <code><pre>
- * {@literal @}Edge(source = p, target = ec, label = "classIn")
- * pattern classesInPackage(p : EPackage, ec: EClass) { EPackage.eClassifiers(p,ec); }
- * </pre></code>
- *
- * @see ClassesInPackageMatch
- * @see ClassesInPackageProcessor
- * @see ClassesInPackageQuerySpecification
- *
- */
-@SuppressWarnings("all")
-public class ClassesInPackageMatcher extends BaseMatcher<ClassesInPackageMatch> {
- /**
- * 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.
- * The match set will be incrementally refreshed upon updates.
- * @param engine the existing VIATRA Query engine in which this matcher will be created.
- * @throws ViatraQueryException if an error occurs during pattern matcher creation
- *
- */
- public static ClassesInPackageMatcher on(final ViatraQueryEngine engine) throws ViatraQueryException {
- // check if matcher already exists
- ClassesInPackageMatcher matcher = engine.getExistingMatcher(querySpecification());
- if (matcher == null) {
- matcher = new ClassesInPackageMatcher(engine);
- // do not have to "put" it into engine.matchers, reportMatcherInitialized() will take care of it
- }
- return matcher;
- }
-
- private final static int POSITION_P = 0;
-
- private final static int POSITION_EC = 1;
-
- private final static Logger LOGGER = ViatraQueryLoggingUtil.getLogger(ClassesInPackageMatcher.class);
-
- /**
- * Initializes the pattern matcher over a given EMF model root (recommended: Resource or ResourceSet).
- * If a pattern matcher is already constructed with the same root, only a light-weight reference is returned.
- * The scope of pattern matching will be the given EMF model root and below (see FAQ for more precise definition).
- * The match set will be incrementally refreshed upon updates from this scope.
- * <p>The matcher will be created within the managed {@link ViatraQueryEngine} belonging to the EMF model root, so
- * multiple matchers will reuse the same engine and benefit from increased performance and reduced memory footprint.
- * @param emfRoot the root of the EMF containment hierarchy where the pattern matcher will operate. Recommended: Resource or ResourceSet.
- * @throws ViatraQueryException if an error occurs during pattern matcher creation
- * @deprecated use {@link #on(ViatraQueryEngine)} instead, e.g. in conjunction with {@link ViatraQueryEngine#on(Notifier)}
- *
- */
- @Deprecated
- public ClassesInPackageMatcher(final Notifier emfRoot) throws ViatraQueryException {
- this(ViatraQueryEngine.on(emfRoot));
- }
-
- /**
- * 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.
- * The match set will be incrementally refreshed upon updates.
- * @param engine the existing VIATRA Query engine in which this matcher will be created.
- * @throws ViatraQueryException if an error occurs during pattern matcher creation
- * @deprecated use {@link #on(ViatraQueryEngine)} instead
- *
- */
- @Deprecated
- public ClassesInPackageMatcher(final ViatraQueryEngine engine) throws ViatraQueryException {
- super(engine, querySpecification());
- }
-
- /**
- * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
- * @param pP the fixed value of pattern parameter p, or null if not bound.
- * @param pEc the fixed value of pattern parameter ec, or null if not bound.
- * @return matches represented as a ClassesInPackageMatch object.
- *
- */
- public Collection<ClassesInPackageMatch> getAllMatches(final EPackage pP, final EClass pEc) {
- return rawGetAllMatches(new Object[]{pP, pEc});
- }
-
- /**
- * 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 pP the fixed value of pattern parameter p, or null if not bound.
- * @param pEc the fixed value of pattern parameter ec, or null if not bound.
- * @return a match represented as a ClassesInPackageMatch object, or null if no match is found.
- *
- */
- public ClassesInPackageMatch getOneArbitraryMatch(final EPackage pP, final EClass pEc) {
- return rawGetOneArbitraryMatch(new Object[]{pP, pEc});
- }
-
- /**
- * 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 pP the fixed value of pattern parameter p, or null if not bound.
- * @param pEc the fixed value of pattern parameter ec, or null if not bound.
- * @return true if the input is a valid (partial) match of the pattern.
- *
- */
- public boolean hasMatch(final EPackage pP, final EClass pEc) {
- return rawHasMatch(new Object[]{pP, pEc});
- }
-
- /**
- * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
- * @param pP the fixed value of pattern parameter p, or null if not bound.
- * @param pEc the fixed value of pattern parameter ec, or null if not bound.
- * @return the number of pattern matches found.
- *
- */
- public int countMatches(final EPackage pP, final EClass pEc) {
- return rawCountMatches(new Object[]{pP, pEc});
- }
-
- /**
- * Executes the given processor on each match of the pattern that conforms to the given fixed values of some parameters.
- * @param pP the fixed value of pattern parameter p, or null if not bound.
- * @param pEc the fixed value of pattern parameter ec, or null if not bound.
- * @param processor the action that will process each pattern match.
- *
- */
- public void forEachMatch(final EPackage pP, final EClass pEc, final IMatchProcessor<? super ClassesInPackageMatch> processor) {
- rawForEachMatch(new Object[]{pP, pEc}, processor);
- }
-
- /**
- * 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 pP the fixed value of pattern parameter p, or null if not bound.
- * @param pEc the fixed value of pattern parameter ec, 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 EPackage pP, final EClass pEc, final IMatchProcessor<? super ClassesInPackageMatch> processor) {
- return rawForOneArbitraryMatch(new Object[]{pP, pEc}, processor);
- }
-
- /**
- * Returns a new (partial) match.
- * This can be used e.g. to call the matcher with a partial match.
- * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
- * @param pP the fixed value of pattern parameter p, or null if not bound.
- * @param pEc the fixed value of pattern parameter ec, or null if not bound.
- * @return the (partial) match object.
- *
- */
- public ClassesInPackageMatch newMatch(final EPackage pP, final EClass pEc) {
- return ClassesInPackageMatch.newMatch(pP, pEc);
- }
-
- /**
- * Retrieve the set of values that occur in matches for p.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- protected Set<EPackage> rawAccumulateAllValuesOfp(final Object[] parameters) {
- Set<EPackage> results = new HashSet<EPackage>();
- rawAccumulateAllValues(POSITION_P, parameters, results);
- return results;
- }
-
- /**
- * Retrieve the set of values that occur in matches for p.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<EPackage> getAllValuesOfp() {
- return rawAccumulateAllValuesOfp(emptyArray());
- }
-
- /**
- * Retrieve the set of values that occur in matches for p.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<EPackage> getAllValuesOfp(final ClassesInPackageMatch partialMatch) {
- return rawAccumulateAllValuesOfp(partialMatch.toArray());
- }
-
- /**
- * Retrieve the set of values that occur in matches for p.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<EPackage> getAllValuesOfp(final EClass pEc) {
- return rawAccumulateAllValuesOfp(new Object[]{
- null,
- pEc
- });
- }
-
- /**
- * Retrieve the set of values that occur in matches for ec.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- protected Set<EClass> rawAccumulateAllValuesOfec(final Object[] parameters) {
- Set<EClass> results = new HashSet<EClass>();
- rawAccumulateAllValues(POSITION_EC, parameters, results);
- return results;
- }
-
- /**
- * Retrieve the set of values that occur in matches for ec.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<EClass> getAllValuesOfec() {
- return rawAccumulateAllValuesOfec(emptyArray());
- }
-
- /**
- * Retrieve the set of values that occur in matches for ec.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<EClass> getAllValuesOfec(final ClassesInPackageMatch partialMatch) {
- return rawAccumulateAllValuesOfec(partialMatch.toArray());
- }
-
- /**
- * Retrieve the set of values that occur in matches for ec.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<EClass> getAllValuesOfec(final EPackage pP) {
- return rawAccumulateAllValuesOfec(new Object[]{
- pP,
- null
- });
- }
-
- @Override
- protected ClassesInPackageMatch tupleToMatch(final Tuple t) {
- try {
- return ClassesInPackageMatch.newMatch((EPackage) t.get(POSITION_P), (EClass) t.get(POSITION_EC));
- } catch(ClassCastException e) {
- LOGGER.error("Element(s) in tuple not properly typed!",e);
- return null;
- }
- }
-
- @Override
- protected ClassesInPackageMatch arrayToMatch(final Object[] match) {
- try {
- return ClassesInPackageMatch.newMatch((EPackage) match[POSITION_P], (EClass) match[POSITION_EC]);
- } catch(ClassCastException e) {
- LOGGER.error("Element(s) in array not properly typed!",e);
- return null;
- }
- }
-
- @Override
- protected ClassesInPackageMatch arrayToMatchMutable(final Object[] match) {
- try {
- return ClassesInPackageMatch.newMutableMatch((EPackage) match[POSITION_P], (EClass) match[POSITION_EC]);
- } 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 ViatraQueryException if the pattern definition could not be loaded
- *
- */
- public static IQuerySpecification<ClassesInPackageMatcher> querySpecification() throws ViatraQueryException {
- return ClassesInPackageQuerySpecification.instance();
- }
-}
diff --git a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/EClassMatch.java b/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/EClassMatch.java
deleted file mode 100644
index e92d3d6..0000000
--- a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/EClassMatch.java
+++ /dev/null
@@ -1,183 +0,0 @@
-package org.eclipse.viatra.query.application.queries;
-
-import java.util.Arrays;
-import java.util.List;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.viatra.query.application.queries.util.EClassQuerySpecification;
-import org.eclipse.viatra.query.runtime.api.IPatternMatch;
-import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
-import org.eclipse.viatra.query.runtime.exception.ViatraQueryException;
-
-/**
- * Pattern-specific match representation of the org.eclipse.viatra.query.application.queries.eClass pattern,
- * to be used in conjunction with {@link EClassMatcher}.
- *
- * <p>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 EClassMatcher
- * @see EClassProcessor
- *
- */
-@SuppressWarnings("all")
-public abstract class EClassMatch extends BasePatternMatch {
- private EClass fEc;
-
- private static List<String> parameterNames = makeImmutableList("ec");
-
- private EClassMatch(final EClass pEc) {
- this.fEc = pEc;
- }
-
- @Override
- public Object get(final String parameterName) {
- if ("ec".equals(parameterName)) return this.fEc;
- return null;
- }
-
- public EClass getEc() {
- return this.fEc;
- }
-
- @Override
- public boolean set(final String parameterName, final Object newValue) {
- if (!isMutable()) throw new java.lang.UnsupportedOperationException();
- if ("ec".equals(parameterName) ) {
- this.fEc = (EClass) newValue;
- return true;
- }
- return false;
- }
-
- public void setEc(final EClass pEc) {
- if (!isMutable()) throw new java.lang.UnsupportedOperationException();
- this.fEc = pEc;
- }
-
- @Override
- public String patternName() {
- return "org.eclipse.viatra.query.application.queries.eClass";
- }
-
- @Override
- public List<String> parameterNames() {
- return EClassMatch.parameterNames;
- }
-
- @Override
- public Object[] toArray() {
- return new Object[]{fEc};
- }
-
- @Override
- public EClassMatch toImmutable() {
- return isMutable() ? newMatch(fEc) : this;
- }
-
- @Override
- public String prettyPrint() {
- StringBuilder result = new StringBuilder();
- result.append("\"ec\"=" + prettyPrintValue(fEc)
- );
- return result.toString();
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((fEc == null) ? 0 : fEc.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(final Object obj) {
- if (this == obj)
- return true;
- if (!(obj instanceof EClassMatch)) { // this should be infrequent
- if (obj == null) {
- return false;
- }
- if (!(obj instanceof IPatternMatch)) {
- return false;
- }
- IPatternMatch otherSig = (IPatternMatch) obj;
- if (!specification().equals(otherSig.specification()))
- return false;
- return Arrays.deepEquals(toArray(), otherSig.toArray());
- }
- EClassMatch other = (EClassMatch) obj;
- if (fEc == null) {if (other.fEc != null) return false;}
- else if (!fEc.equals(other.fEc)) return false;
- return true;
- }
-
- @Override
- public EClassQuerySpecification specification() {
- try {
- return EClassQuerySpecification.instance();
- } catch (ViatraQueryException ex) {
- // This cannot happen, as the match object can only be instantiated if the query specification exists
- throw new IllegalStateException (ex);
- }
- }
-
- /**
- * 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 EClassMatch 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 pEc the fixed value of pattern parameter ec, or null if not bound.
- * @return the new, mutable (partial) match object.
- *
- */
- public static EClassMatch newMutableMatch(final EClass pEc) {
- return new Mutable(pEc);
- }
-
- /**
- * Returns a new (partial) match.
- * This can be used e.g. to call the matcher with a partial match.
- * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
- * @param pEc the fixed value of pattern parameter ec, or null if not bound.
- * @return the (partial) match object.
- *
- */
- public static EClassMatch newMatch(final EClass pEc) {
- return new Immutable(pEc);
- }
-
- private static final class Mutable extends EClassMatch {
- Mutable(final EClass pEc) {
- super(pEc);
- }
-
- @Override
- public boolean isMutable() {
- return true;
- }
- }
-
- private static final class Immutable extends EClassMatch {
- Immutable(final EClass pEc) {
- super(pEc);
- }
-
- @Override
- public boolean isMutable() {
- return false;
- }
- }
-}
diff --git a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/EClassMatcher.java b/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/EClassMatcher.java
deleted file mode 100644
index 7085c0a..0000000
--- a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/EClassMatcher.java
+++ /dev/null
@@ -1,229 +0,0 @@
-package org.eclipse.viatra.query.application.queries;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-import org.apache.log4j.Logger;
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.viatra.query.application.queries.EClassMatch;
-import org.eclipse.viatra.query.application.queries.util.EClassQuerySpecification;
-import org.eclipse.viatra.query.runtime.api.IMatchProcessor;
-import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
-import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
-import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
-import org.eclipse.viatra.query.runtime.exception.ViatraQueryException;
-import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
-import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
-
-/**
- * Generated pattern matcher API of the org.eclipse.viatra.query.application.queries.eClass pattern,
- * providing pattern-specific query methods.
- *
- * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
- * e.g. in conjunction with {@link ViatraQueryEngine#on(Notifier)}.
- *
- * <p>Matches of the pattern will be represented as {@link EClassMatch}.
- *
- * <p>Original source:
- * <code><pre>
- * {@literal @}Item(item = ec, label = "EC: $ec.name$")
- * {@literal @}Format(color = "#e8da2c")
- * pattern eClass(ec : EClass) { EClass(ec); }
- * </pre></code>
- *
- * @see EClassMatch
- * @see EClassProcessor
- * @see EClassQuerySpecification
- *
- */
-@SuppressWarnings("all")
-public class EClassMatcher extends BaseMatcher<EClassMatch> {
- /**
- * 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.
- * The match set will be incrementally refreshed upon updates.
- * @param engine the existing VIATRA Query engine in which this matcher will be created.
- * @throws ViatraQueryException if an error occurs during pattern matcher creation
- *
- */
- public static EClassMatcher on(final ViatraQueryEngine engine) throws ViatraQueryException {
- // check if matcher already exists
- EClassMatcher matcher = engine.getExistingMatcher(querySpecification());
- if (matcher == null) {
- matcher = new EClassMatcher(engine);
- // do not have to "put" it into engine.matchers, reportMatcherInitialized() will take care of it
- }
- return matcher;
- }
-
- private final static int POSITION_EC = 0;
-
- private final static Logger LOGGER = ViatraQueryLoggingUtil.getLogger(EClassMatcher.class);
-
- /**
- * Initializes the pattern matcher over a given EMF model root (recommended: Resource or ResourceSet).
- * If a pattern matcher is already constructed with the same root, only a light-weight reference is returned.
- * The scope of pattern matching will be the given EMF model root and below (see FAQ for more precise definition).
- * The match set will be incrementally refreshed upon updates from this scope.
- * <p>The matcher will be created within the managed {@link ViatraQueryEngine} belonging to the EMF model root, so
- * multiple matchers will reuse the same engine and benefit from increased performance and reduced memory footprint.
- * @param emfRoot the root of the EMF containment hierarchy where the pattern matcher will operate. Recommended: Resource or ResourceSet.
- * @throws ViatraQueryException if an error occurs during pattern matcher creation
- * @deprecated use {@link #on(ViatraQueryEngine)} instead, e.g. in conjunction with {@link ViatraQueryEngine#on(Notifier)}
- *
- */
- @Deprecated
- public EClassMatcher(final Notifier emfRoot) throws ViatraQueryException {
- this(ViatraQueryEngine.on(emfRoot));
- }
-
- /**
- * 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.
- * The match set will be incrementally refreshed upon updates.
- * @param engine the existing VIATRA Query engine in which this matcher will be created.
- * @throws ViatraQueryException if an error occurs during pattern matcher creation
- * @deprecated use {@link #on(ViatraQueryEngine)} instead
- *
- */
- @Deprecated
- public EClassMatcher(final ViatraQueryEngine engine) throws ViatraQueryException {
- super(engine, querySpecification());
- }
-
- /**
- * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
- * @param pEc the fixed value of pattern parameter ec, or null if not bound.
- * @return matches represented as a EClassMatch object.
- *
- */
- public Collection<EClassMatch> getAllMatches(final EClass pEc) {
- return rawGetAllMatches(new Object[]{pEc});
- }
-
- /**
- * 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 pEc the fixed value of pattern parameter ec, or null if not bound.
- * @return a match represented as a EClassMatch object, or null if no match is found.
- *
- */
- public EClassMatch getOneArbitraryMatch(final EClass pEc) {
- return rawGetOneArbitraryMatch(new Object[]{pEc});
- }
-
- /**
- * 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 pEc the fixed value of pattern parameter ec, or null if not bound.
- * @return true if the input is a valid (partial) match of the pattern.
- *
- */
- public boolean hasMatch(final EClass pEc) {
- return rawHasMatch(new Object[]{pEc});
- }
-
- /**
- * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
- * @param pEc the fixed value of pattern parameter ec, or null if not bound.
- * @return the number of pattern matches found.
- *
- */
- public int countMatches(final EClass pEc) {
- return rawCountMatches(new Object[]{pEc});
- }
-
- /**
- * Executes the given processor on each match of the pattern that conforms to the given fixed values of some parameters.
- * @param pEc the fixed value of pattern parameter ec, or null if not bound.
- * @param processor the action that will process each pattern match.
- *
- */
- public void forEachMatch(final EClass pEc, final IMatchProcessor<? super EClassMatch> processor) {
- rawForEachMatch(new Object[]{pEc}, processor);
- }
-
- /**
- * 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 pEc the fixed value of pattern parameter ec, 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 EClass pEc, final IMatchProcessor<? super EClassMatch> processor) {
- return rawForOneArbitraryMatch(new Object[]{pEc}, processor);
- }
-
- /**
- * Returns a new (partial) match.
- * This can be used e.g. to call the matcher with a partial match.
- * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
- * @param pEc the fixed value of pattern parameter ec, or null if not bound.
- * @return the (partial) match object.
- *
- */
- public EClassMatch newMatch(final EClass pEc) {
- return EClassMatch.newMatch(pEc);
- }
-
- /**
- * Retrieve the set of values that occur in matches for ec.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- protected Set<EClass> rawAccumulateAllValuesOfec(final Object[] parameters) {
- Set<EClass> results = new HashSet<EClass>();
- rawAccumulateAllValues(POSITION_EC, parameters, results);
- return results;
- }
-
- /**
- * Retrieve the set of values that occur in matches for ec.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<EClass> getAllValuesOfec() {
- return rawAccumulateAllValuesOfec(emptyArray());
- }
-
- @Override
- protected EClassMatch tupleToMatch(final Tuple t) {
- try {
- return EClassMatch.newMatch((EClass) t.get(POSITION_EC));
- } catch(ClassCastException e) {
- LOGGER.error("Element(s) in tuple not properly typed!",e);
- return null;
- }
- }
-
- @Override
- protected EClassMatch arrayToMatch(final Object[] match) {
- try {
- return EClassMatch.newMatch((EClass) match[POSITION_EC]);
- } catch(ClassCastException e) {
- LOGGER.error("Element(s) in array not properly typed!",e);
- return null;
- }
- }
-
- @Override
- protected EClassMatch arrayToMatchMutable(final Object[] match) {
- try {
- return EClassMatch.newMutableMatch((EClass) match[POSITION_EC]);
- } 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 ViatraQueryException if the pattern definition could not be loaded
- *
- */
- public static IQuerySpecification<EClassMatcher> querySpecification() throws ViatraQueryException {
- return EClassQuerySpecification.instance();
- }
-}
diff --git a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/EClassNamesKeywordMatch.java b/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/EClassNamesKeywordMatch.java
deleted file mode 100644
index 46c7eca..0000000
--- a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/EClassNamesKeywordMatch.java
+++ /dev/null
@@ -1,207 +0,0 @@
-package org.eclipse.viatra.query.application.queries;
-
-import java.util.Arrays;
-import java.util.List;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.viatra.query.application.queries.util.EClassNamesKeywordQuerySpecification;
-import org.eclipse.viatra.query.runtime.api.IPatternMatch;
-import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
-import org.eclipse.viatra.query.runtime.exception.ViatraQueryException;
-
-/**
- * Pattern-specific match representation of the org.eclipse.viatra.query.application.queries.eClassNamesKeyword pattern,
- * to be used in conjunction with {@link EClassNamesKeywordMatcher}.
- *
- * <p>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 EClassNamesKeywordMatcher
- * @see EClassNamesKeywordProcessor
- *
- */
-@SuppressWarnings("all")
-public abstract class EClassNamesKeywordMatch extends BasePatternMatch {
- private EClass fC;
-
- private String fN;
-
- private static List<String> parameterNames = makeImmutableList("c", "n");
-
- private EClassNamesKeywordMatch(final EClass pC, final String pN) {
- this.fC = pC;
- this.fN = pN;
- }
-
- @Override
- public Object get(final String parameterName) {
- if ("c".equals(parameterName)) return this.fC;
- if ("n".equals(parameterName)) return this.fN;
- return null;
- }
-
- public EClass getC() {
- return this.fC;
- }
-
- public String getN() {
- return this.fN;
- }
-
- @Override
- public boolean set(final String parameterName, final Object newValue) {
- if (!isMutable()) throw new java.lang.UnsupportedOperationException();
- if ("c".equals(parameterName) ) {
- this.fC = (EClass) newValue;
- return true;
- }
- if ("n".equals(parameterName) ) {
- this.fN = (String) newValue;
- return true;
- }
- return false;
- }
-
- public void setC(final EClass pC) {
- if (!isMutable()) throw new java.lang.UnsupportedOperationException();
- this.fC = pC;
- }
-
- public void setN(final String pN) {
- if (!isMutable()) throw new java.lang.UnsupportedOperationException();
- this.fN = pN;
- }
-
- @Override
- public String patternName() {
- return "org.eclipse.viatra.query.application.queries.eClassNamesKeyword";
- }
-
- @Override
- public List<String> parameterNames() {
- return EClassNamesKeywordMatch.parameterNames;
- }
-
- @Override
- public Object[] toArray() {
- return new Object[]{fC, fN};
- }
-
- @Override
- public EClassNamesKeywordMatch toImmutable() {
- return isMutable() ? newMatch(fC, fN) : this;
- }
-
- @Override
- public String prettyPrint() {
- StringBuilder result = new StringBuilder();
- result.append("\"c\"=" + prettyPrintValue(fC) + ", ");
-
- result.append("\"n\"=" + prettyPrintValue(fN)
- );
- return result.toString();
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((fC == null) ? 0 : fC.hashCode());
- result = prime * result + ((fN == null) ? 0 : fN.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(final Object obj) {
- if (this == obj)
- return true;
- if (!(obj instanceof EClassNamesKeywordMatch)) { // this should be infrequent
- if (obj == null) {
- return false;
- }
- if (!(obj instanceof IPatternMatch)) {
- return false;
- }
- IPatternMatch otherSig = (IPatternMatch) obj;
- if (!specification().equals(otherSig.specification()))
- return false;
- return Arrays.deepEquals(toArray(), otherSig.toArray());
- }
- EClassNamesKeywordMatch other = (EClassNamesKeywordMatch) obj;
- if (fC == null) {if (other.fC != null) return false;}
- else if (!fC.equals(other.fC)) return false;
- if (fN == null) {if (other.fN != null) return false;}
- else if (!fN.equals(other.fN)) return false;
- return true;
- }
-
- @Override
- public EClassNamesKeywordQuerySpecification specification() {
- try {
- return EClassNamesKeywordQuerySpecification.instance();
- } catch (ViatraQueryException ex) {
- // This cannot happen, as the match object can only be instantiated if the query specification exists
- throw new IllegalStateException (ex);
- }
- }
-
- /**
- * 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 EClassNamesKeywordMatch newEmptyMatch() {
- return new Mutable(null, null);
- }
-
- /**
- * Returns a mutable (partial) match.
- * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
- *
- * @param pC the fixed value of pattern parameter c, or null if not bound.
- * @param pN the fixed value of pattern parameter n, or null if not bound.
- * @return the new, mutable (partial) match object.
- *
- */
- public static EClassNamesKeywordMatch newMutableMatch(final EClass pC, final String pN) {
- return new Mutable(pC, pN);
- }
-
- /**
- * Returns a new (partial) match.
- * This can be used e.g. to call the matcher with a partial match.
- * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
- * @param pC the fixed value of pattern parameter c, or null if not bound.
- * @param pN the fixed value of pattern parameter n, or null if not bound.
- * @return the (partial) match object.
- *
- */
- public static EClassNamesKeywordMatch newMatch(final EClass pC, final String pN) {
- return new Immutable(pC, pN);
- }
-
- private static final class Mutable extends EClassNamesKeywordMatch {
- Mutable(final EClass pC, final String pN) {
- super(pC, pN);
- }
-
- @Override
- public boolean isMutable() {
- return true;
- }
- }
-
- private static final class Immutable extends EClassNamesKeywordMatch {
- Immutable(final EClass pC, final String pN) {
- super(pC, pN);
- }
-
- @Override
- public boolean isMutable() {
- return false;
- }
- }
-}
diff --git a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/EClassNamesKeywordMatcher.java b/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/EClassNamesKeywordMatcher.java
deleted file mode 100644
index 35b9134..0000000
--- a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/EClassNamesKeywordMatcher.java
+++ /dev/null
@@ -1,302 +0,0 @@
-package org.eclipse.viatra.query.application.queries;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-import org.apache.log4j.Logger;
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.viatra.query.application.queries.EClassNamesKeywordMatch;
-import org.eclipse.viatra.query.application.queries.util.EClassNamesKeywordQuerySpecification;
-import org.eclipse.viatra.query.runtime.api.IMatchProcessor;
-import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
-import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
-import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
-import org.eclipse.viatra.query.runtime.exception.ViatraQueryException;
-import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
-import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
-
-/**
- * Generated pattern matcher API of the org.eclipse.viatra.query.application.queries.eClassNamesKeyword pattern,
- * providing pattern-specific query methods.
- *
- * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
- * e.g. in conjunction with {@link ViatraQueryEngine#on(Notifier)}.
- *
- * <p>Matches of the pattern will be represented as {@link EClassNamesKeywordMatch}.
- *
- * <p>Original source:
- * <code><pre>
- * pattern eClassNamesKeyword(c: EClass, n: EString)
- * {
- * EClass.name(c,n);
- * check("A" == n);
- * }
- * </pre></code>
- *
- * @see EClassNamesKeywordMatch
- * @see EClassNamesKeywordProcessor
- * @see EClassNamesKeywordQuerySpecification
- *
- */
-@SuppressWarnings("all")
-public class EClassNamesKeywordMatcher extends BaseMatcher<EClassNamesKeywordMatch> {
- /**
- * 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.
- * The match set will be incrementally refreshed upon updates.
- * @param engine the existing VIATRA Query engine in which this matcher will be created.
- * @throws ViatraQueryException if an error occurs during pattern matcher creation
- *
- */
- public static EClassNamesKeywordMatcher on(final ViatraQueryEngine engine) throws ViatraQueryException {
- // check if matcher already exists
- EClassNamesKeywordMatcher matcher = engine.getExistingMatcher(querySpecification());
- if (matcher == null) {
- matcher = new EClassNamesKeywordMatcher(engine);
- // do not have to "put" it into engine.matchers, reportMatcherInitialized() will take care of it
- }
- return matcher;
- }
-
- private final static int POSITION_C = 0;
-
- private final static int POSITION_N = 1;
-
- private final static Logger LOGGER = ViatraQueryLoggingUtil.getLogger(EClassNamesKeywordMatcher.class);
-
- /**
- * Initializes the pattern matcher over a given EMF model root (recommended: Resource or ResourceSet).
- * If a pattern matcher is already constructed with the same root, only a light-weight reference is returned.
- * The scope of pattern matching will be the given EMF model root and below (see FAQ for more precise definition).
- * The match set will be incrementally refreshed upon updates from this scope.
- * <p>The matcher will be created within the managed {@link ViatraQueryEngine} belonging to the EMF model root, so
- * multiple matchers will reuse the same engine and benefit from increased performance and reduced memory footprint.
- * @param emfRoot the root of the EMF containment hierarchy where the pattern matcher will operate. Recommended: Resource or ResourceSet.
- * @throws ViatraQueryException if an error occurs during pattern matcher creation
- * @deprecated use {@link #on(ViatraQueryEngine)} instead, e.g. in conjunction with {@link ViatraQueryEngine#on(Notifier)}
- *
- */
- @Deprecated
- public EClassNamesKeywordMatcher(final Notifier emfRoot) throws ViatraQueryException {
- this(ViatraQueryEngine.on(emfRoot));
- }
-
- /**
- * 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.
- * The match set will be incrementally refreshed upon updates.
- * @param engine the existing VIATRA Query engine in which this matcher will be created.
- * @throws ViatraQueryException if an error occurs during pattern matcher creation
- * @deprecated use {@link #on(ViatraQueryEngine)} instead
- *
- */
- @Deprecated
- public EClassNamesKeywordMatcher(final ViatraQueryEngine engine) throws ViatraQueryException {
- super(engine, querySpecification());
- }
-
- /**
- * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
- * @param pC the fixed value of pattern parameter c, or null if not bound.
- * @param pN the fixed value of pattern parameter n, or null if not bound.
- * @return matches represented as a EClassNamesKeywordMatch object.
- *
- */
- public Collection<EClassNamesKeywordMatch> getAllMatches(final EClass pC, final String pN) {
- return rawGetAllMatches(new Object[]{pC, pN});
- }
-
- /**
- * 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 pC the fixed value of pattern parameter c, or null if not bound.
- * @param pN the fixed value of pattern parameter n, or null if not bound.
- * @return a match represented as a EClassNamesKeywordMatch object, or null if no match is found.
- *
- */
- public EClassNamesKeywordMatch getOneArbitraryMatch(final EClass pC, final String pN) {
- return rawGetOneArbitraryMatch(new Object[]{pC, pN});
- }
-
- /**
- * 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 pC the fixed value of pattern parameter c, or null if not bound.
- * @param pN the fixed value of pattern parameter n, or null if not bound.
- * @return true if the input is a valid (partial) match of the pattern.
- *
- */
- public boolean hasMatch(final EClass pC, final String pN) {
- return rawHasMatch(new Object[]{pC, pN});
- }
-
- /**
- * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
- * @param pC the fixed value of pattern parameter c, or null if not bound.
- * @param pN the fixed value of pattern parameter n, or null if not bound.
- * @return the number of pattern matches found.
- *
- */
- public int countMatches(final EClass pC, final String pN) {
- return rawCountMatches(new Object[]{pC, pN});
- }
-
- /**
- * Executes the given processor on each match of the pattern that conforms to the given fixed values of some parameters.
- * @param pC the fixed value of pattern parameter c, or null if not bound.
- * @param pN the fixed value of pattern parameter n, or null if not bound.
- * @param processor the action that will process each pattern match.
- *
- */
- public void forEachMatch(final EClass pC, final String pN, final IMatchProcessor<? super EClassNamesKeywordMatch> processor) {
- rawForEachMatch(new Object[]{pC, pN}, processor);
- }
-
- /**
- * 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 pC the fixed value of pattern parameter c, or null if not bound.
- * @param pN the fixed value of pattern parameter n, 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 EClass pC, final String pN, final IMatchProcessor<? super EClassNamesKeywordMatch> processor) {
- return rawForOneArbitraryMatch(new Object[]{pC, pN}, processor);
- }
-
- /**
- * Returns a new (partial) match.
- * This can be used e.g. to call the matcher with a partial match.
- * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
- * @param pC the fixed value of pattern parameter c, or null if not bound.
- * @param pN the fixed value of pattern parameter n, or null if not bound.
- * @return the (partial) match object.
- *
- */
- public EClassNamesKeywordMatch newMatch(final EClass pC, final String pN) {
- return EClassNamesKeywordMatch.newMatch(pC, pN);
- }
-
- /**
- * Retrieve the set of values that occur in matches for c.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- protected Set<EClass> rawAccumulateAllValuesOfc(final Object[] parameters) {
- Set<EClass> results = new HashSet<EClass>();
- rawAccumulateAllValues(POSITION_C, parameters, results);
- return results;
- }
-
- /**
- * Retrieve the set of values that occur in matches for c.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<EClass> getAllValuesOfc() {
- return rawAccumulateAllValuesOfc(emptyArray());
- }
-
- /**
- * Retrieve the set of values that occur in matches for c.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<EClass> getAllValuesOfc(final EClassNamesKeywordMatch partialMatch) {
- return rawAccumulateAllValuesOfc(partialMatch.toArray());
- }
-
- /**
- * Retrieve the set of values that occur in matches for c.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<EClass> getAllValuesOfc(final String pN) {
- return rawAccumulateAllValuesOfc(new Object[]{
- null,
- pN
- });
- }
-
- /**
- * Retrieve the set of values that occur in matches for n.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- protected Set<String> rawAccumulateAllValuesOfn(final Object[] parameters) {
- Set<String> results = new HashSet<String>();
- rawAccumulateAllValues(POSITION_N, parameters, results);
- return results;
- }
-
- /**
- * Retrieve the set of values that occur in matches for n.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<String> getAllValuesOfn() {
- return rawAccumulateAllValuesOfn(emptyArray());
- }
-
- /**
- * Retrieve the set of values that occur in matches for n.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<String> getAllValuesOfn(final EClassNamesKeywordMatch partialMatch) {
- return rawAccumulateAllValuesOfn(partialMatch.toArray());
- }
-
- /**
- * Retrieve the set of values that occur in matches for n.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<String> getAllValuesOfn(final EClass pC) {
- return rawAccumulateAllValuesOfn(new Object[]{
- pC,
- null
- });
- }
-
- @Override
- protected EClassNamesKeywordMatch tupleToMatch(final Tuple t) {
- try {
- return EClassNamesKeywordMatch.newMatch((EClass) t.get(POSITION_C), (String) t.get(POSITION_N));
- } catch(ClassCastException e) {
- LOGGER.error("Element(s) in tuple not properly typed!",e);
- return null;
- }
- }
-
- @Override
- protected EClassNamesKeywordMatch arrayToMatch(final Object[] match) {
- try {
- return EClassNamesKeywordMatch.newMatch((EClass) match[POSITION_C], (String) match[POSITION_N]);
- } catch(ClassCastException e) {
- LOGGER.error("Element(s) in array not properly typed!",e);
- return null;
- }
- }
-
- @Override
- protected EClassNamesKeywordMatch arrayToMatchMutable(final Object[] match) {
- try {
- return EClassNamesKeywordMatch.newMutableMatch((EClass) match[POSITION_C], (String) match[POSITION_N]);
- } 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 ViatraQueryException if the pattern definition could not be loaded
- *
- */
- public static IQuerySpecification<EClassNamesKeywordMatcher> querySpecification() throws ViatraQueryException {
- return EClassNamesKeywordQuerySpecification.instance();
- }
-}
diff --git a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/EClassNamesMatch.java b/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/EClassNamesMatch.java
deleted file mode 100644
index bf7d57e..0000000
--- a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/EClassNamesMatch.java
+++ /dev/null
@@ -1,207 +0,0 @@
-package org.eclipse.viatra.query.application.queries;
-
-import java.util.Arrays;
-import java.util.List;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.viatra.query.application.queries.util.EClassNamesQuerySpecification;
-import org.eclipse.viatra.query.runtime.api.IPatternMatch;
-import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
-import org.eclipse.viatra.query.runtime.exception.ViatraQueryException;
-
-/**
- * Pattern-specific match representation of the org.eclipse.viatra.query.application.queries.eClassNames pattern,
- * to be used in conjunction with {@link EClassNamesMatcher}.
- *
- * <p>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 EClassNamesMatcher
- * @see EClassNamesProcessor
- *
- */
-@SuppressWarnings("all")
-public abstract class EClassNamesMatch extends BasePatternMatch {
- private EClass fC;
-
- private String fN;
-
- private static List<String> parameterNames = makeImmutableList("c", "n");
-
- private EClassNamesMatch(final EClass pC, final String pN) {
- this.fC = pC;
- this.fN = pN;
- }
-
- @Override
- public Object get(final String parameterName) {
- if ("c".equals(parameterName)) return this.fC;
- if ("n".equals(parameterName)) return this.fN;
- return null;
- }
-
- public EClass getC() {
- return this.fC;
- }
-
- public String getN() {
- return this.fN;
- }
-
- @Override
- public boolean set(final String parameterName, final Object newValue) {
- if (!isMutable()) throw new java.lang.UnsupportedOperationException();
- if ("c".equals(parameterName) ) {
- this.fC = (EClass) newValue;
- return true;
- }
- if ("n".equals(parameterName) ) {
- this.fN = (String) newValue;
- return true;
- }
- return false;
- }
-
- public void setC(final EClass pC) {
- if (!isMutable()) throw new java.lang.UnsupportedOperationException();
- this.fC = pC;
- }
-
- public void setN(final String pN) {
- if (!isMutable()) throw new java.lang.UnsupportedOperationException();
- this.fN = pN;
- }
-
- @Override
- public String patternName() {
- return "org.eclipse.viatra.query.application.queries.eClassNames";
- }
-
- @Override
- public List<String> parameterNames() {
- return EClassNamesMatch.parameterNames;
- }
-
- @Override
- public Object[] toArray() {
- return new Object[]{fC, fN};
- }
-
- @Override
- public EClassNamesMatch toImmutable() {
- return isMutable() ? newMatch(fC, fN) : this;
- }
-
- @Override
- public String prettyPrint() {
- StringBuilder result = new StringBuilder();
- result.append("\"c\"=" + prettyPrintValue(fC) + ", ");
-
- result.append("\"n\"=" + prettyPrintValue(fN)
- );
- return result.toString();
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((fC == null) ? 0 : fC.hashCode());
- result = prime * result + ((fN == null) ? 0 : fN.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(final Object obj) {
- if (this == obj)
- return true;
- if (!(obj instanceof EClassNamesMatch)) { // this should be infrequent
- if (obj == null) {
- return false;
- }
- if (!(obj instanceof IPatternMatch)) {
- return false;
- }
- IPatternMatch otherSig = (IPatternMatch) obj;
- if (!specification().equals(otherSig.specification()))
- return false;
- return Arrays.deepEquals(toArray(), otherSig.toArray());
- }
- EClassNamesMatch other = (EClassNamesMatch) obj;
- if (fC == null) {if (other.fC != null) return false;}
- else if (!fC.equals(other.fC)) return false;
- if (fN == null) {if (other.fN != null) return false;}
- else if (!fN.equals(other.fN)) return false;
- return true;
- }
-
- @Override
- public EClassNamesQuerySpecification specification() {
- try {
- return EClassNamesQuerySpecification.instance();
- } catch (ViatraQueryException ex) {
- // This cannot happen, as the match object can only be instantiated if the query specification exists
- throw new IllegalStateException (ex);
- }
- }
-
- /**
- * 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 EClassNamesMatch newEmptyMatch() {
- return new Mutable(null, null);
- }
-
- /**
- * Returns a mutable (partial) match.
- * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
- *
- * @param pC the fixed value of pattern parameter c, or null if not bound.
- * @param pN the fixed value of pattern parameter n, or null if not bound.
- * @return the new, mutable (partial) match object.
- *
- */
- public static EClassNamesMatch newMutableMatch(final EClass pC, final String pN) {
- return new Mutable(pC, pN);
- }
-
- /**
- * Returns a new (partial) match.
- * This can be used e.g. to call the matcher with a partial match.
- * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
- * @param pC the fixed value of pattern parameter c, or null if not bound.
- * @param pN the fixed value of pattern parameter n, or null if not bound.
- * @return the (partial) match object.
- *
- */
- public static EClassNamesMatch newMatch(final EClass pC, final String pN) {
- return new Immutable(pC, pN);
- }
-
- private static final class Mutable extends EClassNamesMatch {
- Mutable(final EClass pC, final String pN) {
- super(pC, pN);
- }
-
- @Override
- public boolean isMutable() {
- return true;
- }
- }
-
- private static final class Immutable extends EClassNamesMatch {
- Immutable(final EClass pC, final String pN) {
- super(pC, pN);
- }
-
- @Override
- public boolean isMutable() {
- return false;
- }
- }
-}
diff --git a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/EClassNamesMatcher.java b/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/EClassNamesMatcher.java
deleted file mode 100644
index 017f46d..0000000
--- a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/EClassNamesMatcher.java
+++ /dev/null
@@ -1,300 +0,0 @@
-package org.eclipse.viatra.query.application.queries;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-import org.apache.log4j.Logger;
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.viatra.query.application.queries.EClassNamesMatch;
-import org.eclipse.viatra.query.application.queries.util.EClassNamesQuerySpecification;
-import org.eclipse.viatra.query.runtime.api.IMatchProcessor;
-import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
-import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
-import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
-import org.eclipse.viatra.query.runtime.exception.ViatraQueryException;
-import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
-import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
-
-/**
- * Generated pattern matcher API of the org.eclipse.viatra.query.application.queries.eClassNames pattern,
- * providing pattern-specific query methods.
- *
- * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
- * e.g. in conjunction with {@link ViatraQueryEngine#on(Notifier)}.
- *
- * <p>Matches of the pattern will be represented as {@link EClassNamesMatch}.
- *
- * <p>Original source:
- * <code><pre>
- * pattern eClassNames(c: EClass, n : EString)= {
- * EClass.name(c,n);
- * }
- * </pre></code>
- *
- * @see EClassNamesMatch
- * @see EClassNamesProcessor
- * @see EClassNamesQuerySpecification
- *
- */
-@SuppressWarnings("all")
-public class EClassNamesMatcher extends BaseMatcher<EClassNamesMatch> {
- /**
- * 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.
- * The match set will be incrementally refreshed upon updates.
- * @param engine the existing VIATRA Query engine in which this matcher will be created.
- * @throws ViatraQueryException if an error occurs during pattern matcher creation
- *
- */
- public static EClassNamesMatcher on(final ViatraQueryEngine engine) throws ViatraQueryException {
- // check if matcher already exists
- EClassNamesMatcher matcher = engine.getExistingMatcher(querySpecification());
- if (matcher == null) {
- matcher = new EClassNamesMatcher(engine);
- // do not have to "put" it into engine.matchers, reportMatcherInitialized() will take care of it
- }
- return matcher;
- }
-
- private final static int POSITION_C = 0;
-
- private final static int POSITION_N = 1;
-
- private final static Logger LOGGER = ViatraQueryLoggingUtil.getLogger(EClassNamesMatcher.class);
-
- /**
- * Initializes the pattern matcher over a given EMF model root (recommended: Resource or ResourceSet).
- * If a pattern matcher is already constructed with the same root, only a light-weight reference is returned.
- * The scope of pattern matching will be the given EMF model root and below (see FAQ for more precise definition).
- * The match set will be incrementally refreshed upon updates from this scope.
- * <p>The matcher will be created within the managed {@link ViatraQueryEngine} belonging to the EMF model root, so
- * multiple matchers will reuse the same engine and benefit from increased performance and reduced memory footprint.
- * @param emfRoot the root of the EMF containment hierarchy where the pattern matcher will operate. Recommended: Resource or ResourceSet.
- * @throws ViatraQueryException if an error occurs during pattern matcher creation
- * @deprecated use {@link #on(ViatraQueryEngine)} instead, e.g. in conjunction with {@link ViatraQueryEngine#on(Notifier)}
- *
- */
- @Deprecated
- public EClassNamesMatcher(final Notifier emfRoot) throws ViatraQueryException {
- this(ViatraQueryEngine.on(emfRoot));
- }
-
- /**
- * 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.
- * The match set will be incrementally refreshed upon updates.
- * @param engine the existing VIATRA Query engine in which this matcher will be created.
- * @throws ViatraQueryException if an error occurs during pattern matcher creation
- * @deprecated use {@link #on(ViatraQueryEngine)} instead
- *
- */
- @Deprecated
- public EClassNamesMatcher(final ViatraQueryEngine engine) throws ViatraQueryException {
- super(engine, querySpecification());
- }
-
- /**
- * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
- * @param pC the fixed value of pattern parameter c, or null if not bound.
- * @param pN the fixed value of pattern parameter n, or null if not bound.
- * @return matches represented as a EClassNamesMatch object.
- *
- */
- public Collection<EClassNamesMatch> getAllMatches(final EClass pC, final String pN) {
- return rawGetAllMatches(new Object[]{pC, pN});
- }
-
- /**
- * 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 pC the fixed value of pattern parameter c, or null if not bound.
- * @param pN the fixed value of pattern parameter n, or null if not bound.
- * @return a match represented as a EClassNamesMatch object, or null if no match is found.
- *
- */
- public EClassNamesMatch getOneArbitraryMatch(final EClass pC, final String pN) {
- return rawGetOneArbitraryMatch(new Object[]{pC, pN});
- }
-
- /**
- * 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 pC the fixed value of pattern parameter c, or null if not bound.
- * @param pN the fixed value of pattern parameter n, or null if not bound.
- * @return true if the input is a valid (partial) match of the pattern.
- *
- */
- public boolean hasMatch(final EClass pC, final String pN) {
- return rawHasMatch(new Object[]{pC, pN});
- }
-
- /**
- * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
- * @param pC the fixed value of pattern parameter c, or null if not bound.
- * @param pN the fixed value of pattern parameter n, or null if not bound.
- * @return the number of pattern matches found.
- *
- */
- public int countMatches(final EClass pC, final String pN) {
- return rawCountMatches(new Object[]{pC, pN});
- }
-
- /**
- * Executes the given processor on each match of the pattern that conforms to the given fixed values of some parameters.
- * @param pC the fixed value of pattern parameter c, or null if not bound.
- * @param pN the fixed value of pattern parameter n, or null if not bound.
- * @param processor the action that will process each pattern match.
- *
- */
- public void forEachMatch(final EClass pC, final String pN, final IMatchProcessor<? super EClassNamesMatch> processor) {
- rawForEachMatch(new Object[]{pC, pN}, processor);
- }
-
- /**
- * 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 pC the fixed value of pattern parameter c, or null if not bound.
- * @param pN the fixed value of pattern parameter n, 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 EClass pC, final String pN, final IMatchProcessor<? super EClassNamesMatch> processor) {
- return rawForOneArbitraryMatch(new Object[]{pC, pN}, processor);
- }
-
- /**
- * Returns a new (partial) match.
- * This can be used e.g. to call the matcher with a partial match.
- * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
- * @param pC the fixed value of pattern parameter c, or null if not bound.
- * @param pN the fixed value of pattern parameter n, or null if not bound.
- * @return the (partial) match object.
- *
- */
- public EClassNamesMatch newMatch(final EClass pC, final String pN) {
- return EClassNamesMatch.newMatch(pC, pN);
- }
-
- /**
- * Retrieve the set of values that occur in matches for c.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- protected Set<EClass> rawAccumulateAllValuesOfc(final Object[] parameters) {
- Set<EClass> results = new HashSet<EClass>();
- rawAccumulateAllValues(POSITION_C, parameters, results);
- return results;
- }
-
- /**
- * Retrieve the set of values that occur in matches for c.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<EClass> getAllValuesOfc() {
- return rawAccumulateAllValuesOfc(emptyArray());
- }
-
- /**
- * Retrieve the set of values that occur in matches for c.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<EClass> getAllValuesOfc(final EClassNamesMatch partialMatch) {
- return rawAccumulateAllValuesOfc(partialMatch.toArray());
- }
-
- /**
- * Retrieve the set of values that occur in matches for c.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<EClass> getAllValuesOfc(final String pN) {
- return rawAccumulateAllValuesOfc(new Object[]{
- null,
- pN
- });
- }
-
- /**
- * Retrieve the set of values that occur in matches for n.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- protected Set<String> rawAccumulateAllValuesOfn(final Object[] parameters) {
- Set<String> results = new HashSet<String>();
- rawAccumulateAllValues(POSITION_N, parameters, results);
- return results;
- }
-
- /**
- * Retrieve the set of values that occur in matches for n.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<String> getAllValuesOfn() {
- return rawAccumulateAllValuesOfn(emptyArray());
- }
-
- /**
- * Retrieve the set of values that occur in matches for n.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<String> getAllValuesOfn(final EClassNamesMatch partialMatch) {
- return rawAccumulateAllValuesOfn(partialMatch.toArray());
- }
-
- /**
- * Retrieve the set of values that occur in matches for n.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<String> getAllValuesOfn(final EClass pC) {
- return rawAccumulateAllValuesOfn(new Object[]{
- pC,
- null
- });
- }
-
- @Override
- protected EClassNamesMatch tupleToMatch(final Tuple t) {
- try {
- return EClassNamesMatch.newMatch((EClass) t.get(POSITION_C), (String) t.get(POSITION_N));
- } catch(ClassCastException e) {
- LOGGER.error("Element(s) in tuple not properly typed!",e);
- return null;
- }
- }
-
- @Override
- protected EClassNamesMatch arrayToMatch(final Object[] match) {
- try {
- return EClassNamesMatch.newMatch((EClass) match[POSITION_C], (String) match[POSITION_N]);
- } catch(ClassCastException e) {
- LOGGER.error("Element(s) in array not properly typed!",e);
- return null;
- }
- }
-
- @Override
- protected EClassNamesMatch arrayToMatchMutable(final Object[] match) {
- try {
- return EClassNamesMatch.newMutableMatch((EClass) match[POSITION_C], (String) match[POSITION_N]);
- } 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 ViatraQueryException if the pattern definition could not be loaded
- *
- */
- public static IQuerySpecification<EClassNamesMatcher> querySpecification() throws ViatraQueryException {
- return EClassNamesQuerySpecification.instance();
- }
-}
diff --git a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/EObjectMatch.java b/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/EObjectMatch.java
deleted file mode 100644
index 15cea1c..0000000
--- a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/EObjectMatch.java
+++ /dev/null
@@ -1,183 +0,0 @@
-package org.eclipse.viatra.query.application.queries;
-
-import java.util.Arrays;
-import java.util.List;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.viatra.query.application.queries.util.EObjectQuerySpecification;
-import org.eclipse.viatra.query.runtime.api.IPatternMatch;
-import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
-import org.eclipse.viatra.query.runtime.exception.ViatraQueryException;
-
-/**
- * Pattern-specific match representation of the org.eclipse.viatra.query.application.queries.eObject pattern,
- * to be used in conjunction with {@link EObjectMatcher}.
- *
- * <p>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 EObjectMatcher
- * @see EObjectProcessor
- *
- */
-@SuppressWarnings("all")
-public abstract class EObjectMatch extends BasePatternMatch {
- private EObject fO;
-
- private static List<String> parameterNames = makeImmutableList("o");
-
- private EObjectMatch(final EObject pO) {
- this.fO = pO;
- }
-
- @Override
- public Object get(final String parameterName) {
- if ("o".equals(parameterName)) return this.fO;
- return null;
- }
-
- public EObject getO() {
- return this.fO;
- }
-
- @Override
- public boolean set(final String parameterName, final Object newValue) {
- if (!isMutable()) throw new java.lang.UnsupportedOperationException();
- if ("o".equals(parameterName) ) {
- this.fO = (EObject) newValue;
- return true;
- }
- return false;
- }
-
- public void setO(final EObject pO) {
- if (!isMutable()) throw new java.lang.UnsupportedOperationException();
- this.fO = pO;
- }
-
- @Override
- public String patternName() {
- return "org.eclipse.viatra.query.application.queries.eObject";
- }
-
- @Override
- public List<String> parameterNames() {
- return EObjectMatch.parameterNames;
- }
-
- @Override
- public Object[] toArray() {
- return new Object[]{fO};
- }
-
- @Override
- public EObjectMatch toImmutable() {
- return isMutable() ? newMatch(fO) : this;
- }
-
- @Override
- public String prettyPrint() {
- StringBuilder result = new StringBuilder();
- result.append("\"o\"=" + prettyPrintValue(fO)
- );
- return result.toString();
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((fO == null) ? 0 : fO.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(final Object obj) {
- if (this == obj)
- return true;
- if (!(obj instanceof EObjectMatch)) { // this should be infrequent
- if (obj == null) {
- return false;
- }
- if (!(obj instanceof IPatternMatch)) {
- return false;
- }
- IPatternMatch otherSig = (IPatternMatch) obj;
- if (!specification().equals(otherSig.specification()))
- return false;
- return Arrays.deepEquals(toArray(), otherSig.toArray());
- }
- EObjectMatch other = (EObjectMatch) obj;
- if (fO == null) {if (other.fO != null) return false;}
- else if (!fO.equals(other.fO)) return false;
- return true;
- }
-
- @Override
- public EObjectQuerySpecification specification() {
- try {
- return EObjectQuerySpecification.instance();
- } catch (ViatraQueryException ex) {
- // This cannot happen, as the match object can only be instantiated if the query specification exists
- throw new IllegalStateException (ex);
- }
- }
-
- /**
- * 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 EObjectMatch 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 pO the fixed value of pattern parameter o, or null if not bound.
- * @return the new, mutable (partial) match object.
- *
- */
- public static EObjectMatch newMutableMatch(final EObject pO) {
- return new Mutable(pO);
- }
-
- /**
- * Returns a new (partial) match.
- * This can be used e.g. to call the matcher with a partial match.
- * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
- * @param pO the fixed value of pattern parameter o, or null if not bound.
- * @return the (partial) match object.
- *
- */
- public static EObjectMatch newMatch(final EObject pO) {
- return new Immutable(pO);
- }
-
- private static final class Mutable extends EObjectMatch {
- Mutable(final EObject pO) {
- super(pO);
- }
-
- @Override
- public boolean isMutable() {
- return true;
- }
- }
-
- private static final class Immutable extends EObjectMatch {
- Immutable(final EObject pO) {
- super(pO);
- }
-
- @Override
- public boolean isMutable() {
- return false;
- }
- }
-}
diff --git a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/EObjectMatcher.java b/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/EObjectMatcher.java
deleted file mode 100644
index c751405..0000000
--- a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/EObjectMatcher.java
+++ /dev/null
@@ -1,229 +0,0 @@
-package org.eclipse.viatra.query.application.queries;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-import org.apache.log4j.Logger;
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.viatra.query.application.queries.EObjectMatch;
-import org.eclipse.viatra.query.application.queries.util.EObjectQuerySpecification;
-import org.eclipse.viatra.query.runtime.api.IMatchProcessor;
-import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
-import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
-import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
-import org.eclipse.viatra.query.runtime.exception.ViatraQueryException;
-import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
-import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
-
-/**
- * Generated pattern matcher API of the org.eclipse.viatra.query.application.queries.eObject pattern,
- * providing pattern-specific query methods.
- *
- * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
- * e.g. in conjunction with {@link ViatraQueryEngine#on(Notifier)}.
- *
- * <p>Matches of the pattern will be represented as {@link EObjectMatch}.
- *
- * <p>Original source:
- * <code><pre>
- * pattern eObject(o) {
- * EObject(o);
- * }
- * </pre></code>
- *
- * @see EObjectMatch
- * @see EObjectProcessor
- * @see EObjectQuerySpecification
- *
- */
-@SuppressWarnings("all")
-public class EObjectMatcher extends BaseMatcher<EObjectMatch> {
- /**
- * 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.
- * The match set will be incrementally refreshed upon updates.
- * @param engine the existing VIATRA Query engine in which this matcher will be created.
- * @throws ViatraQueryException if an error occurs during pattern matcher creation
- *
- */
- public static EObjectMatcher on(final ViatraQueryEngine engine) throws ViatraQueryException {
- // check if matcher already exists
- EObjectMatcher matcher = engine.getExistingMatcher(querySpecification());
- if (matcher == null) {
- matcher = new EObjectMatcher(engine);
- // do not have to "put" it into engine.matchers, reportMatcherInitialized() will take care of it
- }
- return matcher;
- }
-
- private final static int POSITION_O = 0;
-
- private final static Logger LOGGER = ViatraQueryLoggingUtil.getLogger(EObjectMatcher.class);
-
- /**
- * Initializes the pattern matcher over a given EMF model root (recommended: Resource or ResourceSet).
- * If a pattern matcher is already constructed with the same root, only a light-weight reference is returned.
- * The scope of pattern matching will be the given EMF model root and below (see FAQ for more precise definition).
- * The match set will be incrementally refreshed upon updates from this scope.
- * <p>The matcher will be created within the managed {@link ViatraQueryEngine} belonging to the EMF model root, so
- * multiple matchers will reuse the same engine and benefit from increased performance and reduced memory footprint.
- * @param emfRoot the root of the EMF containment hierarchy where the pattern matcher will operate. Recommended: Resource or ResourceSet.
- * @throws ViatraQueryException if an error occurs during pattern matcher creation
- * @deprecated use {@link #on(ViatraQueryEngine)} instead, e.g. in conjunction with {@link ViatraQueryEngine#on(Notifier)}
- *
- */
- @Deprecated
- public EObjectMatcher(final Notifier emfRoot) throws ViatraQueryException {
- this(ViatraQueryEngine.on(emfRoot));
- }
-
- /**
- * 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.
- * The match set will be incrementally refreshed upon updates.
- * @param engine the existing VIATRA Query engine in which this matcher will be created.
- * @throws ViatraQueryException if an error occurs during pattern matcher creation
- * @deprecated use {@link #on(ViatraQueryEngine)} instead
- *
- */
- @Deprecated
- public EObjectMatcher(final ViatraQueryEngine engine) throws ViatraQueryException {
- super(engine, querySpecification());
- }
-
- /**
- * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
- * @param pO the fixed value of pattern parameter o, or null if not bound.
- * @return matches represented as a EObjectMatch object.
- *
- */
- public Collection<EObjectMatch> getAllMatches(final EObject pO) {
- return rawGetAllMatches(new Object[]{pO});
- }
-
- /**
- * 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 pO the fixed value of pattern parameter o, or null if not bound.
- * @return a match represented as a EObjectMatch object, or null if no match is found.
- *
- */
- public EObjectMatch getOneArbitraryMatch(final EObject pO) {
- return rawGetOneArbitraryMatch(new Object[]{pO});
- }
-
- /**
- * 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 pO the fixed value of pattern parameter o, or null if not bound.
- * @return true if the input is a valid (partial) match of the pattern.
- *
- */
- public boolean hasMatch(final EObject pO) {
- return rawHasMatch(new Object[]{pO});
- }
-
- /**
- * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
- * @param pO the fixed value of pattern parameter o, or null if not bound.
- * @return the number of pattern matches found.
- *
- */
- public int countMatches(final EObject pO) {
- return rawCountMatches(new Object[]{pO});
- }
-
- /**
- * Executes the given processor on each match of the pattern that conforms to the given fixed values of some parameters.
- * @param pO the fixed value of pattern parameter o, or null if not bound.
- * @param processor the action that will process each pattern match.
- *
- */
- public void forEachMatch(final EObject pO, final IMatchProcessor<? super EObjectMatch> processor) {
- rawForEachMatch(new Object[]{pO}, processor);
- }
-
- /**
- * 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 pO the fixed value of pattern parameter o, 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 EObject pO, final IMatchProcessor<? super EObjectMatch> processor) {
- return rawForOneArbitraryMatch(new Object[]{pO}, processor);
- }
-
- /**
- * Returns a new (partial) match.
- * This can be used e.g. to call the matcher with a partial match.
- * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
- * @param pO the fixed value of pattern parameter o, or null if not bound.
- * @return the (partial) match object.
- *
- */
- public EObjectMatch newMatch(final EObject pO) {
- return EObjectMatch.newMatch(pO);
- }
-
- /**
- * Retrieve the set of values that occur in matches for o.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- protected Set<EObject> rawAccumulateAllValuesOfo(final Object[] parameters) {
- Set<EObject> results = new HashSet<EObject>();
- rawAccumulateAllValues(POSITION_O, parameters, results);
- return results;
- }
-
- /**
- * Retrieve the set of values that occur in matches for o.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<EObject> getAllValuesOfo() {
- return rawAccumulateAllValuesOfo(emptyArray());
- }
-
- @Override
- protected EObjectMatch tupleToMatch(final Tuple t) {
- try {
- return EObjectMatch.newMatch((EObject) t.get(POSITION_O));
- } catch(ClassCastException e) {
- LOGGER.error("Element(s) in tuple not properly typed!",e);
- return null;
- }
- }
-
- @Override
- protected EObjectMatch arrayToMatch(final Object[] match) {
- try {
- return EObjectMatch.newMatch((EObject) match[POSITION_O]);
- } catch(ClassCastException e) {
- LOGGER.error("Element(s) in array not properly typed!",e);
- return null;
- }
- }
-
- @Override
- protected EObjectMatch arrayToMatchMutable(final Object[] match) {
- try {
- return EObjectMatch.newMutableMatch((EObject) match[POSITION_O]);
- } 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 ViatraQueryException if the pattern definition could not be loaded
- *
- */
- public static IQuerySpecification<EObjectMatcher> querySpecification() throws ViatraQueryException {
- return EObjectQuerySpecification.instance();
- }
-}
diff --git a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/EPackageMatch.java b/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/EPackageMatch.java
deleted file mode 100644
index 385e1cd..0000000
--- a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/EPackageMatch.java
+++ /dev/null
@@ -1,183 +0,0 @@
-package org.eclipse.viatra.query.application.queries;
-
-import java.util.Arrays;
-import java.util.List;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.viatra.query.application.queries.util.EPackageQuerySpecification;
-import org.eclipse.viatra.query.runtime.api.IPatternMatch;
-import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
-import org.eclipse.viatra.query.runtime.exception.ViatraQueryException;
-
-/**
- * Pattern-specific match representation of the org.eclipse.viatra.query.application.queries.ePackage pattern,
- * to be used in conjunction with {@link EPackageMatcher}.
- *
- * <p>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 EPackageMatcher
- * @see EPackageProcessor
- *
- */
-@SuppressWarnings("all")
-public abstract class EPackageMatch extends BasePatternMatch {
- private EPackage fP;
-
- private static List<String> parameterNames = makeImmutableList("p");
-
- private EPackageMatch(final EPackage pP) {
- this.fP = pP;
- }
-
- @Override
- public Object get(final String parameterName) {
- if ("p".equals(parameterName)) return this.fP;
- return null;
- }
-
- public EPackage getP() {
- return this.fP;
- }
-
- @Override
- public boolean set(final String parameterName, final Object newValue) {
- if (!isMutable()) throw new java.lang.UnsupportedOperationException();
- if ("p".equals(parameterName) ) {
- this.fP = (EPackage) newValue;
- return true;
- }
- return false;
- }
-
- public void setP(final EPackage pP) {
- if (!isMutable()) throw new java.lang.UnsupportedOperationException();
- this.fP = pP;
- }
-
- @Override
- public String patternName() {
- return "org.eclipse.viatra.query.application.queries.ePackage";
- }
-
- @Override
- public List<String> parameterNames() {
- return EPackageMatch.parameterNames;
- }
-
- @Override
- public Object[] toArray() {
- return new Object[]{fP};
- }
-
- @Override
- public EPackageMatch toImmutable() {
- return isMutable() ? newMatch(fP) : this;
- }
-
- @Override
- public String prettyPrint() {
- StringBuilder result = new StringBuilder();
- result.append("\"p\"=" + prettyPrintValue(fP)
- );
- return result.toString();
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((fP == null) ? 0 : fP.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(final Object obj) {
- if (this == obj)
- return true;
- if (!(obj instanceof EPackageMatch)) { // this should be infrequent
- if (obj == null) {
- return false;
- }
- if (!(obj instanceof IPatternMatch)) {
- return false;
- }
- IPatternMatch otherSig = (IPatternMatch) obj;
- if (!specification().equals(otherSig.specification()))
- return false;
- return Arrays.deepEquals(toArray(), otherSig.toArray());
- }
- EPackageMatch other = (EPackageMatch) obj;
- if (fP == null) {if (other.fP != null) return false;}
- else if (!fP.equals(other.fP)) return false;
- return true;
- }
-
- @Override
- public EPackageQuerySpecification specification() {
- try {
- return EPackageQuerySpecification.instance();
- } catch (ViatraQueryException ex) {
- // This cannot happen, as the match object can only be instantiated if the query specification exists
- throw new IllegalStateException (ex);
- }
- }
-
- /**
- * 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 EPackageMatch 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 pP the fixed value of pattern parameter p, or null if not bound.
- * @return the new, mutable (partial) match object.
- *
- */
- public static EPackageMatch newMutableMatch(final EPackage pP) {
- return new Mutable(pP);
- }
-
- /**
- * Returns a new (partial) match.
- * This can be used e.g. to call the matcher with a partial match.
- * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
- * @param pP the fixed value of pattern parameter p, or null if not bound.
- * @return the (partial) match object.
- *
- */
- public static EPackageMatch newMatch(final EPackage pP) {
- return new Immutable(pP);
- }
-
- private static final class Mutable extends EPackageMatch {
- Mutable(final EPackage pP) {
- super(pP);
- }
-
- @Override
- public boolean isMutable() {
- return true;
- }
- }
-
- private static final class Immutable extends EPackageMatch {
- Immutable(final EPackage pP) {
- super(pP);
- }
-
- @Override
- public boolean isMutable() {
- return false;
- }
- }
-}
diff --git a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/EPackageMatcher.java b/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/EPackageMatcher.java
deleted file mode 100644
index 0eb10b4..0000000
--- a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/EPackageMatcher.java
+++ /dev/null
@@ -1,229 +0,0 @@
-package org.eclipse.viatra.query.application.queries;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-import org.apache.log4j.Logger;
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.viatra.query.application.queries.EPackageMatch;
-import org.eclipse.viatra.query.application.queries.util.EPackageQuerySpecification;
-import org.eclipse.viatra.query.runtime.api.IMatchProcessor;
-import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
-import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
-import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
-import org.eclipse.viatra.query.runtime.exception.ViatraQueryException;
-import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
-import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
-
-/**
- * Generated pattern matcher API of the org.eclipse.viatra.query.application.queries.ePackage pattern,
- * providing pattern-specific query methods.
- *
- * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
- * e.g. in conjunction with {@link ViatraQueryEngine#on(Notifier)}.
- *
- * <p>Matches of the pattern will be represented as {@link EPackageMatch}.
- *
- * <p>Original source:
- * <code><pre>
- * {@literal @}Item(item = p, label = "P: $p.name$")
- * {@literal @}Format(color = "#791662", textColor = "#ffffff")
- * pattern ePackage(p : EPackage) { EPackage(p); }
- * </pre></code>
- *
- * @see EPackageMatch
- * @see EPackageProcessor
- * @see EPackageQuerySpecification
- *
- */
-@SuppressWarnings("all")
-public class EPackageMatcher extends BaseMatcher<EPackageMatch> {
- /**
- * 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.
- * The match set will be incrementally refreshed upon updates.
- * @param engine the existing VIATRA Query engine in which this matcher will be created.
- * @throws ViatraQueryException if an error occurs during pattern matcher creation
- *
- */
- public static EPackageMatcher on(final ViatraQueryEngine engine) throws ViatraQueryException {
- // check if matcher already exists
- EPackageMatcher matcher = engine.getExistingMatcher(querySpecification());
- if (matcher == null) {
- matcher = new EPackageMatcher(engine);
- // do not have to "put" it into engine.matchers, reportMatcherInitialized() will take care of it
- }
- return matcher;
- }
-
- private final static int POSITION_P = 0;
-
- private final static Logger LOGGER = ViatraQueryLoggingUtil.getLogger(EPackageMatcher.class);
-
- /**
- * Initializes the pattern matcher over a given EMF model root (recommended: Resource or ResourceSet).
- * If a pattern matcher is already constructed with the same root, only a light-weight reference is returned.
- * The scope of pattern matching will be the given EMF model root and below (see FAQ for more precise definition).
- * The match set will be incrementally refreshed upon updates from this scope.
- * <p>The matcher will be created within the managed {@link ViatraQueryEngine} belonging to the EMF model root, so
- * multiple matchers will reuse the same engine and benefit from increased performance and reduced memory footprint.
- * @param emfRoot the root of the EMF containment hierarchy where the pattern matcher will operate. Recommended: Resource or ResourceSet.
- * @throws ViatraQueryException if an error occurs during pattern matcher creation
- * @deprecated use {@link #on(ViatraQueryEngine)} instead, e.g. in conjunction with {@link ViatraQueryEngine#on(Notifier)}
- *
- */
- @Deprecated
- public EPackageMatcher(final Notifier emfRoot) throws ViatraQueryException {
- this(ViatraQueryEngine.on(emfRoot));
- }
-
- /**
- * 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.
- * The match set will be incrementally refreshed upon updates.
- * @param engine the existing VIATRA Query engine in which this matcher will be created.
- * @throws ViatraQueryException if an error occurs during pattern matcher creation
- * @deprecated use {@link #on(ViatraQueryEngine)} instead
- *
- */
- @Deprecated
- public EPackageMatcher(final ViatraQueryEngine engine) throws ViatraQueryException {
- super(engine, querySpecification());
- }
-
- /**
- * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
- * @param pP the fixed value of pattern parameter p, or null if not bound.
- * @return matches represented as a EPackageMatch object.
- *
- */
- public Collection<EPackageMatch> getAllMatches(final EPackage pP) {
- return rawGetAllMatches(new Object[]{pP});
- }
-
- /**
- * 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 pP the fixed value of pattern parameter p, or null if not bound.
- * @return a match represented as a EPackageMatch object, or null if no match is found.
- *
- */
- public EPackageMatch getOneArbitraryMatch(final EPackage pP) {
- return rawGetOneArbitraryMatch(new Object[]{pP});
- }
-
- /**
- * 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 pP the fixed value of pattern parameter p, or null if not bound.
- * @return true if the input is a valid (partial) match of the pattern.
- *
- */
- public boolean hasMatch(final EPackage pP) {
- return rawHasMatch(new Object[]{pP});
- }
-
- /**
- * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
- * @param pP the fixed value of pattern parameter p, or null if not bound.
- * @return the number of pattern matches found.
- *
- */
- public int countMatches(final EPackage pP) {
- return rawCountMatches(new Object[]{pP});
- }
-
- /**
- * Executes the given processor on each match of the pattern that conforms to the given fixed values of some parameters.
- * @param pP the fixed value of pattern parameter p, or null if not bound.
- * @param processor the action that will process each pattern match.
- *
- */
- public void forEachMatch(final EPackage pP, final IMatchProcessor<? super EPackageMatch> processor) {
- rawForEachMatch(new Object[]{pP}, processor);
- }
-
- /**
- * 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 pP the fixed value of pattern parameter p, 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 EPackage pP, final IMatchProcessor<? super EPackageMatch> processor) {
- return rawForOneArbitraryMatch(new Object[]{pP}, processor);
- }
-
- /**
- * Returns a new (partial) match.
- * This can be used e.g. to call the matcher with a partial match.
- * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
- * @param pP the fixed value of pattern parameter p, or null if not bound.
- * @return the (partial) match object.
- *
- */
- public EPackageMatch newMatch(final EPackage pP) {
- return EPackageMatch.newMatch(pP);
- }
-
- /**
- * Retrieve the set of values that occur in matches for p.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- protected Set<EPackage> rawAccumulateAllValuesOfp(final Object[] parameters) {
- Set<EPackage> results = new HashSet<EPackage>();
- rawAccumulateAllValues(POSITION_P, parameters, results);
- return results;
- }
-
- /**
- * Retrieve the set of values that occur in matches for p.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<EPackage> getAllValuesOfp() {
- return rawAccumulateAllValuesOfp(emptyArray());
- }
-
- @Override
- protected EPackageMatch tupleToMatch(final Tuple t) {
- try {
- return EPackageMatch.newMatch((EPackage) t.get(POSITION_P));
- } catch(ClassCastException e) {
- LOGGER.error("Element(s) in tuple not properly typed!",e);
- return null;
- }
- }
-
- @Override
- protected EPackageMatch arrayToMatch(final Object[] match) {
- try {
- return EPackageMatch.newMatch((EPackage) match[POSITION_P]);
- } catch(ClassCastException e) {
- LOGGER.error("Element(s) in array not properly typed!",e);
- return null;
- }
- }
-
- @Override
- protected EPackageMatch arrayToMatchMutable(final Object[] match) {
- try {
- return EPackageMatch.newMutableMatch((EPackage) match[POSITION_P]);
- } 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 ViatraQueryException if the pattern definition could not be loaded
- *
- */
- public static IQuerySpecification<EPackageMatcher> querySpecification() throws ViatraQueryException {
- return EPackageQuerySpecification.instance();
- }
-}
diff --git a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/HeadlessQueries.java b/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/HeadlessQueries.java
index 7646931..f958315 100644
--- a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/HeadlessQueries.java
+++ b/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/HeadlessQueries.java
@@ -1,29 +1,23 @@
+/**
+ * Generated from platform:/resource/org.eclipse.viatra.query.application.queries/src/org/eclipse/viatra/query/application/queries/headlessQueries.vql
+ */
package org.eclipse.viatra.query.application.queries;
-import org.eclipse.viatra.query.application.queries.ClassesInPackageHierarchyMatcher;
-import org.eclipse.viatra.query.application.queries.ClassesInPackageMatcher;
-import org.eclipse.viatra.query.application.queries.EClassMatcher;
-import org.eclipse.viatra.query.application.queries.EClassNamesKeywordMatcher;
-import org.eclipse.viatra.query.application.queries.EClassNamesMatcher;
-import org.eclipse.viatra.query.application.queries.EObjectMatcher;
-import org.eclipse.viatra.query.application.queries.EPackageMatcher;
-import org.eclipse.viatra.query.application.queries.SubPackageMatcher;
-import org.eclipse.viatra.query.application.queries.util.ClassesInPackageHierarchyQuerySpecification;
-import org.eclipse.viatra.query.application.queries.util.ClassesInPackageQuerySpecification;
-import org.eclipse.viatra.query.application.queries.util.EClassNamesKeywordQuerySpecification;
-import org.eclipse.viatra.query.application.queries.util.EClassNamesQuerySpecification;
-import org.eclipse.viatra.query.application.queries.util.EClassQuerySpecification;
-import org.eclipse.viatra.query.application.queries.util.EObjectQuerySpecification;
-import org.eclipse.viatra.query.application.queries.util.EPackageQuerySpecification;
-import org.eclipse.viatra.query.application.queries.util.SubPackageQuerySpecification;
+import org.eclipse.viatra.query.application.queries.ClassesInPackage;
+import org.eclipse.viatra.query.application.queries.ClassesInPackageHierarchy;
+import org.eclipse.viatra.query.application.queries.EClass;
+import org.eclipse.viatra.query.application.queries.EClassNames;
+import org.eclipse.viatra.query.application.queries.EClassNamesKeyword;
+import org.eclipse.viatra.query.application.queries.EObject;
+import org.eclipse.viatra.query.application.queries.EPackage;
+import org.eclipse.viatra.query.application.queries.SubPackage;
import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup;
-import org.eclipse.viatra.query.runtime.exception.ViatraQueryException;
/**
- * A pattern group formed of all patterns defined in headlessQueries.vql.
+ * A pattern group formed of all public patterns defined in headlessQueries.vql.
*
- * <p>Use the static instance as any {@link org.eclipse.viatra.query.runtime.api.IPatternGroup}, to conveniently prepare
+ * <p>Use the static instance as any {@link interface org.eclipse.viatra.query.runtime.api.IQueryGroup}, to conveniently prepare
* a VIATRA Query engine for matching all patterns originally defined in file headlessQueries.vql,
* in order to achieve better performance than one-by-one on-demand matcher initialization.
*
@@ -38,7 +32,7 @@
* <li>eClass</li>
* </ul>
*
- * @see IPatternGroup
+ * @see IQueryGroup
*
*/
@SuppressWarnings("all")
@@ -47,90 +41,90 @@
* Access the pattern group.
*
* @return the singleton instance of the group
- * @throws ViatraQueryException if there was an error loading the generated code of pattern specifications
+ * @throws ViatraQueryRuntimeException if there was an error loading the generated code of pattern specifications
*
*/
- public static HeadlessQueries instance() throws ViatraQueryException {
+ public static HeadlessQueries instance() {
if (INSTANCE == null) {
- INSTANCE = new HeadlessQueries();
+ INSTANCE = new HeadlessQueries();
}
return INSTANCE;
}
private static HeadlessQueries INSTANCE;
- private HeadlessQueries() throws ViatraQueryException {
- querySpecifications.add(EClassNamesQuerySpecification.instance());
- querySpecifications.add(EClassNamesKeywordQuerySpecification.instance());
- querySpecifications.add(EObjectQuerySpecification.instance());
- querySpecifications.add(ClassesInPackageQuerySpecification.instance());
- querySpecifications.add(SubPackageQuerySpecification.instance());
- querySpecifications.add(ClassesInPackageHierarchyQuerySpecification.instance());
- querySpecifications.add(EPackageQuerySpecification.instance());
- querySpecifications.add(EClassQuerySpecification.instance());
+ private HeadlessQueries() {
+ querySpecifications.add(EClassNames.instance());
+ querySpecifications.add(EClassNamesKeyword.instance());
+ querySpecifications.add(EObject.instance());
+ querySpecifications.add(ClassesInPackage.instance());
+ querySpecifications.add(SubPackage.instance());
+ querySpecifications.add(ClassesInPackageHierarchy.instance());
+ querySpecifications.add(EPackage.instance());
+ querySpecifications.add(EClass.instance());
}
- public EClassNamesQuerySpecification getEClassNames() throws ViatraQueryException {
- return EClassNamesQuerySpecification.instance();
+ public EClassNames getEClassNames() {
+ return EClassNames.instance();
}
- public EClassNamesMatcher getEClassNames(final ViatraQueryEngine engine) throws ViatraQueryException {
- return EClassNamesMatcher.on(engine);
+ public EClassNames.Matcher getEClassNames(final ViatraQueryEngine engine) {
+ return EClassNames.Matcher.on(engine);
}
- public EClassNamesKeywordQuerySpecification getEClassNamesKeyword() throws ViatraQueryException {
- return EClassNamesKeywordQuerySpecification.instance();
+ public EClassNamesKeyword getEClassNamesKeyword() {
+ return EClassNamesKeyword.instance();
}
- public EClassNamesKeywordMatcher getEClassNamesKeyword(final ViatraQueryEngine engine) throws ViatraQueryException {
- return EClassNamesKeywordMatcher.on(engine);
+ public EClassNamesKeyword.Matcher getEClassNamesKeyword(final ViatraQueryEngine engine) {
+ return EClassNamesKeyword.Matcher.on(engine);
}
- public EObjectQuerySpecification getEObject() throws ViatraQueryException {
- return EObjectQuerySpecification.instance();
+ public EObject getEObject() {
+ return EObject.instance();
}
- public EObjectMatcher getEObject(final ViatraQueryEngine engine) throws ViatraQueryException {
- return EObjectMatcher.on(engine);
+ public EObject.Matcher getEObject(final ViatraQueryEngine engine) {
+ return EObject.Matcher.on(engine);
}
- public ClassesInPackageQuerySpecification getClassesInPackage() throws ViatraQueryException {
- return ClassesInPackageQuerySpecification.instance();
+ public ClassesInPackage getClassesInPackage() {
+ return ClassesInPackage.instance();
}
- public ClassesInPackageMatcher getClassesInPackage(final ViatraQueryEngine engine) throws ViatraQueryException {
- return ClassesInPackageMatcher.on(engine);
+ public ClassesInPackage.Matcher getClassesInPackage(final ViatraQueryEngine engine) {
+ return ClassesInPackage.Matcher.on(engine);
}
- public SubPackageQuerySpecification getSubPackage() throws ViatraQueryException {
- return SubPackageQuerySpecification.instance();
+ public SubPackage getSubPackage() {
+ return SubPackage.instance();
}
- public SubPackageMatcher getSubPackage(final ViatraQueryEngine engine) throws ViatraQueryException {
- return SubPackageMatcher.on(engine);
+ public SubPackage.Matcher getSubPackage(final ViatraQueryEngine engine) {
+ return SubPackage.Matcher.on(engine);
}
- public ClassesInPackageHierarchyQuerySpecification getClassesInPackageHierarchy() throws ViatraQueryException {
- return ClassesInPackageHierarchyQuerySpecification.instance();
+ public ClassesInPackageHierarchy getClassesInPackageHierarchy() {
+ return ClassesInPackageHierarchy.instance();
}
- public ClassesInPackageHierarchyMatcher getClassesInPackageHierarchy(final ViatraQueryEngine engine) throws ViatraQueryException {
- return ClassesInPackageHierarchyMatcher.on(engine);
+ public ClassesInPackageHierarchy.Matcher getClassesInPackageHierarchy(final ViatraQueryEngine engine) {
+ return ClassesInPackageHierarchy.Matcher.on(engine);
}
- public EPackageQuerySpecification getEPackage() throws ViatraQueryException {
- return EPackageQuerySpecification.instance();
+ public EPackage getEPackage() {
+ return EPackage.instance();
}
- public EPackageMatcher getEPackage(final ViatraQueryEngine engine) throws ViatraQueryException {
- return EPackageMatcher.on(engine);
+ public EPackage.Matcher getEPackage(final ViatraQueryEngine engine) {
+ return EPackage.Matcher.on(engine);
}
- public EClassQuerySpecification getEClass() throws ViatraQueryException {
- return EClassQuerySpecification.instance();
+ public EClass getEClass() {
+ return EClass.instance();
}
- public EClassMatcher getEClass(final ViatraQueryEngine engine) throws ViatraQueryException {
- return EClassMatcher.on(engine);
+ public EClass.Matcher getEClass(final ViatraQueryEngine engine) {
+ return EClass.Matcher.on(engine);
}
}
diff --git a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/SubPackageMatch.java b/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/SubPackageMatch.java
deleted file mode 100644
index 3539481..0000000
--- a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/SubPackageMatch.java
+++ /dev/null
@@ -1,207 +0,0 @@
-package org.eclipse.viatra.query.application.queries;
-
-import java.util.Arrays;
-import java.util.List;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.viatra.query.application.queries.util.SubPackageQuerySpecification;
-import org.eclipse.viatra.query.runtime.api.IPatternMatch;
-import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
-import org.eclipse.viatra.query.runtime.exception.ViatraQueryException;
-
-/**
- * Pattern-specific match representation of the org.eclipse.viatra.query.application.queries.subPackage pattern,
- * to be used in conjunction with {@link SubPackageMatcher}.
- *
- * <p>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 SubPackageMatcher
- * @see SubPackageProcessor
- *
- */
-@SuppressWarnings("all")
-public abstract class SubPackageMatch extends BasePatternMatch {
- private EPackage fP;
-
- private EPackage fSp;
-
- private static List<String> parameterNames = makeImmutableList("p", "sp");
-
- private SubPackageMatch(final EPackage pP, final EPackage pSp) {
- this.fP = pP;
- this.fSp = pSp;
- }
-
- @Override
- public Object get(final String parameterName) {
- if ("p".equals(parameterName)) return this.fP;
- if ("sp".equals(parameterName)) return this.fSp;
- return null;
- }
-
- public EPackage getP() {
- return this.fP;
- }
-
- public EPackage getSp() {
- return this.fSp;
- }
-
- @Override
- public boolean set(final String parameterName, final Object newValue) {
- if (!isMutable()) throw new java.lang.UnsupportedOperationException();
- if ("p".equals(parameterName) ) {
- this.fP = (EPackage) newValue;
- return true;
- }
- if ("sp".equals(parameterName) ) {
- this.fSp = (EPackage) newValue;
- return true;
- }
- return false;
- }
-
- public void setP(final EPackage pP) {
- if (!isMutable()) throw new java.lang.UnsupportedOperationException();
- this.fP = pP;
- }
-
- public void setSp(final EPackage pSp) {
- if (!isMutable()) throw new java.lang.UnsupportedOperationException();
- this.fSp = pSp;
- }
-
- @Override
- public String patternName() {
- return "org.eclipse.viatra.query.application.queries.subPackage";
- }
-
- @Override
- public List<String> parameterNames() {
- return SubPackageMatch.parameterNames;
- }
-
- @Override
- public Object[] toArray() {
- return new Object[]{fP, fSp};
- }
-
- @Override
- public SubPackageMatch toImmutable() {
- return isMutable() ? newMatch(fP, fSp) : this;
- }
-
- @Override
- public String prettyPrint() {
- StringBuilder result = new StringBuilder();
- result.append("\"p\"=" + prettyPrintValue(fP) + ", ");
-
- result.append("\"sp\"=" + prettyPrintValue(fSp)
- );
- return result.toString();
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((fP == null) ? 0 : fP.hashCode());
- result = prime * result + ((fSp == null) ? 0 : fSp.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(final Object obj) {
- if (this == obj)
- return true;
- if (!(obj instanceof SubPackageMatch)) { // this should be infrequent
- if (obj == null) {
- return false;
- }
- if (!(obj instanceof IPatternMatch)) {
- return false;
- }
- IPatternMatch otherSig = (IPatternMatch) obj;
- if (!specification().equals(otherSig.specification()))
- return false;
- return Arrays.deepEquals(toArray(), otherSig.toArray());
- }
- SubPackageMatch other = (SubPackageMatch) obj;
- if (fP == null) {if (other.fP != null) return false;}
- else if (!fP.equals(other.fP)) return false;
- if (fSp == null) {if (other.fSp != null) return false;}
- else if (!fSp.equals(other.fSp)) return false;
- return true;
- }
-
- @Override
- public SubPackageQuerySpecification specification() {
- try {
- return SubPackageQuerySpecification.instance();
- } catch (ViatraQueryException ex) {
- // This cannot happen, as the match object can only be instantiated if the query specification exists
- throw new IllegalStateException (ex);
- }
- }
-
- /**
- * 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 SubPackageMatch newEmptyMatch() {
- return new Mutable(null, null);
- }
-
- /**
- * Returns a mutable (partial) match.
- * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
- *
- * @param pP the fixed value of pattern parameter p, or null if not bound.
- * @param pSp the fixed value of pattern parameter sp, or null if not bound.
- * @return the new, mutable (partial) match object.
- *
- */
- public static SubPackageMatch newMutableMatch(final EPackage pP, final EPackage pSp) {
- return new Mutable(pP, pSp);
- }
-
- /**
- * Returns a new (partial) match.
- * This can be used e.g. to call the matcher with a partial match.
- * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
- * @param pP the fixed value of pattern parameter p, or null if not bound.
- * @param pSp the fixed value of pattern parameter sp, or null if not bound.
- * @return the (partial) match object.
- *
- */
- public static SubPackageMatch newMatch(final EPackage pP, final EPackage pSp) {
- return new Immutable(pP, pSp);
- }
-
- private static final class Mutable extends SubPackageMatch {
- Mutable(final EPackage pP, final EPackage pSp) {
- super(pP, pSp);
- }
-
- @Override
- public boolean isMutable() {
- return true;
- }
- }
-
- private static final class Immutable extends SubPackageMatch {
- Immutable(final EPackage pP, final EPackage pSp) {
- super(pP, pSp);
- }
-
- @Override
- public boolean isMutable() {
- return false;
- }
- }
-}
diff --git a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/SubPackageMatcher.java b/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/SubPackageMatcher.java
deleted file mode 100644
index 92aa03b..0000000
--- a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/SubPackageMatcher.java
+++ /dev/null
@@ -1,299 +0,0 @@
-package org.eclipse.viatra.query.application.queries;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-import org.apache.log4j.Logger;
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.viatra.query.application.queries.SubPackageMatch;
-import org.eclipse.viatra.query.application.queries.util.SubPackageQuerySpecification;
-import org.eclipse.viatra.query.runtime.api.IMatchProcessor;
-import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
-import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
-import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
-import org.eclipse.viatra.query.runtime.exception.ViatraQueryException;
-import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
-import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
-
-/**
- * Generated pattern matcher API of the org.eclipse.viatra.query.application.queries.subPackage pattern,
- * providing pattern-specific query methods.
- *
- * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
- * e.g. in conjunction with {@link ViatraQueryEngine#on(Notifier)}.
- *
- * <p>Matches of the pattern will be represented as {@link SubPackageMatch}.
- *
- * <p>Original source:
- * <code><pre>
- * {@literal @}Edge(source = p, target = sp, label = "sub")
- * pattern subPackage(p: EPackage, sp: EPackage){ EPackage.eSubpackages(p,sp); }
- * </pre></code>
- *
- * @see SubPackageMatch
- * @see SubPackageProcessor
- * @see SubPackageQuerySpecification
- *
- */
-@SuppressWarnings("all")
-public class SubPackageMatcher extends BaseMatcher<SubPackageMatch> {
- /**
- * 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.
- * The match set will be incrementally refreshed upon updates.
- * @param engine the existing VIATRA Query engine in which this matcher will be created.
- * @throws ViatraQueryException if an error occurs during pattern matcher creation
- *
- */
- public static SubPackageMatcher on(final ViatraQueryEngine engine) throws ViatraQueryException {
- // check if matcher already exists
- SubPackageMatcher matcher = engine.getExistingMatcher(querySpecification());
- if (matcher == null) {
- matcher = new SubPackageMatcher(engine);
- // do not have to "put" it into engine.matchers, reportMatcherInitialized() will take care of it
- }
- return matcher;
- }
-
- private final static int POSITION_P = 0;
-
- private final static int POSITION_SP = 1;
-
- private final static Logger LOGGER = ViatraQueryLoggingUtil.getLogger(SubPackageMatcher.class);
-
- /**
- * Initializes the pattern matcher over a given EMF model root (recommended: Resource or ResourceSet).
- * If a pattern matcher is already constructed with the same root, only a light-weight reference is returned.
- * The scope of pattern matching will be the given EMF model root and below (see FAQ for more precise definition).
- * The match set will be incrementally refreshed upon updates from this scope.
- * <p>The matcher will be created within the managed {@link ViatraQueryEngine} belonging to the EMF model root, so
- * multiple matchers will reuse the same engine and benefit from increased performance and reduced memory footprint.
- * @param emfRoot the root of the EMF containment hierarchy where the pattern matcher will operate. Recommended: Resource or ResourceSet.
- * @throws ViatraQueryException if an error occurs during pattern matcher creation
- * @deprecated use {@link #on(ViatraQueryEngine)} instead, e.g. in conjunction with {@link ViatraQueryEngine#on(Notifier)}
- *
- */
- @Deprecated
- public SubPackageMatcher(final Notifier emfRoot) throws ViatraQueryException {
- this(ViatraQueryEngine.on(emfRoot));
- }
-
- /**
- * 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.
- * The match set will be incrementally refreshed upon updates.
- * @param engine the existing VIATRA Query engine in which this matcher will be created.
- * @throws ViatraQueryException if an error occurs during pattern matcher creation
- * @deprecated use {@link #on(ViatraQueryEngine)} instead
- *
- */
- @Deprecated
- public SubPackageMatcher(final ViatraQueryEngine engine) throws ViatraQueryException {
- super(engine, querySpecification());
- }
-
- /**
- * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
- * @param pP the fixed value of pattern parameter p, or null if not bound.
- * @param pSp the fixed value of pattern parameter sp, or null if not bound.
- * @return matches represented as a SubPackageMatch object.
- *
- */
- public Collection<SubPackageMatch> getAllMatches(final EPackage pP, final EPackage pSp) {
- return rawGetAllMatches(new Object[]{pP, pSp});
- }
-
- /**
- * 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 pP the fixed value of pattern parameter p, or null if not bound.
- * @param pSp the fixed value of pattern parameter sp, or null if not bound.
- * @return a match represented as a SubPackageMatch object, or null if no match is found.
- *
- */
- public SubPackageMatch getOneArbitraryMatch(final EPackage pP, final EPackage pSp) {
- return rawGetOneArbitraryMatch(new Object[]{pP, pSp});
- }
-
- /**
- * 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 pP the fixed value of pattern parameter p, or null if not bound.
- * @param pSp the fixed value of pattern parameter sp, or null if not bound.
- * @return true if the input is a valid (partial) match of the pattern.
- *
- */
- public boolean hasMatch(final EPackage pP, final EPackage pSp) {
- return rawHasMatch(new Object[]{pP, pSp});
- }
-
- /**
- * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
- * @param pP the fixed value of pattern parameter p, or null if not bound.
- * @param pSp the fixed value of pattern parameter sp, or null if not bound.
- * @return the number of pattern matches found.
- *
- */
- public int countMatches(final EPackage pP, final EPackage pSp) {
- return rawCountMatches(new Object[]{pP, pSp});
- }
-
- /**
- * Executes the given processor on each match of the pattern that conforms to the given fixed values of some parameters.
- * @param pP the fixed value of pattern parameter p, or null if not bound.
- * @param pSp the fixed value of pattern parameter sp, or null if not bound.
- * @param processor the action that will process each pattern match.
- *
- */
- public void forEachMatch(final EPackage pP, final EPackage pSp, final IMatchProcessor<? super SubPackageMatch> processor) {
- rawForEachMatch(new Object[]{pP, pSp}, processor);
- }
-
- /**
- * 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 pP the fixed value of pattern parameter p, or null if not bound.
- * @param pSp the fixed value of pattern parameter sp, 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 EPackage pP, final EPackage pSp, final IMatchProcessor<? super SubPackageMatch> processor) {
- return rawForOneArbitraryMatch(new Object[]{pP, pSp}, processor);
- }
-
- /**
- * Returns a new (partial) match.
- * This can be used e.g. to call the matcher with a partial match.
- * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
- * @param pP the fixed value of pattern parameter p, or null if not bound.
- * @param pSp the fixed value of pattern parameter sp, or null if not bound.
- * @return the (partial) match object.
- *
- */
- public SubPackageMatch newMatch(final EPackage pP, final EPackage pSp) {
- return SubPackageMatch.newMatch(pP, pSp);
- }
-
- /**
- * Retrieve the set of values that occur in matches for p.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- protected Set<EPackage> rawAccumulateAllValuesOfp(final Object[] parameters) {
- Set<EPackage> results = new HashSet<EPackage>();
- rawAccumulateAllValues(POSITION_P, parameters, results);
- return results;
- }
-
- /**
- * Retrieve the set of values that occur in matches for p.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<EPackage> getAllValuesOfp() {
- return rawAccumulateAllValuesOfp(emptyArray());
- }
-
- /**
- * Retrieve the set of values that occur in matches for p.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<EPackage> getAllValuesOfp(final SubPackageMatch partialMatch) {
- return rawAccumulateAllValuesOfp(partialMatch.toArray());
- }
-
- /**
- * Retrieve the set of values that occur in matches for p.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<EPackage> getAllValuesOfp(final EPackage pSp) {
- return rawAccumulateAllValuesOfp(new Object[]{
- null,
- pSp
- });
- }
-
- /**
- * Retrieve the set of values that occur in matches for sp.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- protected Set<EPackage> rawAccumulateAllValuesOfsp(final Object[] parameters) {
- Set<EPackage> results = new HashSet<EPackage>();
- rawAccumulateAllValues(POSITION_SP, parameters, results);
- return results;
- }
-
- /**
- * Retrieve the set of values that occur in matches for sp.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<EPackage> getAllValuesOfsp() {
- return rawAccumulateAllValuesOfsp(emptyArray());
- }
-
- /**
- * Retrieve the set of values that occur in matches for sp.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<EPackage> getAllValuesOfsp(final SubPackageMatch partialMatch) {
- return rawAccumulateAllValuesOfsp(partialMatch.toArray());
- }
-
- /**
- * Retrieve the set of values that occur in matches for sp.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<EPackage> getAllValuesOfsp(final EPackage pP) {
- return rawAccumulateAllValuesOfsp(new Object[]{
- pP,
- null
- });
- }
-
- @Override
- protected SubPackageMatch tupleToMatch(final Tuple t) {
- try {
- return SubPackageMatch.newMatch((EPackage) t.get(POSITION_P), (EPackage) t.get(POSITION_SP));
- } catch(ClassCastException e) {
- LOGGER.error("Element(s) in tuple not properly typed!",e);
- return null;
- }
- }
-
- @Override
- protected SubPackageMatch arrayToMatch(final Object[] match) {
- try {
- return SubPackageMatch.newMatch((EPackage) match[POSITION_P], (EPackage) match[POSITION_SP]);
- } catch(ClassCastException e) {
- LOGGER.error("Element(s) in array not properly typed!",e);
- return null;
- }
- }
-
- @Override
- protected SubPackageMatch arrayToMatchMutable(final Object[] match) {
- try {
- return SubPackageMatch.newMutableMatch((EPackage) match[POSITION_P], (EPackage) match[POSITION_SP]);
- } 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 ViatraQueryException if the pattern definition could not be loaded
- *
- */
- public static IQuerySpecification<SubPackageMatcher> querySpecification() throws ViatraQueryException {
- return SubPackageQuerySpecification.instance();
- }
-}
diff --git a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/util/.gitignore b/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/util/.gitignore
deleted file mode 100644
index b21d549..0000000
--- a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/util/.gitignore
+++ /dev/null
@@ -1,16 +0,0 @@
-/.ClassesInPackageHierarchyProcessor.java._trace
-/.ClassesInPackageHierarchyQuerySpecification.java._trace
-/.ClassesInPackageProcessor.java._trace
-/.ClassesInPackageQuerySpecification.java._trace
-/.EClassNamesKeywordProcessor.java._trace
-/.EClassNamesKeywordQuerySpecification.java._trace
-/.EClassNamesProcessor.java._trace
-/.EClassNamesQuerySpecification.java._trace
-/.EClassProcessor.java._trace
-/.EClassQuerySpecification.java._trace
-/.EObjectProcessor.java._trace
-/.EObjectQuerySpecification.java._trace
-/.EPackageProcessor.java._trace
-/.EPackageQuerySpecification.java._trace
-/.SubPackageProcessor.java._trace
-/.SubPackageQuerySpecification.java._trace
diff --git a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/util/ClassesInPackageHierarchyProcessor.java b/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/util/ClassesInPackageHierarchyProcessor.java
deleted file mode 100644
index 851e211..0000000
--- a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/util/ClassesInPackageHierarchyProcessor.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.eclipse.viatra.query.application.queries.util;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.viatra.query.application.queries.ClassesInPackageHierarchyMatch;
-import org.eclipse.viatra.query.runtime.api.IMatchProcessor;
-
-/**
- * A match processor tailored for the org.eclipse.viatra.query.application.queries.classesInPackageHierarchy pattern.
- *
- * Clients should derive an (anonymous) class that implements the abstract process().
- *
- */
-@SuppressWarnings("all")
-public abstract class ClassesInPackageHierarchyProcessor implements IMatchProcessor<ClassesInPackageHierarchyMatch> {
- /**
- * Defines the action that is to be executed on each match.
- * @param pRootP the value of pattern parameter rootP in the currently processed match
- * @param pContainedClass the value of pattern parameter containedClass in the currently processed match
- *
- */
- public abstract void process(final EPackage pRootP, final EClass pContainedClass);
-
- @Override
- public void process(final ClassesInPackageHierarchyMatch match) {
- process(match.getRootP(), match.getContainedClass());
- }
-}
diff --git a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/util/ClassesInPackageHierarchyQuerySpecification.java b/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/util/ClassesInPackageHierarchyQuerySpecification.java
deleted file mode 100644
index f4e3ee8..0000000
--- a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/util/ClassesInPackageHierarchyQuerySpecification.java
+++ /dev/null
@@ -1,169 +0,0 @@
-package org.eclipse.viatra.query.application.queries.util;
-
-import com.google.common.collect.Sets;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Set;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.viatra.query.application.queries.ClassesInPackageHierarchyMatch;
-import org.eclipse.viatra.query.application.queries.ClassesInPackageHierarchyMatcher;
-import org.eclipse.viatra.query.application.queries.util.ClassesInPackageQuerySpecification;
-import org.eclipse.viatra.query.application.queries.util.SubPackageQuerySpecification;
-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.emf.types.EClassTransitiveInstancesKey;
-import org.eclipse.viatra.query.runtime.exception.ViatraQueryException;
-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.basicenumerables.BinaryTransitiveClosure;
-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.QueryInitializationException;
-import org.eclipse.viatra.query.runtime.matchers.tuple.FlatTuple;
-
-/**
- * A pattern-specific query specification that can instantiate ClassesInPackageHierarchyMatcher in a type-safe way.
- *
- * @see ClassesInPackageHierarchyMatcher
- * @see ClassesInPackageHierarchyMatch
- *
- */
-@SuppressWarnings("all")
-public final class ClassesInPackageHierarchyQuerySpecification extends BaseGeneratedEMFQuerySpecification<ClassesInPackageHierarchyMatcher> {
- private ClassesInPackageHierarchyQuerySpecification() {
- super(GeneratedPQuery.INSTANCE);
- }
-
- /**
- * @return the singleton instance of the query specification
- * @throws ViatraQueryException if the pattern definition could not be loaded
- *
- */
- public static ClassesInPackageHierarchyQuerySpecification instance() throws ViatraQueryException {
- try{
- return LazyHolder.INSTANCE;
- } catch (ExceptionInInitializerError err) {
- throw processInitializerError(err);
- }
- }
-
- @Override
- protected ClassesInPackageHierarchyMatcher instantiate(final ViatraQueryEngine engine) throws ViatraQueryException {
- return ClassesInPackageHierarchyMatcher.on(engine);
- }
-
- @Override
- public ClassesInPackageHierarchyMatch newEmptyMatch() {
- return ClassesInPackageHierarchyMatch.newEmptyMatch();
- }
-
- @Override
- public ClassesInPackageHierarchyMatch newMatch(final Object... parameters) {
- return ClassesInPackageHierarchyMatch.newMatch((org.eclipse.emf.ecore.EPackage) parameters[0], (org.eclipse.emf.ecore.EClass) parameters[1]);
- }
-
- /**
- * Inner class allowing the singleton instance of {@link ClassesInPackageHierarchyQuerySpecification} to be created
- * <b>not</b> at the class load time of the outer class,
- * but rather at the first call to {@link ClassesInPackageHierarchyQuerySpecification#instance()}.
- *
- * <p> This workaround is required e.g. to support recursion.
- *
- */
- private static class LazyHolder {
- private final static ClassesInPackageHierarchyQuerySpecification INSTANCE = new ClassesInPackageHierarchyQuerySpecification();
-
- /**
- * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
- * This initialization order is required to support indirect recursion.
- *
- * <p> 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.ensureInitializedInternalSneaky();
- return null;
- }
- }
-
- private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
- private final static ClassesInPackageHierarchyQuerySpecification.GeneratedPQuery INSTANCE = new GeneratedPQuery();
-
- @Override
- public String getFullyQualifiedName() {
- return "org.eclipse.viatra.query.application.queries.classesInPackageHierarchy";
- }
-
- @Override
- public List<String> getParameterNames() {
- return Arrays.asList("rootP","containedClass");
- }
-
- @Override
- public List<PParameter> getParameters() {
- return Arrays.asList(new PParameter("rootP", "org.eclipse.emf.ecore.EPackage"),new PParameter("containedClass", "org.eclipse.emf.ecore.EClass"));
- }
-
- @Override
- public Set<PBody> doGetContainedBodies() throws QueryInitializationException {
- Set<PBody> bodies = Sets.newLinkedHashSet();
- try {
- {
- PBody body = new PBody(this);
- PVariable var_rootP = body.getOrCreateVariableByName("rootP");
- PVariable var_containedClass = body.getOrCreateVariableByName("containedClass");
- new TypeConstraint(body, new FlatTuple(var_rootP), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EPackage")));
- new TypeConstraint(body, new FlatTuple(var_containedClass), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EClass")));
- body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
- new ExportedParameter(body, var_rootP, "rootP"),
- new ExportedParameter(body, var_containedClass, "containedClass")
- ));
- // find classesInPackage(rootP,containedClass)
- new PositivePatternCall(body, new FlatTuple(var_rootP, var_containedClass), ClassesInPackageQuerySpecification.instance().getInternalQueryRepresentation());
- bodies.add(body);
- }
- {
- PBody body = new PBody(this);
- PVariable var_rootP = body.getOrCreateVariableByName("rootP");
- PVariable var_containedClass = body.getOrCreateVariableByName("containedClass");
- PVariable var_somePackage = body.getOrCreateVariableByName("somePackage");
- new TypeConstraint(body, new FlatTuple(var_rootP), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EPackage")));
- new TypeConstraint(body, new FlatTuple(var_containedClass), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EClass")));
- body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
- new ExportedParameter(body, var_rootP, "rootP"),
- new ExportedParameter(body, var_containedClass, "containedClass")
- ));
- // find subPackage+(rootP,somePackage)
- new BinaryTransitiveClosure(body, new FlatTuple(var_rootP, var_somePackage), SubPackageQuerySpecification.instance().getInternalQueryRepresentation());
- // find classesInPackage(somePackage,containedClass)
- new PositivePatternCall(body, new FlatTuple(var_somePackage, var_containedClass), ClassesInPackageQuerySpecification.instance().getInternalQueryRepresentation());
- bodies.add(body);
- }
- {
- PAnnotation annotation = new PAnnotation("Edge");
- annotation.addAttribute("source", new ParameterReference("rootP"));
- annotation.addAttribute("label", "classIn+");
- annotation.addAttribute("target", new ParameterReference("containedClass"));
- addAnnotation(annotation);
- }
- {
- PAnnotation annotation = new PAnnotation("Format");
- annotation.addAttribute("color", "#0033ff");
- addAnnotation(annotation);
- }
- // to silence compiler error
- if (false) throw new ViatraQueryException("Never", "happens");
- } catch (ViatraQueryException ex) {
- throw processDependencyException(ex);
- }
- return bodies;
- }
- }
-}
diff --git a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/util/ClassesInPackageProcessor.java b/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/util/ClassesInPackageProcessor.java
deleted file mode 100644
index b91cb6d..0000000
--- a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/util/ClassesInPackageProcessor.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.eclipse.viatra.query.application.queries.util;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.viatra.query.application.queries.ClassesInPackageMatch;
-import org.eclipse.viatra.query.runtime.api.IMatchProcessor;
-
-/**
- * A match processor tailored for the org.eclipse.viatra.query.application.queries.classesInPackage pattern.
- *
- * Clients should derive an (anonymous) class that implements the abstract process().
- *
- */
-@SuppressWarnings("all")
-public abstract class ClassesInPackageProcessor implements IMatchProcessor<ClassesInPackageMatch> {
- /**
- * Defines the action that is to be executed on each match.
- * @param pP the value of pattern parameter p in the currently processed match
- * @param pEc the value of pattern parameter ec in the currently processed match
- *
- */
- public abstract void process(final EPackage pP, final EClass pEc);
-
- @Override
- public void process(final ClassesInPackageMatch match) {
- process(match.getP(), match.getEc());
- }
-}
diff --git a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/util/ClassesInPackageQuerySpecification.java b/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/util/ClassesInPackageQuerySpecification.java
deleted file mode 100644
index 86fa4cb..0000000
--- a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/util/ClassesInPackageQuerySpecification.java
+++ /dev/null
@@ -1,148 +0,0 @@
-package org.eclipse.viatra.query.application.queries.util;
-
-import com.google.common.collect.Sets;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Set;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.viatra.query.application.queries.ClassesInPackageMatch;
-import org.eclipse.viatra.query.application.queries.ClassesInPackageMatcher;
-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.emf.types.EClassTransitiveInstancesKey;
-import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey;
-import org.eclipse.viatra.query.runtime.exception.ViatraQueryException;
-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.QueryInitializationException;
-import org.eclipse.viatra.query.runtime.matchers.tuple.FlatTuple;
-
-/**
- * A pattern-specific query specification that can instantiate ClassesInPackageMatcher in a type-safe way.
- *
- * @see ClassesInPackageMatcher
- * @see ClassesInPackageMatch
- *
- */
-@SuppressWarnings("all")
-public final class ClassesInPackageQuerySpecification extends BaseGeneratedEMFQuerySpecification<ClassesInPackageMatcher> {
- private ClassesInPackageQuerySpecification() {
- super(GeneratedPQuery.INSTANCE);
- }
-
- /**
- * @return the singleton instance of the query specification
- * @throws ViatraQueryException if the pattern definition could not be loaded
- *
- */
- public static ClassesInPackageQuerySpecification instance() throws ViatraQueryException {
- try{
- return LazyHolder.INSTANCE;
- } catch (ExceptionInInitializerError err) {
- throw processInitializerError(err);
- }
- }
-
- @Override
- protected ClassesInPackageMatcher instantiate(final ViatraQueryEngine engine) throws ViatraQueryException {
- return ClassesInPackageMatcher.on(engine);
- }
-
- @Override
- public ClassesInPackageMatch newEmptyMatch() {
- return ClassesInPackageMatch.newEmptyMatch();
- }
-
- @Override
- public ClassesInPackageMatch newMatch(final Object... parameters) {
- return ClassesInPackageMatch.newMatch((org.eclipse.emf.ecore.EPackage) parameters[0], (org.eclipse.emf.ecore.EClass) parameters[1]);
- }
-
- /**
- * Inner class allowing the singleton instance of {@link ClassesInPackageQuerySpecification} to be created
- * <b>not</b> at the class load time of the outer class,
- * but rather at the first call to {@link ClassesInPackageQuerySpecification#instance()}.
- *
- * <p> This workaround is required e.g. to support recursion.
- *
- */
- private static class LazyHolder {
- private final static ClassesInPackageQuerySpecification INSTANCE = new ClassesInPackageQuerySpecification();
-
- /**
- * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
- * This initialization order is required to support indirect recursion.
- *
- * <p> 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.ensureInitializedInternalSneaky();
- return null;
- }
- }
-
- private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
- private final static ClassesInPackageQuerySpecification.GeneratedPQuery INSTANCE = new GeneratedPQuery();
-
- @Override
- public String getFullyQualifiedName() {
- return "org.eclipse.viatra.query.application.queries.classesInPackage";
- }
-
- @Override
- public List<String> getParameterNames() {
- return Arrays.asList("p","ec");
- }
-
- @Override
- public List<PParameter> getParameters() {
- return Arrays.asList(new PParameter("p", "org.eclipse.emf.ecore.EPackage"),new PParameter("ec", "org.eclipse.emf.ecore.EClass"));
- }
-
- @Override
- public Set<PBody> doGetContainedBodies() throws QueryInitializationException {
- Set<PBody> bodies = Sets.newLinkedHashSet();
- try {
- {
- PBody body = new PBody(this);
- PVariable var_p = body.getOrCreateVariableByName("p");
- PVariable var_ec = body.getOrCreateVariableByName("ec");
- new TypeConstraint(body, new FlatTuple(var_p), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EPackage")));
- new TypeConstraint(body, new FlatTuple(var_ec), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EClass")));
- body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
- new ExportedParameter(body, var_p, "p"),
- new ExportedParameter(body, var_ec, "ec")
- ));
- // EPackage.eClassifiers(p,ec)
- new TypeConstraint(body, new FlatTuple(var_p), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EPackage")));
- PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
- new TypeConstraint(body, new FlatTuple(var_p, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.eclipse.org/emf/2002/Ecore", "EPackage", "eClassifiers")));
- new Equality(body, var__virtual_0_, var_ec);
- bodies.add(body);
- }
- {
- PAnnotation annotation = new PAnnotation("Edge");
- annotation.addAttribute("source", new ParameterReference("p"));
- annotation.addAttribute("label", "classIn");
- annotation.addAttribute("target", new ParameterReference("ec"));
- addAnnotation(annotation);
- }
- // to silence compiler error
- if (false) throw new ViatraQueryException("Never", "happens");
- } catch (ViatraQueryException ex) {
- throw processDependencyException(ex);
- }
- return bodies;
- }
- }
-}
diff --git a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/util/EClassNamesKeywordProcessor.java b/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/util/EClassNamesKeywordProcessor.java
deleted file mode 100644
index 37be5d2..0000000
--- a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/util/EClassNamesKeywordProcessor.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.eclipse.viatra.query.application.queries.util;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.viatra.query.application.queries.EClassNamesKeywordMatch;
-import org.eclipse.viatra.query.runtime.api.IMatchProcessor;
-
-/**
- * A match processor tailored for the org.eclipse.viatra.query.application.queries.eClassNamesKeyword pattern.
- *
- * Clients should derive an (anonymous) class that implements the abstract process().
- *
- */
-@SuppressWarnings("all")
-public abstract class EClassNamesKeywordProcessor implements IMatchProcessor<EClassNamesKeywordMatch> {
- /**
- * Defines the action that is to be executed on each match.
- * @param pC the value of pattern parameter c in the currently processed match
- * @param pN the value of pattern parameter n in the currently processed match
- *
- */
- public abstract void process(final EClass pC, final String pN);
-
- @Override
- public void process(final EClassNamesKeywordMatch match) {
- process(match.getC(), match.getN());
- }
-}
diff --git a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/util/EClassNamesKeywordQuerySpecification.java b/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/util/EClassNamesKeywordQuerySpecification.java
deleted file mode 100644
index 2f771e1..0000000
--- a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/util/EClassNamesKeywordQuerySpecification.java
+++ /dev/null
@@ -1,170 +0,0 @@
-package org.eclipse.viatra.query.application.queries.util;
-
-import com.google.common.base.Objects;
-import com.google.common.collect.Sets;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Set;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EDataType;
-import org.eclipse.viatra.query.application.queries.EClassNamesKeywordMatch;
-import org.eclipse.viatra.query.application.queries.EClassNamesKeywordMatcher;
-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.emf.types.EClassTransitiveInstancesKey;
-import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey;
-import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey;
-import org.eclipse.viatra.query.runtime.exception.ViatraQueryException;
-import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator;
-import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider;
-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.ExpressionEvaluation;
-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.QueryInitializationException;
-import org.eclipse.viatra.query.runtime.matchers.tuple.FlatTuple;
-
-/**
- * A pattern-specific query specification that can instantiate EClassNamesKeywordMatcher in a type-safe way.
- *
- * @see EClassNamesKeywordMatcher
- * @see EClassNamesKeywordMatch
- *
- */
-@SuppressWarnings("all")
-public final class EClassNamesKeywordQuerySpecification extends BaseGeneratedEMFQuerySpecification<EClassNamesKeywordMatcher> {
- private EClassNamesKeywordQuerySpecification() {
- super(GeneratedPQuery.INSTANCE);
- }
-
- /**
- * @return the singleton instance of the query specification
- * @throws ViatraQueryException if the pattern definition could not be loaded
- *
- */
- public static EClassNamesKeywordQuerySpecification instance() throws ViatraQueryException {
- try{
- return LazyHolder.INSTANCE;
- } catch (ExceptionInInitializerError err) {
- throw processInitializerError(err);
- }
- }
-
- @Override
- protected EClassNamesKeywordMatcher instantiate(final ViatraQueryEngine engine) throws ViatraQueryException {
- return EClassNamesKeywordMatcher.on(engine);
- }
-
- @Override
- public EClassNamesKeywordMatch newEmptyMatch() {
- return EClassNamesKeywordMatch.newEmptyMatch();
- }
-
- @Override
- public EClassNamesKeywordMatch newMatch(final Object... parameters) {
- return EClassNamesKeywordMatch.newMatch((org.eclipse.emf.ecore.EClass) parameters[0], (java.lang.String) parameters[1]);
- }
-
- /**
- * Inner class allowing the singleton instance of {@link EClassNamesKeywordQuerySpecification} to be created
- * <b>not</b> at the class load time of the outer class,
- * but rather at the first call to {@link EClassNamesKeywordQuerySpecification#instance()}.
- *
- * <p> This workaround is required e.g. to support recursion.
- *
- */
- private static class LazyHolder {
- private final static EClassNamesKeywordQuerySpecification INSTANCE = new EClassNamesKeywordQuerySpecification();
-
- /**
- * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
- * This initialization order is required to support indirect recursion.
- *
- * <p> 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.ensureInitializedInternalSneaky();
- return null;
- }
- }
-
- private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
- private final static EClassNamesKeywordQuerySpecification.GeneratedPQuery INSTANCE = new GeneratedPQuery();
-
- @Override
- public String getFullyQualifiedName() {
- return "org.eclipse.viatra.query.application.queries.eClassNamesKeyword";
- }
-
- @Override
- public List<String> getParameterNames() {
- return Arrays.asList("c","n");
- }
-
- @Override
- public List<PParameter> getParameters() {
- return Arrays.asList(new PParameter("c", "org.eclipse.emf.ecore.EClass"),new PParameter("n", "java.lang.String"));
- }
-
- @Override
- public Set<PBody> doGetContainedBodies() throws QueryInitializationException {
- Set<PBody> bodies = Sets.newLinkedHashSet();
- try {
- {
- PBody body = new PBody(this);
- PVariable var_c = body.getOrCreateVariableByName("c");
- PVariable var_n = body.getOrCreateVariableByName("n");
- new TypeConstraint(body, new FlatTuple(var_c), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EClass")));
- new TypeConstraint(body, new FlatTuple(var_n), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EString")));
- body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
- new ExportedParameter(body, var_c, "c"),
- new ExportedParameter(body, var_n, "n")
- ));
- // EClass.name(c,n)
- new TypeConstraint(body, new FlatTuple(var_c), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EClass")));
- PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
- new TypeConstraint(body, new FlatTuple(var_c, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.eclipse.org/emf/2002/Ecore", "ENamedElement", "name")));
- new Equality(body, var__virtual_0_, var_n);
- // check("A" == n)
- new ExpressionEvaluation(body, new IExpressionEvaluator() {
-
- @Override
- public String getShortDescription() {
- return "Expression evaluation from pattern eClassNamesKeyword";
- }
-
- @Override
- public Iterable<String> getInputParameterNames() {
- return Arrays.asList("n");
- }
-
- @Override
- public Object evaluateExpression(IValueProvider provider) throws Exception {
- java.lang.String n = (java.lang.String) provider.getValue("n");
- return evaluateExpression_1_1(n);
- }
-
- }, null);
- bodies.add(body);
- }
- // to silence compiler error
- if (false) throw new ViatraQueryException("Never", "happens");
- } catch (ViatraQueryException ex) {
- throw processDependencyException(ex);
- }
- return bodies;
- }
- }
-
- private static boolean evaluateExpression_1_1(final String n) {
- boolean _equals = Objects.equal("A", n);
- return _equals;
- }
-}
diff --git a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/util/EClassNamesProcessor.java b/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/util/EClassNamesProcessor.java
deleted file mode 100644
index 9077c03..0000000
--- a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/util/EClassNamesProcessor.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.eclipse.viatra.query.application.queries.util;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.viatra.query.application.queries.EClassNamesMatch;
-import org.eclipse.viatra.query.runtime.api.IMatchProcessor;
-
-/**
- * A match processor tailored for the org.eclipse.viatra.query.application.queries.eClassNames pattern.
- *
- * Clients should derive an (anonymous) class that implements the abstract process().
- *
- */
-@SuppressWarnings("all")
-public abstract class EClassNamesProcessor implements IMatchProcessor<EClassNamesMatch> {
- /**
- * Defines the action that is to be executed on each match.
- * @param pC the value of pattern parameter c in the currently processed match
- * @param pN the value of pattern parameter n in the currently processed match
- *
- */
- public abstract void process(final EClass pC, final String pN);
-
- @Override
- public void process(final EClassNamesMatch match) {
- process(match.getC(), match.getN());
- }
-}
diff --git a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/util/EClassNamesQuerySpecification.java b/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/util/EClassNamesQuerySpecification.java
deleted file mode 100644
index 8bf21bf..0000000
--- a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/util/EClassNamesQuerySpecification.java
+++ /dev/null
@@ -1,141 +0,0 @@
-package org.eclipse.viatra.query.application.queries.util;
-
-import com.google.common.collect.Sets;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Set;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EDataType;
-import org.eclipse.viatra.query.application.queries.EClassNamesMatch;
-import org.eclipse.viatra.query.application.queries.EClassNamesMatcher;
-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.emf.types.EClassTransitiveInstancesKey;
-import org.eclipse.viatra.query.runtime.emf.types.EDataTypeInSlotsKey;
-import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey;
-import org.eclipse.viatra.query.runtime.exception.ViatraQueryException;
-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.basicenumerables.TypeConstraint;
-import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
-import org.eclipse.viatra.query.runtime.matchers.psystem.queries.QueryInitializationException;
-import org.eclipse.viatra.query.runtime.matchers.tuple.FlatTuple;
-
-/**
- * A pattern-specific query specification that can instantiate EClassNamesMatcher in a type-safe way.
- *
- * @see EClassNamesMatcher
- * @see EClassNamesMatch
- *
- */
-@SuppressWarnings("all")
-public final class EClassNamesQuerySpecification extends BaseGeneratedEMFQuerySpecification<EClassNamesMatcher> {
- private EClassNamesQuerySpecification() {
- super(GeneratedPQuery.INSTANCE);
- }
-
- /**
- * @return the singleton instance of the query specification
- * @throws ViatraQueryException if the pattern definition could not be loaded
- *
- */
- public static EClassNamesQuerySpecification instance() throws ViatraQueryException {
- try{
- return LazyHolder.INSTANCE;
- } catch (ExceptionInInitializerError err) {
- throw processInitializerError(err);
- }
- }
-
- @Override
- protected EClassNamesMatcher instantiate(final ViatraQueryEngine engine) throws ViatraQueryException {
- return EClassNamesMatcher.on(engine);
- }
-
- @Override
- public EClassNamesMatch newEmptyMatch() {
- return EClassNamesMatch.newEmptyMatch();
- }
-
- @Override
- public EClassNamesMatch newMatch(final Object... parameters) {
- return EClassNamesMatch.newMatch((org.eclipse.emf.ecore.EClass) parameters[0], (java.lang.String) parameters[1]);
- }
-
- /**
- * Inner class allowing the singleton instance of {@link EClassNamesQuerySpecification} to be created
- * <b>not</b> at the class load time of the outer class,
- * but rather at the first call to {@link EClassNamesQuerySpecification#instance()}.
- *
- * <p> This workaround is required e.g. to support recursion.
- *
- */
- private static class LazyHolder {
- private final static EClassNamesQuerySpecification INSTANCE = new EClassNamesQuerySpecification();
-
- /**
- * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
- * This initialization order is required to support indirect recursion.
- *
- * <p> 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.ensureInitializedInternalSneaky();
- return null;
- }
- }
-
- private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
- private final static EClassNamesQuerySpecification.GeneratedPQuery INSTANCE = new GeneratedPQuery();
-
- @Override
- public String getFullyQualifiedName() {
- return "org.eclipse.viatra.query.application.queries.eClassNames";
- }
-
- @Override
- public List<String> getParameterNames() {
- return Arrays.asList("c","n");
- }
-
- @Override
- public List<PParameter> getParameters() {
- return Arrays.asList(new PParameter("c", "org.eclipse.emf.ecore.EClass"),new PParameter("n", "java.lang.String"));
- }
-
- @Override
- public Set<PBody> doGetContainedBodies() throws QueryInitializationException {
- Set<PBody> bodies = Sets.newLinkedHashSet();
- try {
- {
- PBody body = new PBody(this);
- PVariable var_c = body.getOrCreateVariableByName("c");
- PVariable var_n = body.getOrCreateVariableByName("n");
- new TypeConstraint(body, new FlatTuple(var_c), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EClass")));
- new TypeConstraint(body, new FlatTuple(var_n), new EDataTypeInSlotsKey((EDataType)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EString")));
- body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
- new ExportedParameter(body, var_c, "c"),
- new ExportedParameter(body, var_n, "n")
- ));
- // EClass.name(c,n)
- new TypeConstraint(body, new FlatTuple(var_c), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EClass")));
- PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
- new TypeConstraint(body, new FlatTuple(var_c, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.eclipse.org/emf/2002/Ecore", "ENamedElement", "name")));
- new Equality(body, var__virtual_0_, var_n);
- bodies.add(body);
- }
- // to silence compiler error
- if (false) throw new ViatraQueryException("Never", "happens");
- } catch (ViatraQueryException ex) {
- throw processDependencyException(ex);
- }
- return bodies;
- }
- }
-}
diff --git a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/util/EClassProcessor.java b/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/util/EClassProcessor.java
deleted file mode 100644
index 99b2ba2..0000000
--- a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/util/EClassProcessor.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.eclipse.viatra.query.application.queries.util;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.viatra.query.application.queries.EClassMatch;
-import org.eclipse.viatra.query.runtime.api.IMatchProcessor;
-
-/**
- * A match processor tailored for the org.eclipse.viatra.query.application.queries.eClass pattern.
- *
- * Clients should derive an (anonymous) class that implements the abstract process().
- *
- */
-@SuppressWarnings("all")
-public abstract class EClassProcessor implements IMatchProcessor<EClassMatch> {
- /**
- * Defines the action that is to be executed on each match.
- * @param pEc the value of pattern parameter ec in the currently processed match
- *
- */
- public abstract void process(final EClass pEc);
-
- @Override
- public void process(final EClassMatch match) {
- process(match.getEc());
- }
-}
diff --git a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/util/EClassQuerySpecification.java b/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/util/EClassQuerySpecification.java
deleted file mode 100644
index 4525689..0000000
--- a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/util/EClassQuerySpecification.java
+++ /dev/null
@@ -1,144 +0,0 @@
-package org.eclipse.viatra.query.application.queries.util;
-
-import com.google.common.collect.Sets;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Set;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.viatra.query.application.queries.EClassMatch;
-import org.eclipse.viatra.query.application.queries.EClassMatcher;
-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.emf.types.EClassTransitiveInstancesKey;
-import org.eclipse.viatra.query.runtime.exception.ViatraQueryException;
-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.basicenumerables.TypeConstraint;
-import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
-import org.eclipse.viatra.query.runtime.matchers.psystem.queries.QueryInitializationException;
-import org.eclipse.viatra.query.runtime.matchers.tuple.FlatTuple;
-
-/**
- * A pattern-specific query specification that can instantiate EClassMatcher in a type-safe way.
- *
- * @see EClassMatcher
- * @see EClassMatch
- *
- */
-@SuppressWarnings("all")
-public final class EClassQuerySpecification extends BaseGeneratedEMFQuerySpecification<EClassMatcher> {
- private EClassQuerySpecification() {
- super(GeneratedPQuery.INSTANCE);
- }
-
- /**
- * @return the singleton instance of the query specification
- * @throws ViatraQueryException if the pattern definition could not be loaded
- *
- */
- public static EClassQuerySpecification instance() throws ViatraQueryException {
- try{
- return LazyHolder.INSTANCE;
- } catch (ExceptionInInitializerError err) {
- throw processInitializerError(err);
- }
- }
-
- @Override
- protected EClassMatcher instantiate(final ViatraQueryEngine engine) throws ViatraQueryException {
- return EClassMatcher.on(engine);
- }
-
- @Override
- public EClassMatch newEmptyMatch() {
- return EClassMatch.newEmptyMatch();
- }
-
- @Override
- public EClassMatch newMatch(final Object... parameters) {
- return EClassMatch.newMatch((org.eclipse.emf.ecore.EClass) parameters[0]);
- }
-
- /**
- * Inner class allowing the singleton instance of {@link EClassQuerySpecification} to be created
- * <b>not</b> at the class load time of the outer class,
- * but rather at the first call to {@link EClassQuerySpecification#instance()}.
- *
- * <p> This workaround is required e.g. to support recursion.
- *
- */
- private static class LazyHolder {
- private final static EClassQuerySpecification INSTANCE = new EClassQuerySpecification();
-
- /**
- * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
- * This initialization order is required to support indirect recursion.
- *
- * <p> 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.ensureInitializedInternalSneaky();
- return null;
- }
- }
-
- private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
- private final static EClassQuerySpecification.GeneratedPQuery INSTANCE = new GeneratedPQuery();
-
- @Override
- public String getFullyQualifiedName() {
- return "org.eclipse.viatra.query.application.queries.eClass";
- }
-
- @Override
- public List<String> getParameterNames() {
- return Arrays.asList("ec");
- }
-
- @Override
- public List<PParameter> getParameters() {
- return Arrays.asList(new PParameter("ec", "org.eclipse.emf.ecore.EClass"));
- }
-
- @Override
- public Set<PBody> doGetContainedBodies() throws QueryInitializationException {
- Set<PBody> bodies = Sets.newLinkedHashSet();
- try {
- {
- PBody body = new PBody(this);
- PVariable var_ec = body.getOrCreateVariableByName("ec");
- new TypeConstraint(body, new FlatTuple(var_ec), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EClass")));
- body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
- new ExportedParameter(body, var_ec, "ec")
- ));
- // EClass(ec)
- new TypeConstraint(body, new FlatTuple(var_ec), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EClass")));
- bodies.add(body);
- }
- {
- PAnnotation annotation = new PAnnotation("Item");
- annotation.addAttribute("item", new ParameterReference("ec"));
- annotation.addAttribute("label", "EC: $ec.name$");
- addAnnotation(annotation);
- }
- {
- PAnnotation annotation = new PAnnotation("Format");
- annotation.addAttribute("color", "#e8da2c");
- addAnnotation(annotation);
- }
- // to silence compiler error
- if (false) throw new ViatraQueryException("Never", "happens");
- } catch (ViatraQueryException ex) {
- throw processDependencyException(ex);
- }
- return bodies;
- }
- }
-}
diff --git a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/util/EObjectProcessor.java b/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/util/EObjectProcessor.java
deleted file mode 100644
index 37bbebe..0000000
--- a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/util/EObjectProcessor.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.eclipse.viatra.query.application.queries.util;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.viatra.query.application.queries.EObjectMatch;
-import org.eclipse.viatra.query.runtime.api.IMatchProcessor;
-
-/**
- * A match processor tailored for the org.eclipse.viatra.query.application.queries.eObject pattern.
- *
- * Clients should derive an (anonymous) class that implements the abstract process().
- *
- */
-@SuppressWarnings("all")
-public abstract class EObjectProcessor implements IMatchProcessor<EObjectMatch> {
- /**
- * Defines the action that is to be executed on each match.
- * @param pO the value of pattern parameter o in the currently processed match
- *
- */
- public abstract void process(final EObject pO);
-
- @Override
- public void process(final EObjectMatch match) {
- process(match.getO());
- }
-}
diff --git a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/util/EObjectQuerySpecification.java b/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/util/EObjectQuerySpecification.java
deleted file mode 100644
index a648eb2..0000000
--- a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/util/EObjectQuerySpecification.java
+++ /dev/null
@@ -1,130 +0,0 @@
-package org.eclipse.viatra.query.application.queries.util;
-
-import com.google.common.collect.Sets;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Set;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.viatra.query.application.queries.EObjectMatch;
-import org.eclipse.viatra.query.application.queries.EObjectMatcher;
-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.emf.types.EClassTransitiveInstancesKey;
-import org.eclipse.viatra.query.runtime.exception.ViatraQueryException;
-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.QueryInitializationException;
-import org.eclipse.viatra.query.runtime.matchers.tuple.FlatTuple;
-
-/**
- * A pattern-specific query specification that can instantiate EObjectMatcher in a type-safe way.
- *
- * @see EObjectMatcher
- * @see EObjectMatch
- *
- */
-@SuppressWarnings("all")
-public final class EObjectQuerySpecification extends BaseGeneratedEMFQuerySpecification<EObjectMatcher> {
- private EObjectQuerySpecification() {
- super(GeneratedPQuery.INSTANCE);
- }
-
- /**
- * @return the singleton instance of the query specification
- * @throws ViatraQueryException if the pattern definition could not be loaded
- *
- */
- public static EObjectQuerySpecification instance() throws ViatraQueryException {
- try{
- return LazyHolder.INSTANCE;
- } catch (ExceptionInInitializerError err) {
- throw processInitializerError(err);
- }
- }
-
- @Override
- protected EObjectMatcher instantiate(final ViatraQueryEngine engine) throws ViatraQueryException {
- return EObjectMatcher.on(engine);
- }
-
- @Override
- public EObjectMatch newEmptyMatch() {
- return EObjectMatch.newEmptyMatch();
- }
-
- @Override
- public EObjectMatch newMatch(final Object... parameters) {
- return EObjectMatch.newMatch((org.eclipse.emf.ecore.EObject) parameters[0]);
- }
-
- /**
- * Inner class allowing the singleton instance of {@link EObjectQuerySpecification} to be created
- * <b>not</b> at the class load time of the outer class,
- * but rather at the first call to {@link EObjectQuerySpecification#instance()}.
- *
- * <p> This workaround is required e.g. to support recursion.
- *
- */
- private static class LazyHolder {
- private final static EObjectQuerySpecification INSTANCE = new EObjectQuerySpecification();
-
- /**
- * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
- * This initialization order is required to support indirect recursion.
- *
- * <p> 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.ensureInitializedInternalSneaky();
- return null;
- }
- }
-
- private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
- private final static EObjectQuerySpecification.GeneratedPQuery INSTANCE = new GeneratedPQuery();
-
- @Override
- public String getFullyQualifiedName() {
- return "org.eclipse.viatra.query.application.queries.eObject";
- }
-
- @Override
- public List<String> getParameterNames() {
- return Arrays.asList("o");
- }
-
- @Override
- public List<PParameter> getParameters() {
- return Arrays.asList(new PParameter("o", "org.eclipse.emf.ecore.EObject"));
- }
-
- @Override
- public Set<PBody> doGetContainedBodies() throws QueryInitializationException {
- Set<PBody> bodies = Sets.newLinkedHashSet();
- try {
- {
- PBody body = new PBody(this);
- PVariable var_o = body.getOrCreateVariableByName("o");
- body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
- new ExportedParameter(body, var_o, "o")
- ));
- // EObject(o)
- new TypeConstraint(body, new FlatTuple(var_o), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EObject")));
- bodies.add(body);
- }
- // to silence compiler error
- if (false) throw new ViatraQueryException("Never", "happens");
- } catch (ViatraQueryException ex) {
- throw processDependencyException(ex);
- }
- return bodies;
- }
- }
-}
diff --git a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/util/EPackageProcessor.java b/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/util/EPackageProcessor.java
deleted file mode 100644
index 835e4f5..0000000
--- a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/util/EPackageProcessor.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.eclipse.viatra.query.application.queries.util;
-
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.viatra.query.application.queries.EPackageMatch;
-import org.eclipse.viatra.query.runtime.api.IMatchProcessor;
-
-/**
- * A match processor tailored for the org.eclipse.viatra.query.application.queries.ePackage pattern.
- *
- * Clients should derive an (anonymous) class that implements the abstract process().
- *
- */
-@SuppressWarnings("all")
-public abstract class EPackageProcessor implements IMatchProcessor<EPackageMatch> {
- /**
- * Defines the action that is to be executed on each match.
- * @param pP the value of pattern parameter p in the currently processed match
- *
- */
- public abstract void process(final EPackage pP);
-
- @Override
- public void process(final EPackageMatch match) {
- process(match.getP());
- }
-}
diff --git a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/util/EPackageQuerySpecification.java b/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/util/EPackageQuerySpecification.java
deleted file mode 100644
index 81d29e7..0000000
--- a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/util/EPackageQuerySpecification.java
+++ /dev/null
@@ -1,145 +0,0 @@
-package org.eclipse.viatra.query.application.queries.util;
-
-import com.google.common.collect.Sets;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Set;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.viatra.query.application.queries.EPackageMatch;
-import org.eclipse.viatra.query.application.queries.EPackageMatcher;
-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.emf.types.EClassTransitiveInstancesKey;
-import org.eclipse.viatra.query.runtime.exception.ViatraQueryException;
-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.basicenumerables.TypeConstraint;
-import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
-import org.eclipse.viatra.query.runtime.matchers.psystem.queries.QueryInitializationException;
-import org.eclipse.viatra.query.runtime.matchers.tuple.FlatTuple;
-
-/**
- * A pattern-specific query specification that can instantiate EPackageMatcher in a type-safe way.
- *
- * @see EPackageMatcher
- * @see EPackageMatch
- *
- */
-@SuppressWarnings("all")
-public final class EPackageQuerySpecification extends BaseGeneratedEMFQuerySpecification<EPackageMatcher> {
- private EPackageQuerySpecification() {
- super(GeneratedPQuery.INSTANCE);
- }
-
- /**
- * @return the singleton instance of the query specification
- * @throws ViatraQueryException if the pattern definition could not be loaded
- *
- */
- public static EPackageQuerySpecification instance() throws ViatraQueryException {
- try{
- return LazyHolder.INSTANCE;
- } catch (ExceptionInInitializerError err) {
- throw processInitializerError(err);
- }
- }
-
- @Override
- protected EPackageMatcher instantiate(final ViatraQueryEngine engine) throws ViatraQueryException {
- return EPackageMatcher.on(engine);
- }
-
- @Override
- public EPackageMatch newEmptyMatch() {
- return EPackageMatch.newEmptyMatch();
- }
-
- @Override
- public EPackageMatch newMatch(final Object... parameters) {
- return EPackageMatch.newMatch((org.eclipse.emf.ecore.EPackage) parameters[0]);
- }
-
- /**
- * Inner class allowing the singleton instance of {@link EPackageQuerySpecification} to be created
- * <b>not</b> at the class load time of the outer class,
- * but rather at the first call to {@link EPackageQuerySpecification#instance()}.
- *
- * <p> This workaround is required e.g. to support recursion.
- *
- */
- private static class LazyHolder {
- private final static EPackageQuerySpecification INSTANCE = new EPackageQuerySpecification();
-
- /**
- * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
- * This initialization order is required to support indirect recursion.
- *
- * <p> 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.ensureInitializedInternalSneaky();
- return null;
- }
- }
-
- private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
- private final static EPackageQuerySpecification.GeneratedPQuery INSTANCE = new GeneratedPQuery();
-
- @Override
- public String getFullyQualifiedName() {
- return "org.eclipse.viatra.query.application.queries.ePackage";
- }
-
- @Override
- public List<String> getParameterNames() {
- return Arrays.asList("p");
- }
-
- @Override
- public List<PParameter> getParameters() {
- return Arrays.asList(new PParameter("p", "org.eclipse.emf.ecore.EPackage"));
- }
-
- @Override
- public Set<PBody> doGetContainedBodies() throws QueryInitializationException {
- Set<PBody> bodies = Sets.newLinkedHashSet();
- try {
- {
- PBody body = new PBody(this);
- PVariable var_p = body.getOrCreateVariableByName("p");
- new TypeConstraint(body, new FlatTuple(var_p), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EPackage")));
- body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
- new ExportedParameter(body, var_p, "p")
- ));
- // EPackage(p)
- new TypeConstraint(body, new FlatTuple(var_p), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EPackage")));
- bodies.add(body);
- }
- {
- PAnnotation annotation = new PAnnotation("Item");
- annotation.addAttribute("item", new ParameterReference("p"));
- annotation.addAttribute("label", "P: $p.name$");
- addAnnotation(annotation);
- }
- {
- PAnnotation annotation = new PAnnotation("Format");
- annotation.addAttribute("color", "#791662");
- annotation.addAttribute("textColor", "#ffffff");
- addAnnotation(annotation);
- }
- // to silence compiler error
- if (false) throw new ViatraQueryException("Never", "happens");
- } catch (ViatraQueryException ex) {
- throw processDependencyException(ex);
- }
- return bodies;
- }
- }
-}
diff --git a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/util/SubPackageProcessor.java b/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/util/SubPackageProcessor.java
deleted file mode 100644
index 8460e27..0000000
--- a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/util/SubPackageProcessor.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.eclipse.viatra.query.application.queries.util;
-
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.viatra.query.application.queries.SubPackageMatch;
-import org.eclipse.viatra.query.runtime.api.IMatchProcessor;
-
-/**
- * A match processor tailored for the org.eclipse.viatra.query.application.queries.subPackage pattern.
- *
- * Clients should derive an (anonymous) class that implements the abstract process().
- *
- */
-@SuppressWarnings("all")
-public abstract class SubPackageProcessor implements IMatchProcessor<SubPackageMatch> {
- /**
- * Defines the action that is to be executed on each match.
- * @param pP the value of pattern parameter p in the currently processed match
- * @param pSp the value of pattern parameter sp in the currently processed match
- *
- */
- public abstract void process(final EPackage pP, final EPackage pSp);
-
- @Override
- public void process(final SubPackageMatch match) {
- process(match.getP(), match.getSp());
- }
-}
diff --git a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/util/SubPackageQuerySpecification.java b/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/util/SubPackageQuerySpecification.java
deleted file mode 100644
index 00592a4..0000000
--- a/query/headless/org.eclipse.viatra.query.application.queries/src-gen/org/eclipse/viatra/query/application/queries/util/SubPackageQuerySpecification.java
+++ /dev/null
@@ -1,148 +0,0 @@
-package org.eclipse.viatra.query.application.queries.util;
-
-import com.google.common.collect.Sets;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Set;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.viatra.query.application.queries.SubPackageMatch;
-import org.eclipse.viatra.query.application.queries.SubPackageMatcher;
-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.emf.types.EClassTransitiveInstancesKey;
-import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey;
-import org.eclipse.viatra.query.runtime.exception.ViatraQueryException;
-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.QueryInitializationException;
-import org.eclipse.viatra.query.runtime.matchers.tuple.FlatTuple;
-
-/**
- * A pattern-specific query specification that can instantiate SubPackageMatcher in a type-safe way.
- *
- * @see SubPackageMatcher
- * @see SubPackageMatch
- *
- */
-@SuppressWarnings("all")
-public final class SubPackageQuerySpecification extends BaseGeneratedEMFQuerySpecification<SubPackageMatcher> {
- private SubPackageQuerySpecification() {
- super(GeneratedPQuery.INSTANCE);
- }
-
- /**
- * @return the singleton instance of the query specification
- * @throws ViatraQueryException if the pattern definition could not be loaded
- *
- */
- public static SubPackageQuerySpecification instance() throws ViatraQueryException {
- try{
- return LazyHolder.INSTANCE;
- } catch (ExceptionInInitializerError err) {
- throw processInitializerError(err);
- }
- }
-
- @Override
- protected SubPackageMatcher instantiate(final ViatraQueryEngine engine) throws ViatraQueryException {
- return SubPackageMatcher.on(engine);
- }
-
- @Override
- public SubPackageMatch newEmptyMatch() {
- return SubPackageMatch.newEmptyMatch();
- }
-
- @Override
- public SubPackageMatch newMatch(final Object... parameters) {
- return SubPackageMatch.newMatch((org.eclipse.emf.ecore.EPackage) parameters[0], (org.eclipse.emf.ecore.EPackage) parameters[1]);
- }
-
- /**
- * Inner class allowing the singleton instance of {@link SubPackageQuerySpecification} to be created
- * <b>not</b> at the class load time of the outer class,
- * but rather at the first call to {@link SubPackageQuerySpecification#instance()}.
- *
- * <p> This workaround is required e.g. to support recursion.
- *
- */
- private static class LazyHolder {
- private final static SubPackageQuerySpecification INSTANCE = new SubPackageQuerySpecification();
-
- /**
- * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
- * This initialization order is required to support indirect recursion.
- *
- * <p> 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.ensureInitializedInternalSneaky();
- return null;
- }
- }
-
- private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
- private final static SubPackageQuerySpecification.GeneratedPQuery INSTANCE = new GeneratedPQuery();
-
- @Override
- public String getFullyQualifiedName() {
- return "org.eclipse.viatra.query.application.queries.subPackage";
- }
-
- @Override
- public List<String> getParameterNames() {
- return Arrays.asList("p","sp");
- }
-
- @Override
- public List<PParameter> getParameters() {
- return Arrays.asList(new PParameter("p", "org.eclipse.emf.ecore.EPackage"),new PParameter("sp", "org.eclipse.emf.ecore.EPackage"));
- }
-
- @Override
- public Set<PBody> doGetContainedBodies() throws QueryInitializationException {
- Set<PBody> bodies = Sets.newLinkedHashSet();
- try {
- {
- PBody body = new PBody(this);
- PVariable var_p = body.getOrCreateVariableByName("p");
- PVariable var_sp = body.getOrCreateVariableByName("sp");
- new TypeConstraint(body, new FlatTuple(var_p), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EPackage")));
- new TypeConstraint(body, new FlatTuple(var_sp), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EPackage")));
- body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
- new ExportedParameter(body, var_p, "p"),
- new ExportedParameter(body, var_sp, "sp")
- ));
- // EPackage.eSubpackages(p,sp)
- new TypeConstraint(body, new FlatTuple(var_p), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/emf/2002/Ecore", "EPackage")));
- PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
- new TypeConstraint(body, new FlatTuple(var_p, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.eclipse.org/emf/2002/Ecore", "EPackage", "eSubpackages")));
- new Equality(body, var__virtual_0_, var_sp);
- bodies.add(body);
- }
- {
- PAnnotation annotation = new PAnnotation("Edge");
- annotation.addAttribute("source", new ParameterReference("p"));
- annotation.addAttribute("label", "sub");
- annotation.addAttribute("target", new ParameterReference("sp"));
- addAnnotation(annotation);
- }
- // to silence compiler error
- if (false) throw new ViatraQueryException("Never", "happens");
- } catch (ViatraQueryException ex) {
- throw processDependencyException(ex);
- }
- return bodies;
- }
- }
-}
diff --git a/query/library/library.ecore.viewers/.classpath b/query/library/library.ecore.viewers/.classpath
index 6a42377..f0c5549 100644
--- a/query/library/library.ecore.viewers/.classpath
+++ b/query/library/library.ecore.viewers/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="src-gen"/>
diff --git a/query/library/library.ecore.viewers/.settings/org.eclipse.jdt.core.prefs b/query/library/library.ecore.viewers/.settings/org.eclipse.jdt.core.prefs
index f42de36..0c68a61 100644
--- a/query/library/library.ecore.viewers/.settings/org.eclipse.jdt.core.prefs
+++ b/query/library/library.ecore.viewers/.settings/org.eclipse.jdt.core.prefs
@@ -1,7 +1,7 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
-org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.7
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/query/library/library.ecore.viewers/META-INF/MANIFEST.MF b/query/library/library.ecore.viewers/META-INF/MANIFEST.MF
index 6056cb4..d5b2912 100644
--- a/query/library/library.ecore.viewers/META-INF/MANIFEST.MF
+++ b/query/library/library.ecore.viewers/META-INF/MANIFEST.MF
@@ -3,12 +3,11 @@
Bundle-Name: library.ecore.viewers
Bundle-SymbolicName: library.ecore.viewers;singleton:=true
Bundle-Version: 0.0.1.qualifier
-Export-Package: library.viewers.livedemo,
- library.viewers.livedemo.util
+Export-Package: library.viewers.livedemo
Require-Bundle: library.ecore,
- org.eclipse.emf.ecore,
- org.eclipse.emf.transaction,
- org.eclipse.xtext.xbase.lib,
- org.eclipse.viatra.query.runtime;bundle-version="1.2.0"
-Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+ org.eclipse.emf.ecore,
+ org.eclipse.emf.transaction,
+ org.eclipse.xtext.xbase.lib,
+ org.eclipse.viatra.query.runtime;bundle-version="1.2.0"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Import-Package: org.apache.log4j
diff --git a/query/library/library.ecore.viewers/plugin.xml b/query/library/library.ecore.viewers/plugin.xml
index a5934fa..7cf9192 100644
--- a/query/library/library.ecore.viewers/plugin.xml
+++ b/query/library/library.ecore.viewers/plugin.xml
@@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?><plugin>
<extension id="library.viewers.livedemo.ViewersQueries" point="org.eclipse.viatra.query.runtime.queryspecification">
- <group group="org.eclipse.viatra.query.runtime.extensibility.SingletonExtensionFactory:library.viewers.livedemo.ViewersQueries" id="library.viewers.livedemo.ViewersQueries"/>
+ <group group="org.eclipse.viatra.query.runtime.extensibility.SingletonExtensionFactory:library.viewers.livedemo.ViewersQueries" id="library.viewers.livedemo.ViewersQueries">
+ <query-specification fqn="library.viewers.livedemo.writer"/>
+ <query-specification fqn="library.viewers.livedemo.influencedBy"/>
+ </group>
</extension>
</plugin>
diff --git a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/.classpath b/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/.classpath
index 0c22b5d..f0c5549 100644
--- a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/.classpath
+++ b/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="src-gen"/>
diff --git a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/.settings/org.eclipse.jdt.core.prefs b/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/.settings/org.eclipse.jdt.core.prefs
index c537b63..0c68a61 100644
--- a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/.settings/org.eclipse.jdt.core.prefs
+++ b/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/.settings/org.eclipse.jdt.core.prefs
@@ -1,7 +1,7 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/META-INF/MANIFEST.MF b/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/META-INF/MANIFEST.MF
index b502fd6..8fda354 100644
--- a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/META-INF/MANIFEST.MF
+++ b/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/META-INF/MANIFEST.MF
@@ -4,12 +4,11 @@
Bundle-SymbolicName: org.eclipse.viatra.query.runtime.runonce.tests;singleton:=true
Bundle-Version: 0.8.0.qualifier
Bundle-Vendor: Eclipse VIATRA Project
-Export-Package: org.eclipse.viatra.query.runtime.runonce.tests,
- org.eclipse.viatra.query.runtime.runonce.tests.util
+Export-Package: org.eclipse.viatra.query.runtime.runonce.tests
Require-Bundle: org.eclipse.viatra.examples.library,
- org.junit,
- org.eclipse.emf.ecore,
- org.eclipse.xtext.xbase.lib;bundle-version="2.5.0",
- org.eclipse.viatra.query.runtime
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+ org.junit,
+ org.eclipse.emf.ecore,
+ org.eclipse.xtext.xbase.lib;bundle-version="2.5.0",
+ org.eclipse.viatra.query.runtime
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Import-Package: org.apache.log4j
diff --git a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/plugin.xml b/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/plugin.xml
index 4edea49..e8fbb1e 100644
--- a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/plugin.xml
+++ b/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/plugin.xml
@@ -1,5 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?><plugin>
<extension id="org.eclipse.viatra.query.runtime.runonce.tests.Eiqlibrary" point="org.eclipse.viatra.query.runtime.queryspecification">
- <group group="org.eclipse.viatra.query.runtime.extensibility.SingletonExtensionFactory:org.eclipse.viatra.query.runtime.runonce.tests.Eiqlibrary" id="org.eclipse.viatra.query.runtime.runonce.tests.Eiqlibrary"/>
+ <group group="org.eclipse.viatra.query.runtime.extensibility.SingletonExtensionFactory:org.eclipse.viatra.query.runtime.runonce.tests.Eiqlibrary" id="org.eclipse.viatra.query.runtime.runonce.tests.Eiqlibrary">
+ <query-specification fqn="org.eclipse.viatra.query.runtime.runonce.tests.bookAuthors"/>
+ <query-specification fqn="org.eclipse.viatra.query.runtime.runonce.tests.booksWithMultipleAuthors"/>
+ <query-specification fqn="org.eclipse.viatra.query.runtime.runonce.tests.sumOfPagesInLibrary"/>
+ <query-specification fqn="org.eclipse.viatra.query.runtime.runonce.tests.singleAuthoredFirstBooks"/>
+ <query-specification fqn="org.eclipse.viatra.query.runtime.runonce.tests.longSciFiBooksOfAuthor"/>
+ <query-specification fqn="org.eclipse.viatra.query.runtime.runonce.tests.requestCountOfLibrary"/>
+ <query-specification fqn="org.eclipse.viatra.query.runtime.runonce.tests.someBooksWithTwoAuthors"/>
+ </group>
</extension>
</plugin>
diff --git a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/.gitignore b/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/.gitignore
new file mode 100644
index 0000000..c96a04f
--- /dev/null
+++ b/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/.gitignore
@@ -0,0 +1,2 @@
+*
+!.gitignore
\ No newline at end of file
diff --git a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/.gitignore b/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/.gitignore
deleted file mode 100644
index ef5710f..0000000
--- a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/.gitignore
+++ /dev/null
@@ -1,15 +0,0 @@
-/.BookAuthorsMatch.java._trace
-/.BookAuthorsMatcher.java._trace
-/.BooksWithMultipleAuthorsMatch.java._trace
-/.BooksWithMultipleAuthorsMatcher.java._trace
-/.SingleAuthoredFirstBooksMatch.java._trace
-/.SumOfPagesInLibraryMatch.java._trace
-/.SumOfPagesInLibraryMatcher.java._trace
-/.SingleAuthoredFirstBooksMatcher.java._trace
-/.Eiqlibrary.java._trace
-/.LongSciFiBooksOfAuthorMatch.java._trace
-/.LongSciFiBooksOfAuthorMatcher.java._trace
-/.RequestCountOfLibraryMatch.java._trace
-/.RequestCountOfLibraryMatcher.java._trace
-/.SomeBooksWithTwoAuthorsMatch.java._trace
-/.SomeBooksWithTwoAuthorsMatcher.java._trace
diff --git a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/BookAuthorsMatch.java b/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/BookAuthorsMatch.java
deleted file mode 100644
index 2e2277a..0000000
--- a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/BookAuthorsMatch.java
+++ /dev/null
@@ -1,208 +0,0 @@
-package org.eclipse.viatra.query.runtime.runonce.tests;
-
-import java.util.Arrays;
-import java.util.List;
-import org.eclipse.viatra.examples.library.Book;
-import org.eclipse.viatra.examples.library.Writer;
-import org.eclipse.viatra.query.runtime.api.IPatternMatch;
-import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
-import org.eclipse.viatra.query.runtime.exception.ViatraQueryException;
-import org.eclipse.viatra.query.runtime.runonce.tests.util.BookAuthorsQuerySpecification;
-
-/**
- * Pattern-specific match representation of the org.eclipse.viatra.query.runtime.runonce.tests.bookAuthors pattern,
- * to be used in conjunction with {@link BookAuthorsMatcher}.
- *
- * <p>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 BookAuthorsMatcher
- * @see BookAuthorsProcessor
- *
- */
-@SuppressWarnings("all")
-public abstract class BookAuthorsMatch extends BasePatternMatch {
- private Book fBook;
-
- private Writer fAuthor;
-
- private static List<String> parameterNames = makeImmutableList("book", "author");
-
- private BookAuthorsMatch(final Book pBook, final Writer pAuthor) {
- this.fBook = pBook;
- this.fAuthor = pAuthor;
- }
-
- @Override
- public Object get(final String parameterName) {
- if ("book".equals(parameterName)) return this.fBook;
- if ("author".equals(parameterName)) return this.fAuthor;
- return null;
- }
-
- public Book getBook() {
- return this.fBook;
- }
-
- public Writer getAuthor() {
- return this.fAuthor;
- }
-
- @Override
- public boolean set(final String parameterName, final Object newValue) {
- if (!isMutable()) throw new java.lang.UnsupportedOperationException();
- if ("book".equals(parameterName) ) {
- this.fBook = (Book) newValue;
- return true;
- }
- if ("author".equals(parameterName) ) {
- this.fAuthor = (Writer) newValue;
- return true;
- }
- return false;
- }
-
- public void setBook(final Book pBook) {
- if (!isMutable()) throw new java.lang.UnsupportedOperationException();
- this.fBook = pBook;
- }
-
- public void setAuthor(final Writer pAuthor) {
- if (!isMutable()) throw new java.lang.UnsupportedOperationException();
- this.fAuthor = pAuthor;
- }
-
- @Override
- public String patternName() {
- return "org.eclipse.viatra.query.runtime.runonce.tests.bookAuthors";
- }
-
- @Override
- public List<String> parameterNames() {
- return BookAuthorsMatch.parameterNames;
- }
-
- @Override
- public Object[] toArray() {
- return new Object[]{fBook, fAuthor};
- }
-
- @Override
- public BookAuthorsMatch toImmutable() {
- return isMutable() ? newMatch(fBook, fAuthor) : this;
- }
-
- @Override
- public String prettyPrint() {
- StringBuilder result = new StringBuilder();
- result.append("\"book\"=" + prettyPrintValue(fBook) + ", ");
-
- result.append("\"author\"=" + prettyPrintValue(fAuthor)
- );
- return result.toString();
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((fBook == null) ? 0 : fBook.hashCode());
- result = prime * result + ((fAuthor == null) ? 0 : fAuthor.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(final Object obj) {
- if (this == obj)
- return true;
- if (!(obj instanceof BookAuthorsMatch)) { // this should be infrequent
- if (obj == null) {
- return false;
- }
- if (!(obj instanceof IPatternMatch)) {
- return false;
- }
- IPatternMatch otherSig = (IPatternMatch) obj;
- if (!specification().equals(otherSig.specification()))
- return false;
- return Arrays.deepEquals(toArray(), otherSig.toArray());
- }
- BookAuthorsMatch other = (BookAuthorsMatch) obj;
- if (fBook == null) {if (other.fBook != null) return false;}
- else if (!fBook.equals(other.fBook)) return false;
- if (fAuthor == null) {if (other.fAuthor != null) return false;}
- else if (!fAuthor.equals(other.fAuthor)) return false;
- return true;
- }
-
- @Override
- public BookAuthorsQuerySpecification specification() {
- try {
- return BookAuthorsQuerySpecification.instance();
- } catch (ViatraQueryException ex) {
- // This cannot happen, as the match object can only be instantiated if the query specification exists
- throw new IllegalStateException (ex);
- }
- }
-
- /**
- * 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 BookAuthorsMatch newEmptyMatch() {
- return new Mutable(null, null);
- }
-
- /**
- * Returns a mutable (partial) match.
- * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
- *
- * @param pBook the fixed value of pattern parameter book, or null if not bound.
- * @param pAuthor the fixed value of pattern parameter author, or null if not bound.
- * @return the new, mutable (partial) match object.
- *
- */
- public static BookAuthorsMatch newMutableMatch(final Book pBook, final Writer pAuthor) {
- return new Mutable(pBook, pAuthor);
- }
-
- /**
- * Returns a new (partial) match.
- * This can be used e.g. to call the matcher with a partial match.
- * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
- * @param pBook the fixed value of pattern parameter book, or null if not bound.
- * @param pAuthor the fixed value of pattern parameter author, or null if not bound.
- * @return the (partial) match object.
- *
- */
- public static BookAuthorsMatch newMatch(final Book pBook, final Writer pAuthor) {
- return new Immutable(pBook, pAuthor);
- }
-
- private static final class Mutable extends BookAuthorsMatch {
- Mutable(final Book pBook, final Writer pAuthor) {
- super(pBook, pAuthor);
- }
-
- @Override
- public boolean isMutable() {
- return true;
- }
- }
-
- private static final class Immutable extends BookAuthorsMatch {
- Immutable(final Book pBook, final Writer pAuthor) {
- super(pBook, pAuthor);
- }
-
- @Override
- public boolean isMutable() {
- return false;
- }
- }
-}
diff --git a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/BookAuthorsMatcher.java b/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/BookAuthorsMatcher.java
deleted file mode 100644
index 2be74ad..0000000
--- a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/BookAuthorsMatcher.java
+++ /dev/null
@@ -1,281 +0,0 @@
-package org.eclipse.viatra.query.runtime.runonce.tests;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-import org.apache.log4j.Logger;
-import org.eclipse.viatra.examples.library.Book;
-import org.eclipse.viatra.examples.library.Writer;
-import org.eclipse.viatra.query.runtime.api.IMatchProcessor;
-import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
-import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
-import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
-import org.eclipse.viatra.query.runtime.exception.ViatraQueryException;
-import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
-import org.eclipse.viatra.query.runtime.runonce.tests.BookAuthorsMatch;
-import org.eclipse.viatra.query.runtime.runonce.tests.util.BookAuthorsQuerySpecification;
-import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
-
-/**
- * Generated pattern matcher API of the org.eclipse.viatra.query.runtime.runonce.tests.bookAuthors pattern,
- * providing pattern-specific query methods.
- *
- * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
- * e.g. in conjunction with {@link ViatraQueryEngine#on(Notifier)}.
- *
- * <p>Matches of the pattern will be represented as {@link BookAuthorsMatch}.
- *
- * <p>Original source:
- * <code><pre>
- * pattern bookAuthors(book : Book, author : Writer) {
- * Book.authors(book, author);
- * }
- * </pre></code>
- *
- * @see BookAuthorsMatch
- * @see BookAuthorsProcessor
- * @see BookAuthorsQuerySpecification
- *
- */
-@SuppressWarnings("all")
-public class BookAuthorsMatcher extends BaseMatcher<BookAuthorsMatch> {
- /**
- * 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.
- * The match set will be incrementally refreshed upon updates.
- * @param engine the existing VIATRA Query engine in which this matcher will be created.
- * @throws ViatraQueryException if an error occurs during pattern matcher creation
- *
- */
- public static BookAuthorsMatcher on(final ViatraQueryEngine engine) throws ViatraQueryException {
- // check if matcher already exists
- BookAuthorsMatcher matcher = engine.getExistingMatcher(querySpecification());
- if (matcher == null) {
- matcher = new BookAuthorsMatcher(engine);
- // do not have to "put" it into engine.matchers, reportMatcherInitialized() will take care of it
- }
- return matcher;
- }
-
- private final static int POSITION_BOOK = 0;
-
- private final static int POSITION_AUTHOR = 1;
-
- private final static Logger LOGGER = ViatraQueryLoggingUtil.getLogger(BookAuthorsMatcher.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.
- * The match set will be incrementally refreshed upon updates.
- * @param engine the existing VIATRA Query engine in which this matcher will be created.
- * @throws ViatraQueryException if an error occurs during pattern matcher creation
- *
- */
- private BookAuthorsMatcher(final ViatraQueryEngine engine) throws ViatraQueryException {
- super(engine, querySpecification());
- }
-
- /**
- * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
- * @param pBook the fixed value of pattern parameter book, or null if not bound.
- * @param pAuthor the fixed value of pattern parameter author, or null if not bound.
- * @return matches represented as a BookAuthorsMatch object.
- *
- */
- public Collection<BookAuthorsMatch> getAllMatches(final Book pBook, final Writer pAuthor) {
- return rawGetAllMatches(new Object[]{pBook, pAuthor});
- }
-
- /**
- * 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 pBook the fixed value of pattern parameter book, or null if not bound.
- * @param pAuthor the fixed value of pattern parameter author, or null if not bound.
- * @return a match represented as a BookAuthorsMatch object, or null if no match is found.
- *
- */
- public BookAuthorsMatch getOneArbitraryMatch(final Book pBook, final Writer pAuthor) {
- return rawGetOneArbitraryMatch(new Object[]{pBook, pAuthor});
- }
-
- /**
- * 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 pBook the fixed value of pattern parameter book, or null if not bound.
- * @param pAuthor the fixed value of pattern parameter author, or null if not bound.
- * @return true if the input is a valid (partial) match of the pattern.
- *
- */
- public boolean hasMatch(final Book pBook, final Writer pAuthor) {
- return rawHasMatch(new Object[]{pBook, pAuthor});
- }
-
- /**
- * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
- * @param pBook the fixed value of pattern parameter book, or null if not bound.
- * @param pAuthor the fixed value of pattern parameter author, or null if not bound.
- * @return the number of pattern matches found.
- *
- */
- public int countMatches(final Book pBook, final Writer pAuthor) {
- return rawCountMatches(new Object[]{pBook, pAuthor});
- }
-
- /**
- * Executes the given processor on each match of the pattern that conforms to the given fixed values of some parameters.
- * @param pBook the fixed value of pattern parameter book, or null if not bound.
- * @param pAuthor the fixed value of pattern parameter author, or null if not bound.
- * @param processor the action that will process each pattern match.
- *
- */
- public void forEachMatch(final Book pBook, final Writer pAuthor, final IMatchProcessor<? super BookAuthorsMatch> processor) {
- rawForEachMatch(new Object[]{pBook, pAuthor}, processor);
- }
-
- /**
- * 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 pBook the fixed value of pattern parameter book, or null if not bound.
- * @param pAuthor the fixed value of pattern parameter author, 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 Book pBook, final Writer pAuthor, final IMatchProcessor<? super BookAuthorsMatch> processor) {
- return rawForOneArbitraryMatch(new Object[]{pBook, pAuthor}, processor);
- }
-
- /**
- * Returns a new (partial) match.
- * This can be used e.g. to call the matcher with a partial match.
- * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
- * @param pBook the fixed value of pattern parameter book, or null if not bound.
- * @param pAuthor the fixed value of pattern parameter author, or null if not bound.
- * @return the (partial) match object.
- *
- */
- public BookAuthorsMatch newMatch(final Book pBook, final Writer pAuthor) {
- return BookAuthorsMatch.newMatch(pBook, pAuthor);
- }
-
- /**
- * Retrieve the set of values that occur in matches for book.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- protected Set<Book> rawAccumulateAllValuesOfbook(final Object[] parameters) {
- Set<Book> results = new HashSet<Book>();
- rawAccumulateAllValues(POSITION_BOOK, parameters, results);
- return results;
- }
-
- /**
- * Retrieve the set of values that occur in matches for book.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<Book> getAllValuesOfbook() {
- return rawAccumulateAllValuesOfbook(emptyArray());
- }
-
- /**
- * Retrieve the set of values that occur in matches for book.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<Book> getAllValuesOfbook(final BookAuthorsMatch partialMatch) {
- return rawAccumulateAllValuesOfbook(partialMatch.toArray());
- }
-
- /**
- * Retrieve the set of values that occur in matches for book.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<Book> getAllValuesOfbook(final Writer pAuthor) {
- return rawAccumulateAllValuesOfbook(new Object[]{
- null,
- pAuthor
- });
- }
-
- /**
- * Retrieve the set of values that occur in matches for author.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- protected Set<Writer> rawAccumulateAllValuesOfauthor(final Object[] parameters) {
- Set<Writer> results = new HashSet<Writer>();
- rawAccumulateAllValues(POSITION_AUTHOR, parameters, results);
- return results;
- }
-
- /**
- * Retrieve the set of values that occur in matches for author.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<Writer> getAllValuesOfauthor() {
- return rawAccumulateAllValuesOfauthor(emptyArray());
- }
-
- /**
- * Retrieve the set of values that occur in matches for author.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<Writer> getAllValuesOfauthor(final BookAuthorsMatch partialMatch) {
- return rawAccumulateAllValuesOfauthor(partialMatch.toArray());
- }
-
- /**
- * Retrieve the set of values that occur in matches for author.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<Writer> getAllValuesOfauthor(final Book pBook) {
- return rawAccumulateAllValuesOfauthor(new Object[]{
- pBook,
- null
- });
- }
-
- @Override
- protected BookAuthorsMatch tupleToMatch(final Tuple t) {
- try {
- return BookAuthorsMatch.newMatch((Book) t.get(POSITION_BOOK), (Writer) t.get(POSITION_AUTHOR));
- } catch(ClassCastException e) {
- LOGGER.error("Element(s) in tuple not properly typed!",e);
- return null;
- }
- }
-
- @Override
- protected BookAuthorsMatch arrayToMatch(final Object[] match) {
- try {
- return BookAuthorsMatch.newMatch((Book) match[POSITION_BOOK], (Writer) match[POSITION_AUTHOR]);
- } catch(ClassCastException e) {
- LOGGER.error("Element(s) in array not properly typed!",e);
- return null;
- }
- }
-
- @Override
- protected BookAuthorsMatch arrayToMatchMutable(final Object[] match) {
- try {
- return BookAuthorsMatch.newMutableMatch((Book) match[POSITION_BOOK], (Writer) match[POSITION_AUTHOR]);
- } 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 ViatraQueryException if the pattern definition could not be loaded
- *
- */
- public static IQuerySpecification<BookAuthorsMatcher> querySpecification() throws ViatraQueryException {
- return BookAuthorsQuerySpecification.instance();
- }
-}
diff --git a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/BooksWithMultipleAuthorsMatch.java b/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/BooksWithMultipleAuthorsMatch.java
deleted file mode 100644
index ec26c2d..0000000
--- a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/BooksWithMultipleAuthorsMatch.java
+++ /dev/null
@@ -1,183 +0,0 @@
-package org.eclipse.viatra.query.runtime.runonce.tests;
-
-import java.util.Arrays;
-import java.util.List;
-import org.eclipse.viatra.examples.library.Book;
-import org.eclipse.viatra.query.runtime.api.IPatternMatch;
-import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
-import org.eclipse.viatra.query.runtime.exception.ViatraQueryException;
-import org.eclipse.viatra.query.runtime.runonce.tests.util.BooksWithMultipleAuthorsQuerySpecification;
-
-/**
- * Pattern-specific match representation of the org.eclipse.viatra.query.runtime.runonce.tests.booksWithMultipleAuthors pattern,
- * to be used in conjunction with {@link BooksWithMultipleAuthorsMatcher}.
- *
- * <p>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 BooksWithMultipleAuthorsMatcher
- * @see BooksWithMultipleAuthorsProcessor
- *
- */
-@SuppressWarnings("all")
-public abstract class BooksWithMultipleAuthorsMatch extends BasePatternMatch {
- private Book fBook;
-
- private static List<String> parameterNames = makeImmutableList("book");
-
- private BooksWithMultipleAuthorsMatch(final Book pBook) {
- this.fBook = pBook;
- }
-
- @Override
- public Object get(final String parameterName) {
- if ("book".equals(parameterName)) return this.fBook;
- return null;
- }
-
- public Book getBook() {
- return this.fBook;
- }
-
- @Override
- public boolean set(final String parameterName, final Object newValue) {
- if (!isMutable()) throw new java.lang.UnsupportedOperationException();
- if ("book".equals(parameterName) ) {
- this.fBook = (Book) newValue;
- return true;
- }
- return false;
- }
-
- public void setBook(final Book pBook) {
- if (!isMutable()) throw new java.lang.UnsupportedOperationException();
- this.fBook = pBook;
- }
-
- @Override
- public String patternName() {
- return "org.eclipse.viatra.query.runtime.runonce.tests.booksWithMultipleAuthors";
- }
-
- @Override
- public List<String> parameterNames() {
- return BooksWithMultipleAuthorsMatch.parameterNames;
- }
-
- @Override
- public Object[] toArray() {
- return new Object[]{fBook};
- }
-
- @Override
- public BooksWithMultipleAuthorsMatch toImmutable() {
- return isMutable() ? newMatch(fBook) : this;
- }
-
- @Override
- public String prettyPrint() {
- StringBuilder result = new StringBuilder();
- result.append("\"book\"=" + prettyPrintValue(fBook)
- );
- return result.toString();
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((fBook == null) ? 0 : fBook.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(final Object obj) {
- if (this == obj)
- return true;
- if (!(obj instanceof BooksWithMultipleAuthorsMatch)) { // this should be infrequent
- if (obj == null) {
- return false;
- }
- if (!(obj instanceof IPatternMatch)) {
- return false;
- }
- IPatternMatch otherSig = (IPatternMatch) obj;
- if (!specification().equals(otherSig.specification()))
- return false;
- return Arrays.deepEquals(toArray(), otherSig.toArray());
- }
- BooksWithMultipleAuthorsMatch other = (BooksWithMultipleAuthorsMatch) obj;
- if (fBook == null) {if (other.fBook != null) return false;}
- else if (!fBook.equals(other.fBook)) return false;
- return true;
- }
-
- @Override
- public BooksWithMultipleAuthorsQuerySpecification specification() {
- try {
- return BooksWithMultipleAuthorsQuerySpecification.instance();
- } catch (ViatraQueryException ex) {
- // This cannot happen, as the match object can only be instantiated if the query specification exists
- throw new IllegalStateException (ex);
- }
- }
-
- /**
- * 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 BooksWithMultipleAuthorsMatch 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 pBook the fixed value of pattern parameter book, or null if not bound.
- * @return the new, mutable (partial) match object.
- *
- */
- public static BooksWithMultipleAuthorsMatch newMutableMatch(final Book pBook) {
- return new Mutable(pBook);
- }
-
- /**
- * Returns a new (partial) match.
- * This can be used e.g. to call the matcher with a partial match.
- * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
- * @param pBook the fixed value of pattern parameter book, or null if not bound.
- * @return the (partial) match object.
- *
- */
- public static BooksWithMultipleAuthorsMatch newMatch(final Book pBook) {
- return new Immutable(pBook);
- }
-
- private static final class Mutable extends BooksWithMultipleAuthorsMatch {
- Mutable(final Book pBook) {
- super(pBook);
- }
-
- @Override
- public boolean isMutable() {
- return true;
- }
- }
-
- private static final class Immutable extends BooksWithMultipleAuthorsMatch {
- Immutable(final Book pBook) {
- super(pBook);
- }
-
- @Override
- public boolean isMutable() {
- return false;
- }
- }
-}
diff --git a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/BooksWithMultipleAuthorsMatcher.java b/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/BooksWithMultipleAuthorsMatcher.java
deleted file mode 100644
index 3bb7904..0000000
--- a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/BooksWithMultipleAuthorsMatcher.java
+++ /dev/null
@@ -1,211 +0,0 @@
-package org.eclipse.viatra.query.runtime.runonce.tests;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-import org.apache.log4j.Logger;
-import org.eclipse.viatra.examples.library.Book;
-import org.eclipse.viatra.query.runtime.api.IMatchProcessor;
-import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
-import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
-import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
-import org.eclipse.viatra.query.runtime.exception.ViatraQueryException;
-import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
-import org.eclipse.viatra.query.runtime.runonce.tests.BooksWithMultipleAuthorsMatch;
-import org.eclipse.viatra.query.runtime.runonce.tests.util.BooksWithMultipleAuthorsQuerySpecification;
-import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
-
-/**
- * Generated pattern matcher API of the org.eclipse.viatra.query.runtime.runonce.tests.booksWithMultipleAuthors pattern,
- * providing pattern-specific query methods.
- *
- * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
- * e.g. in conjunction with {@link ViatraQueryEngine#on(Notifier)}.
- *
- * <p>Matches of the pattern will be represented as {@link BooksWithMultipleAuthorsMatch}.
- *
- * <p>Original source:
- * <code><pre>
- * pattern booksWithMultipleAuthors(book : Book) {
- * Book(book);
- * numberOfBooks == count find bookAuthors(book, _author);
- * check(numberOfBooks {@literal >} 1);
- * }
- * </pre></code>
- *
- * @see BooksWithMultipleAuthorsMatch
- * @see BooksWithMultipleAuthorsProcessor
- * @see BooksWithMultipleAuthorsQuerySpecification
- *
- */
-@SuppressWarnings("all")
-public class BooksWithMultipleAuthorsMatcher extends BaseMatcher<BooksWithMultipleAuthorsMatch> {
- /**
- * 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.
- * The match set will be incrementally refreshed upon updates.
- * @param engine the existing VIATRA Query engine in which this matcher will be created.
- * @throws ViatraQueryException if an error occurs during pattern matcher creation
- *
- */
- public static BooksWithMultipleAuthorsMatcher on(final ViatraQueryEngine engine) throws ViatraQueryException {
- // check if matcher already exists
- BooksWithMultipleAuthorsMatcher matcher = engine.getExistingMatcher(querySpecification());
- if (matcher == null) {
- matcher = new BooksWithMultipleAuthorsMatcher(engine);
- // do not have to "put" it into engine.matchers, reportMatcherInitialized() will take care of it
- }
- return matcher;
- }
-
- private final static int POSITION_BOOK = 0;
-
- private final static Logger LOGGER = ViatraQueryLoggingUtil.getLogger(BooksWithMultipleAuthorsMatcher.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.
- * The match set will be incrementally refreshed upon updates.
- * @param engine the existing VIATRA Query engine in which this matcher will be created.
- * @throws ViatraQueryException if an error occurs during pattern matcher creation
- *
- */
- private BooksWithMultipleAuthorsMatcher(final ViatraQueryEngine engine) throws ViatraQueryException {
- super(engine, querySpecification());
- }
-
- /**
- * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
- * @param pBook the fixed value of pattern parameter book, or null if not bound.
- * @return matches represented as a BooksWithMultipleAuthorsMatch object.
- *
- */
- public Collection<BooksWithMultipleAuthorsMatch> getAllMatches(final Book pBook) {
- return rawGetAllMatches(new Object[]{pBook});
- }
-
- /**
- * 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 pBook the fixed value of pattern parameter book, or null if not bound.
- * @return a match represented as a BooksWithMultipleAuthorsMatch object, or null if no match is found.
- *
- */
- public BooksWithMultipleAuthorsMatch getOneArbitraryMatch(final Book pBook) {
- return rawGetOneArbitraryMatch(new Object[]{pBook});
- }
-
- /**
- * 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 pBook the fixed value of pattern parameter book, or null if not bound.
- * @return true if the input is a valid (partial) match of the pattern.
- *
- */
- public boolean hasMatch(final Book pBook) {
- return rawHasMatch(new Object[]{pBook});
- }
-
- /**
- * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
- * @param pBook the fixed value of pattern parameter book, or null if not bound.
- * @return the number of pattern matches found.
- *
- */
- public int countMatches(final Book pBook) {
- return rawCountMatches(new Object[]{pBook});
- }
-
- /**
- * Executes the given processor on each match of the pattern that conforms to the given fixed values of some parameters.
- * @param pBook the fixed value of pattern parameter book, or null if not bound.
- * @param processor the action that will process each pattern match.
- *
- */
- public void forEachMatch(final Book pBook, final IMatchProcessor<? super BooksWithMultipleAuthorsMatch> processor) {
- rawForEachMatch(new Object[]{pBook}, processor);
- }
-
- /**
- * 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 pBook the fixed value of pattern parameter book, 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 Book pBook, final IMatchProcessor<? super BooksWithMultipleAuthorsMatch> processor) {
- return rawForOneArbitraryMatch(new Object[]{pBook}, processor);
- }
-
- /**
- * Returns a new (partial) match.
- * This can be used e.g. to call the matcher with a partial match.
- * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
- * @param pBook the fixed value of pattern parameter book, or null if not bound.
- * @return the (partial) match object.
- *
- */
- public BooksWithMultipleAuthorsMatch newMatch(final Book pBook) {
- return BooksWithMultipleAuthorsMatch.newMatch(pBook);
- }
-
- /**
- * Retrieve the set of values that occur in matches for book.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- protected Set<Book> rawAccumulateAllValuesOfbook(final Object[] parameters) {
- Set<Book> results = new HashSet<Book>();
- rawAccumulateAllValues(POSITION_BOOK, parameters, results);
- return results;
- }
-
- /**
- * Retrieve the set of values that occur in matches for book.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<Book> getAllValuesOfbook() {
- return rawAccumulateAllValuesOfbook(emptyArray());
- }
-
- @Override
- protected BooksWithMultipleAuthorsMatch tupleToMatch(final Tuple t) {
- try {
- return BooksWithMultipleAuthorsMatch.newMatch((Book) t.get(POSITION_BOOK));
- } catch(ClassCastException e) {
- LOGGER.error("Element(s) in tuple not properly typed!",e);
- return null;
- }
- }
-
- @Override
- protected BooksWithMultipleAuthorsMatch arrayToMatch(final Object[] match) {
- try {
- return BooksWithMultipleAuthorsMatch.newMatch((Book) match[POSITION_BOOK]);
- } catch(ClassCastException e) {
- LOGGER.error("Element(s) in array not properly typed!",e);
- return null;
- }
- }
-
- @Override
- protected BooksWithMultipleAuthorsMatch arrayToMatchMutable(final Object[] match) {
- try {
- return BooksWithMultipleAuthorsMatch.newMutableMatch((Book) match[POSITION_BOOK]);
- } 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 ViatraQueryException if the pattern definition could not be loaded
- *
- */
- public static IQuerySpecification<BooksWithMultipleAuthorsMatcher> querySpecification() throws ViatraQueryException {
- return BooksWithMultipleAuthorsQuerySpecification.instance();
- }
-}
diff --git a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/Eiqlibrary.java b/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/Eiqlibrary.java
index d77871f..43c773d 100644
--- a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/Eiqlibrary.java
+++ b/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/Eiqlibrary.java
@@ -1,27 +1,22 @@
+/**
+ * Generated from platform:/resource/org.eclipse.viatra.query.runtime.runonce.tests/src/org/eclipse/viatra/query/runtime/runonce/tests/eiqlibrary.vql
+ */
package org.eclipse.viatra.query.runtime.runonce.tests;
import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedPatternGroup;
-import org.eclipse.viatra.query.runtime.exception.ViatraQueryException;
-import org.eclipse.viatra.query.runtime.runonce.tests.BookAuthorsMatcher;
-import org.eclipse.viatra.query.runtime.runonce.tests.BooksWithMultipleAuthorsMatcher;
-import org.eclipse.viatra.query.runtime.runonce.tests.LongSciFiBooksOfAuthorMatcher;
-import org.eclipse.viatra.query.runtime.runonce.tests.RequestCountOfLibraryMatcher;
-import org.eclipse.viatra.query.runtime.runonce.tests.SingleAuthoredFirstBooksMatcher;
-import org.eclipse.viatra.query.runtime.runonce.tests.SomeBooksWithTwoAuthorsMatcher;
-import org.eclipse.viatra.query.runtime.runonce.tests.SumOfPagesInLibraryMatcher;
-import org.eclipse.viatra.query.runtime.runonce.tests.util.BookAuthorsQuerySpecification;
-import org.eclipse.viatra.query.runtime.runonce.tests.util.BooksWithMultipleAuthorsQuerySpecification;
-import org.eclipse.viatra.query.runtime.runonce.tests.util.LongSciFiBooksOfAuthorQuerySpecification;
-import org.eclipse.viatra.query.runtime.runonce.tests.util.RequestCountOfLibraryQuerySpecification;
-import org.eclipse.viatra.query.runtime.runonce.tests.util.SingleAuthoredFirstBooksQuerySpecification;
-import org.eclipse.viatra.query.runtime.runonce.tests.util.SomeBooksWithTwoAuthorsQuerySpecification;
-import org.eclipse.viatra.query.runtime.runonce.tests.util.SumOfPagesInLibraryQuerySpecification;
+import org.eclipse.viatra.query.runtime.runonce.tests.BookAuthors;
+import org.eclipse.viatra.query.runtime.runonce.tests.BooksWithMultipleAuthors;
+import org.eclipse.viatra.query.runtime.runonce.tests.LongSciFiBooksOfAuthor;
+import org.eclipse.viatra.query.runtime.runonce.tests.RequestCountOfLibrary;
+import org.eclipse.viatra.query.runtime.runonce.tests.SingleAuthoredFirstBooks;
+import org.eclipse.viatra.query.runtime.runonce.tests.SomeBooksWithTwoAuthors;
+import org.eclipse.viatra.query.runtime.runonce.tests.SumOfPagesInLibrary;
/**
- * A pattern group formed of all patterns defined in eiqlibrary.vql.
+ * A pattern group formed of all public patterns defined in eiqlibrary.vql.
*
- * <p>Use the static instance as any {@link org.eclipse.viatra.query.runtime.api.IPatternGroup}, to conveniently prepare
+ * <p>Use the static instance as any {@link interface org.eclipse.viatra.query.runtime.api.IQueryGroup}, to conveniently prepare
* a VIATRA Query engine for matching all patterns originally defined in file eiqlibrary.vql,
* in order to achieve better performance than one-by-one on-demand matcher initialization.
*
@@ -35,7 +30,7 @@
* <li>someBooksWithTwoAuthors</li>
* </ul>
*
- * @see IPatternGroup
+ * @see IQueryGroup
*
*/
@SuppressWarnings("all")
@@ -44,81 +39,81 @@
* Access the pattern group.
*
* @return the singleton instance of the group
- * @throws ViatraQueryException if there was an error loading the generated code of pattern specifications
+ * @throws ViatraQueryRuntimeException if there was an error loading the generated code of pattern specifications
*
*/
- public static Eiqlibrary instance() throws ViatraQueryException {
+ public static Eiqlibrary instance() {
if (INSTANCE == null) {
- INSTANCE = new Eiqlibrary();
+ INSTANCE = new Eiqlibrary();
}
return INSTANCE;
}
private static Eiqlibrary INSTANCE;
- private Eiqlibrary() throws ViatraQueryException {
- querySpecifications.add(BookAuthorsQuerySpecification.instance());
- querySpecifications.add(BooksWithMultipleAuthorsQuerySpecification.instance());
- querySpecifications.add(SumOfPagesInLibraryQuerySpecification.instance());
- querySpecifications.add(SingleAuthoredFirstBooksQuerySpecification.instance());
- querySpecifications.add(LongSciFiBooksOfAuthorQuerySpecification.instance());
- querySpecifications.add(RequestCountOfLibraryQuerySpecification.instance());
- querySpecifications.add(SomeBooksWithTwoAuthorsQuerySpecification.instance());
+ private Eiqlibrary() {
+ querySpecifications.add(BookAuthors.instance());
+ querySpecifications.add(BooksWithMultipleAuthors.instance());
+ querySpecifications.add(SumOfPagesInLibrary.instance());
+ querySpecifications.add(SingleAuthoredFirstBooks.instance());
+ querySpecifications.add(LongSciFiBooksOfAuthor.instance());
+ querySpecifications.add(RequestCountOfLibrary.instance());
+ querySpecifications.add(SomeBooksWithTwoAuthors.instance());
}
- public BookAuthorsQuerySpecification getBookAuthors() throws ViatraQueryException {
- return BookAuthorsQuerySpecification.instance();
+ public BookAuthors getBookAuthors() {
+ return BookAuthors.instance();
}
- public BookAuthorsMatcher getBookAuthors(final ViatraQueryEngine engine) throws ViatraQueryException {
- return BookAuthorsMatcher.on(engine);
+ public BookAuthors.Matcher getBookAuthors(final ViatraQueryEngine engine) {
+ return BookAuthors.Matcher.on(engine);
}
- public BooksWithMultipleAuthorsQuerySpecification getBooksWithMultipleAuthors() throws ViatraQueryException {
- return BooksWithMultipleAuthorsQuerySpecification.instance();
+ public BooksWithMultipleAuthors getBooksWithMultipleAuthors() {
+ return BooksWithMultipleAuthors.instance();
}
- public BooksWithMultipleAuthorsMatcher getBooksWithMultipleAuthors(final ViatraQueryEngine engine) throws ViatraQueryException {
- return BooksWithMultipleAuthorsMatcher.on(engine);
+ public BooksWithMultipleAuthors.Matcher getBooksWithMultipleAuthors(final ViatraQueryEngine engine) {
+ return BooksWithMultipleAuthors.Matcher.on(engine);
}
- public SumOfPagesInLibraryQuerySpecification getSumOfPagesInLibrary() throws ViatraQueryException {
- return SumOfPagesInLibraryQuerySpecification.instance();
+ public SumOfPagesInLibrary getSumOfPagesInLibrary() {
+ return SumOfPagesInLibrary.instance();
}
- public SumOfPagesInLibraryMatcher getSumOfPagesInLibrary(final ViatraQueryEngine engine) throws ViatraQueryException {
- return SumOfPagesInLibraryMatcher.on(engine);
+ public SumOfPagesInLibrary.Matcher getSumOfPagesInLibrary(final ViatraQueryEngine engine) {
+ return SumOfPagesInLibrary.Matcher.on(engine);
}
- public SingleAuthoredFirstBooksQuerySpecification getSingleAuthoredFirstBooks() throws ViatraQueryException {
- return SingleAuthoredFirstBooksQuerySpecification.instance();
+ public SingleAuthoredFirstBooks getSingleAuthoredFirstBooks() {
+ return SingleAuthoredFirstBooks.instance();
}
- public SingleAuthoredFirstBooksMatcher getSingleAuthoredFirstBooks(final ViatraQueryEngine engine) throws ViatraQueryException {
- return SingleAuthoredFirstBooksMatcher.on(engine);
+ public SingleAuthoredFirstBooks.Matcher getSingleAuthoredFirstBooks(final ViatraQueryEngine engine) {
+ return SingleAuthoredFirstBooks.Matcher.on(engine);
}
- public LongSciFiBooksOfAuthorQuerySpecification getLongSciFiBooksOfAuthor() throws ViatraQueryException {
- return LongSciFiBooksOfAuthorQuerySpecification.instance();
+ public LongSciFiBooksOfAuthor getLongSciFiBooksOfAuthor() {
+ return LongSciFiBooksOfAuthor.instance();
}
- public LongSciFiBooksOfAuthorMatcher getLongSciFiBooksOfAuthor(final ViatraQueryEngine engine) throws ViatraQueryException {
- return LongSciFiBooksOfAuthorMatcher.on(engine);
+ public LongSciFiBooksOfAuthor.Matcher getLongSciFiBooksOfAuthor(final ViatraQueryEngine engine) {
+ return LongSciFiBooksOfAuthor.Matcher.on(engine);
}
- public RequestCountOfLibraryQuerySpecification getRequestCountOfLibrary() throws ViatraQueryException {
- return RequestCountOfLibraryQuerySpecification.instance();
+ public RequestCountOfLibrary getRequestCountOfLibrary() {
+ return RequestCountOfLibrary.instance();
}
- public RequestCountOfLibraryMatcher getRequestCountOfLibrary(final ViatraQueryEngine engine) throws ViatraQueryException {
- return RequestCountOfLibraryMatcher.on(engine);
+ public RequestCountOfLibrary.Matcher getRequestCountOfLibrary(final ViatraQueryEngine engine) {
+ return RequestCountOfLibrary.Matcher.on(engine);
}
- public SomeBooksWithTwoAuthorsQuerySpecification getSomeBooksWithTwoAuthors() throws ViatraQueryException {
- return SomeBooksWithTwoAuthorsQuerySpecification.instance();
+ public SomeBooksWithTwoAuthors getSomeBooksWithTwoAuthors() {
+ return SomeBooksWithTwoAuthors.instance();
}
- public SomeBooksWithTwoAuthorsMatcher getSomeBooksWithTwoAuthors(final ViatraQueryEngine engine) throws ViatraQueryException {
- return SomeBooksWithTwoAuthorsMatcher.on(engine);
+ public SomeBooksWithTwoAuthors.Matcher getSomeBooksWithTwoAuthors(final ViatraQueryEngine engine) {
+ return SomeBooksWithTwoAuthors.Matcher.on(engine);
}
}
diff --git a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/LongSciFiBooksOfAuthorMatch.java b/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/LongSciFiBooksOfAuthorMatch.java
deleted file mode 100644
index 2c52741..0000000
--- a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/LongSciFiBooksOfAuthorMatch.java
+++ /dev/null
@@ -1,208 +0,0 @@
-package org.eclipse.viatra.query.runtime.runonce.tests;
-
-import java.util.Arrays;
-import java.util.List;
-import org.eclipse.viatra.examples.library.Book;
-import org.eclipse.viatra.examples.library.Writer;
-import org.eclipse.viatra.query.runtime.api.IPatternMatch;
-import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
-import org.eclipse.viatra.query.runtime.exception.ViatraQueryException;
-import org.eclipse.viatra.query.runtime.runonce.tests.util.LongSciFiBooksOfAuthorQuerySpecification;
-
-/**
- * Pattern-specific match representation of the org.eclipse.viatra.query.runtime.runonce.tests.longSciFiBooksOfAuthor pattern,
- * to be used in conjunction with {@link LongSciFiBooksOfAuthorMatcher}.
- *
- * <p>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 LongSciFiBooksOfAuthorMatcher
- * @see LongSciFiBooksOfAuthorProcessor
- *
- */
-@SuppressWarnings("all")
-public abstract class LongSciFiBooksOfAuthorMatch extends BasePatternMatch {
- private Writer fAuthor;
-
- private Book fBook;
-
- private static List<String> parameterNames = makeImmutableList("author", "book");
-
- private LongSciFiBooksOfAuthorMatch(final Writer pAuthor, final Book pBook) {
- this.fAuthor = pAuthor;
- this.fBook = pBook;
- }
-
- @Override
- public Object get(final String parameterName) {
- if ("author".equals(parameterName)) return this.fAuthor;
- if ("book".equals(parameterName)) return this.fBook;
- return null;
- }
-
- public Writer getAuthor() {
- return this.fAuthor;
- }
-
- public Book getBook() {
- return this.fBook;
- }
-
- @Override
- public boolean set(final String parameterName, final Object newValue) {
- if (!isMutable()) throw new java.lang.UnsupportedOperationException();
- if ("author".equals(parameterName) ) {
- this.fAuthor = (Writer) newValue;
- return true;
- }
- if ("book".equals(parameterName) ) {
- this.fBook = (Book) newValue;
- return true;
- }
- return false;
- }
-
- public void setAuthor(final Writer pAuthor) {
- if (!isMutable()) throw new java.lang.UnsupportedOperationException();
- this.fAuthor = pAuthor;
- }
-
- public void setBook(final Book pBook) {
- if (!isMutable()) throw new java.lang.UnsupportedOperationException();
- this.fBook = pBook;
- }
-
- @Override
- public String patternName() {
- return "org.eclipse.viatra.query.runtime.runonce.tests.longSciFiBooksOfAuthor";
- }
-
- @Override
- public List<String> parameterNames() {
- return LongSciFiBooksOfAuthorMatch.parameterNames;
- }
-
- @Override
- public Object[] toArray() {
- return new Object[]{fAuthor, fBook};
- }
-
- @Override
- public LongSciFiBooksOfAuthorMatch toImmutable() {
- return isMutable() ? newMatch(fAuthor, fBook) : this;
- }
-
- @Override
- public String prettyPrint() {
- StringBuilder result = new StringBuilder();
- result.append("\"author\"=" + prettyPrintValue(fAuthor) + ", ");
-
- result.append("\"book\"=" + prettyPrintValue(fBook)
- );
- return result.toString();
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((fAuthor == null) ? 0 : fAuthor.hashCode());
- result = prime * result + ((fBook == null) ? 0 : fBook.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(final Object obj) {
- if (this == obj)
- return true;
- if (!(obj instanceof LongSciFiBooksOfAuthorMatch)) { // this should be infrequent
- if (obj == null) {
- return false;
- }
- if (!(obj instanceof IPatternMatch)) {
- return false;
- }
- IPatternMatch otherSig = (IPatternMatch) obj;
- if (!specification().equals(otherSig.specification()))
- return false;
- return Arrays.deepEquals(toArray(), otherSig.toArray());
- }
- LongSciFiBooksOfAuthorMatch other = (LongSciFiBooksOfAuthorMatch) obj;
- if (fAuthor == null) {if (other.fAuthor != null) return false;}
- else if (!fAuthor.equals(other.fAuthor)) return false;
- if (fBook == null) {if (other.fBook != null) return false;}
- else if (!fBook.equals(other.fBook)) return false;
- return true;
- }
-
- @Override
- public LongSciFiBooksOfAuthorQuerySpecification specification() {
- try {
- return LongSciFiBooksOfAuthorQuerySpecification.instance();
- } catch (ViatraQueryException ex) {
- // This cannot happen, as the match object can only be instantiated if the query specification exists
- throw new IllegalStateException (ex);
- }
- }
-
- /**
- * 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 LongSciFiBooksOfAuthorMatch newEmptyMatch() {
- return new Mutable(null, null);
- }
-
- /**
- * Returns a mutable (partial) match.
- * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
- *
- * @param pAuthor the fixed value of pattern parameter author, or null if not bound.
- * @param pBook the fixed value of pattern parameter book, or null if not bound.
- * @return the new, mutable (partial) match object.
- *
- */
- public static LongSciFiBooksOfAuthorMatch newMutableMatch(final Writer pAuthor, final Book pBook) {
- return new Mutable(pAuthor, pBook);
- }
-
- /**
- * Returns a new (partial) match.
- * This can be used e.g. to call the matcher with a partial match.
- * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
- * @param pAuthor the fixed value of pattern parameter author, or null if not bound.
- * @param pBook the fixed value of pattern parameter book, or null if not bound.
- * @return the (partial) match object.
- *
- */
- public static LongSciFiBooksOfAuthorMatch newMatch(final Writer pAuthor, final Book pBook) {
- return new Immutable(pAuthor, pBook);
- }
-
- private static final class Mutable extends LongSciFiBooksOfAuthorMatch {
- Mutable(final Writer pAuthor, final Book pBook) {
- super(pAuthor, pBook);
- }
-
- @Override
- public boolean isMutable() {
- return true;
- }
- }
-
- private static final class Immutable extends LongSciFiBooksOfAuthorMatch {
- Immutable(final Writer pAuthor, final Book pBook) {
- super(pAuthor, pBook);
- }
-
- @Override
- public boolean isMutable() {
- return false;
- }
- }
-}
diff --git a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/LongSciFiBooksOfAuthorMatcher.java b/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/LongSciFiBooksOfAuthorMatcher.java
deleted file mode 100644
index fdc7880..0000000
--- a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/LongSciFiBooksOfAuthorMatcher.java
+++ /dev/null
@@ -1,283 +0,0 @@
-package org.eclipse.viatra.query.runtime.runonce.tests;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-import org.apache.log4j.Logger;
-import org.eclipse.viatra.examples.library.Book;
-import org.eclipse.viatra.examples.library.Writer;
-import org.eclipse.viatra.query.runtime.api.IMatchProcessor;
-import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
-import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
-import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
-import org.eclipse.viatra.query.runtime.exception.ViatraQueryException;
-import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
-import org.eclipse.viatra.query.runtime.runonce.tests.LongSciFiBooksOfAuthorMatch;
-import org.eclipse.viatra.query.runtime.runonce.tests.util.LongSciFiBooksOfAuthorQuerySpecification;
-import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
-
-/**
- * Generated pattern matcher API of the org.eclipse.viatra.query.runtime.runonce.tests.longSciFiBooksOfAuthor pattern,
- * providing pattern-specific query methods.
- *
- * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
- * e.g. in conjunction with {@link ViatraQueryEngine#on(Notifier)}.
- *
- * <p>Matches of the pattern will be represented as {@link LongSciFiBooksOfAuthorMatch}.
- *
- * <p>Original source:
- * <code><pre>
- * pattern longSciFiBooksOfAuthor(author : Writer, book : Book) {
- * Writer.scifiBooks(author, book);
- * Book.pages(book, pages);
- * check(pages {@literal >} 100);
- * }
- * </pre></code>
- *
- * @see LongSciFiBooksOfAuthorMatch
- * @see LongSciFiBooksOfAuthorProcessor
- * @see LongSciFiBooksOfAuthorQuerySpecification
- *
- */
-@SuppressWarnings("all")
-public class LongSciFiBooksOfAuthorMatcher extends BaseMatcher<LongSciFiBooksOfAuthorMatch> {
- /**
- * 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.
- * The match set will be incrementally refreshed upon updates.
- * @param engine the existing VIATRA Query engine in which this matcher will be created.
- * @throws ViatraQueryException if an error occurs during pattern matcher creation
- *
- */
- public static LongSciFiBooksOfAuthorMatcher on(final ViatraQueryEngine engine) throws ViatraQueryException {
- // check if matcher already exists
- LongSciFiBooksOfAuthorMatcher matcher = engine.getExistingMatcher(querySpecification());
- if (matcher == null) {
- matcher = new LongSciFiBooksOfAuthorMatcher(engine);
- // do not have to "put" it into engine.matchers, reportMatcherInitialized() will take care of it
- }
- return matcher;
- }
-
- private final static int POSITION_AUTHOR = 0;
-
- private final static int POSITION_BOOK = 1;
-
- private final static Logger LOGGER = ViatraQueryLoggingUtil.getLogger(LongSciFiBooksOfAuthorMatcher.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.
- * The match set will be incrementally refreshed upon updates.
- * @param engine the existing VIATRA Query engine in which this matcher will be created.
- * @throws ViatraQueryException if an error occurs during pattern matcher creation
- *
- */
- private LongSciFiBooksOfAuthorMatcher(final ViatraQueryEngine engine) throws ViatraQueryException {
- super(engine, querySpecification());
- }
-
- /**
- * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
- * @param pAuthor the fixed value of pattern parameter author, or null if not bound.
- * @param pBook the fixed value of pattern parameter book, or null if not bound.
- * @return matches represented as a LongSciFiBooksOfAuthorMatch object.
- *
- */
- public Collection<LongSciFiBooksOfAuthorMatch> getAllMatches(final Writer pAuthor, final Book pBook) {
- return rawGetAllMatches(new Object[]{pAuthor, pBook});
- }
-
- /**
- * 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 pAuthor the fixed value of pattern parameter author, or null if not bound.
- * @param pBook the fixed value of pattern parameter book, or null if not bound.
- * @return a match represented as a LongSciFiBooksOfAuthorMatch object, or null if no match is found.
- *
- */
- public LongSciFiBooksOfAuthorMatch getOneArbitraryMatch(final Writer pAuthor, final Book pBook) {
- return rawGetOneArbitraryMatch(new Object[]{pAuthor, pBook});
- }
-
- /**
- * 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 pAuthor the fixed value of pattern parameter author, or null if not bound.
- * @param pBook the fixed value of pattern parameter book, or null if not bound.
- * @return true if the input is a valid (partial) match of the pattern.
- *
- */
- public boolean hasMatch(final Writer pAuthor, final Book pBook) {
- return rawHasMatch(new Object[]{pAuthor, pBook});
- }
-
- /**
- * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
- * @param pAuthor the fixed value of pattern parameter author, or null if not bound.
- * @param pBook the fixed value of pattern parameter book, or null if not bound.
- * @return the number of pattern matches found.
- *
- */
- public int countMatches(final Writer pAuthor, final Book pBook) {
- return rawCountMatches(new Object[]{pAuthor, pBook});
- }
-
- /**
- * Executes the given processor on each match of the pattern that conforms to the given fixed values of some parameters.
- * @param pAuthor the fixed value of pattern parameter author, or null if not bound.
- * @param pBook the fixed value of pattern parameter book, or null if not bound.
- * @param processor the action that will process each pattern match.
- *
- */
- public void forEachMatch(final Writer pAuthor, final Book pBook, final IMatchProcessor<? super LongSciFiBooksOfAuthorMatch> processor) {
- rawForEachMatch(new Object[]{pAuthor, pBook}, processor);
- }
-
- /**
- * 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 pAuthor the fixed value of pattern parameter author, or null if not bound.
- * @param pBook the fixed value of pattern parameter book, 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 Writer pAuthor, final Book pBook, final IMatchProcessor<? super LongSciFiBooksOfAuthorMatch> processor) {
- return rawForOneArbitraryMatch(new Object[]{pAuthor, pBook}, processor);
- }
-
- /**
- * Returns a new (partial) match.
- * This can be used e.g. to call the matcher with a partial match.
- * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
- * @param pAuthor the fixed value of pattern parameter author, or null if not bound.
- * @param pBook the fixed value of pattern parameter book, or null if not bound.
- * @return the (partial) match object.
- *
- */
- public LongSciFiBooksOfAuthorMatch newMatch(final Writer pAuthor, final Book pBook) {
- return LongSciFiBooksOfAuthorMatch.newMatch(pAuthor, pBook);
- }
-
- /**
- * Retrieve the set of values that occur in matches for author.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- protected Set<Writer> rawAccumulateAllValuesOfauthor(final Object[] parameters) {
- Set<Writer> results = new HashSet<Writer>();
- rawAccumulateAllValues(POSITION_AUTHOR, parameters, results);
- return results;
- }
-
- /**
- * Retrieve the set of values that occur in matches for author.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<Writer> getAllValuesOfauthor() {
- return rawAccumulateAllValuesOfauthor(emptyArray());
- }
-
- /**
- * Retrieve the set of values that occur in matches for author.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<Writer> getAllValuesOfauthor(final LongSciFiBooksOfAuthorMatch partialMatch) {
- return rawAccumulateAllValuesOfauthor(partialMatch.toArray());
- }
-
- /**
- * Retrieve the set of values that occur in matches for author.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<Writer> getAllValuesOfauthor(final Book pBook) {
- return rawAccumulateAllValuesOfauthor(new Object[]{
- null,
- pBook
- });
- }
-
- /**
- * Retrieve the set of values that occur in matches for book.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- protected Set<Book> rawAccumulateAllValuesOfbook(final Object[] parameters) {
- Set<Book> results = new HashSet<Book>();
- rawAccumulateAllValues(POSITION_BOOK, parameters, results);
- return results;
- }
-
- /**
- * Retrieve the set of values that occur in matches for book.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<Book> getAllValuesOfbook() {
- return rawAccumulateAllValuesOfbook(emptyArray());
- }
-
- /**
- * Retrieve the set of values that occur in matches for book.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<Book> getAllValuesOfbook(final LongSciFiBooksOfAuthorMatch partialMatch) {
- return rawAccumulateAllValuesOfbook(partialMatch.toArray());
- }
-
- /**
- * Retrieve the set of values that occur in matches for book.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<Book> getAllValuesOfbook(final Writer pAuthor) {
- return rawAccumulateAllValuesOfbook(new Object[]{
- pAuthor,
- null
- });
- }
-
- @Override
- protected LongSciFiBooksOfAuthorMatch tupleToMatch(final Tuple t) {
- try {
- return LongSciFiBooksOfAuthorMatch.newMatch((Writer) t.get(POSITION_AUTHOR), (Book) t.get(POSITION_BOOK));
- } catch(ClassCastException e) {
- LOGGER.error("Element(s) in tuple not properly typed!",e);
- return null;
- }
- }
-
- @Override
- protected LongSciFiBooksOfAuthorMatch arrayToMatch(final Object[] match) {
- try {
- return LongSciFiBooksOfAuthorMatch.newMatch((Writer) match[POSITION_AUTHOR], (Book) match[POSITION_BOOK]);
- } catch(ClassCastException e) {
- LOGGER.error("Element(s) in array not properly typed!",e);
- return null;
- }
- }
-
- @Override
- protected LongSciFiBooksOfAuthorMatch arrayToMatchMutable(final Object[] match) {
- try {
- return LongSciFiBooksOfAuthorMatch.newMutableMatch((Writer) match[POSITION_AUTHOR], (Book) match[POSITION_BOOK]);
- } 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 ViatraQueryException if the pattern definition could not be loaded
- *
- */
- public static IQuerySpecification<LongSciFiBooksOfAuthorMatcher> querySpecification() throws ViatraQueryException {
- return LongSciFiBooksOfAuthorQuerySpecification.instance();
- }
-}
diff --git a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/RequestCountOfLibraryMatch.java b/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/RequestCountOfLibraryMatch.java
deleted file mode 100644
index a468cb5..0000000
--- a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/RequestCountOfLibraryMatch.java
+++ /dev/null
@@ -1,207 +0,0 @@
-package org.eclipse.viatra.query.runtime.runonce.tests;
-
-import java.util.Arrays;
-import java.util.List;
-import org.eclipse.viatra.examples.library.Library;
-import org.eclipse.viatra.query.runtime.api.IPatternMatch;
-import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
-import org.eclipse.viatra.query.runtime.exception.ViatraQueryException;
-import org.eclipse.viatra.query.runtime.runonce.tests.util.RequestCountOfLibraryQuerySpecification;
-
-/**
- * Pattern-specific match representation of the org.eclipse.viatra.query.runtime.runonce.tests.requestCountOfLibrary pattern,
- * to be used in conjunction with {@link RequestCountOfLibraryMatcher}.
- *
- * <p>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 RequestCountOfLibraryMatcher
- * @see RequestCountOfLibraryProcessor
- *
- */
-@SuppressWarnings("all")
-public abstract class RequestCountOfLibraryMatch extends BasePatternMatch {
- private Library fLibrary;
-
- private Integer fReqCount;
-
- private static List<String> parameterNames = makeImmutableList("library", "reqCount");
-
- private RequestCountOfLibraryMatch(final Library pLibrary, final Integer pReqCount) {
- this.fLibrary = pLibrary;
- this.fReqCount = pReqCount;
- }
-
- @Override
- public Object get(final String parameterName) {
- if ("library".equals(parameterName)) return this.fLibrary;
- if ("reqCount".equals(parameterName)) return this.fReqCount;
- return null;
- }
-
- public Library getLibrary() {
- return this.fLibrary;
- }
-
- public Integer getReqCount() {
- return this.fReqCount;
- }
-
- @Override
- public boolean set(final String parameterName, final Object newValue) {
- if (!isMutable()) throw new java.lang.UnsupportedOperationException();
- if ("library".equals(parameterName) ) {
- this.fLibrary = (Library) newValue;
- return true;
- }
- if ("reqCount".equals(parameterName) ) {
- this.fReqCount = (Integer) newValue;
- return true;
- }
- return false;
- }
-
- public void setLibrary(final Library pLibrary) {
- if (!isMutable()) throw new java.lang.UnsupportedOperationException();
- this.fLibrary = pLibrary;
- }
-
- public void setReqCount(final Integer pReqCount) {
- if (!isMutable()) throw new java.lang.UnsupportedOperationException();
- this.fReqCount = pReqCount;
- }
-
- @Override
- public String patternName() {
- return "org.eclipse.viatra.query.runtime.runonce.tests.requestCountOfLibrary";
- }
-
- @Override
- public List<String> parameterNames() {
- return RequestCountOfLibraryMatch.parameterNames;
- }
-
- @Override
- public Object[] toArray() {
- return new Object[]{fLibrary, fReqCount};
- }
-
- @Override
- public RequestCountOfLibraryMatch toImmutable() {
- return isMutable() ? newMatch(fLibrary, fReqCount) : this;
- }
-
- @Override
- public String prettyPrint() {
- StringBuilder result = new StringBuilder();
- result.append("\"library\"=" + prettyPrintValue(fLibrary) + ", ");
-
- result.append("\"reqCount\"=" + prettyPrintValue(fReqCount)
- );
- return result.toString();
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((fLibrary == null) ? 0 : fLibrary.hashCode());
- result = prime * result + ((fReqCount == null) ? 0 : fReqCount.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(final Object obj) {
- if (this == obj)
- return true;
- if (!(obj instanceof RequestCountOfLibraryMatch)) { // this should be infrequent
- if (obj == null) {
- return false;
- }
- if (!(obj instanceof IPatternMatch)) {
- return false;
- }
- IPatternMatch otherSig = (IPatternMatch) obj;
- if (!specification().equals(otherSig.specification()))
- return false;
- return Arrays.deepEquals(toArray(), otherSig.toArray());
- }
- RequestCountOfLibraryMatch other = (RequestCountOfLibraryMatch) obj;
- if (fLibrary == null) {if (other.fLibrary != null) return false;}
- else if (!fLibrary.equals(other.fLibrary)) return false;
- if (fReqCount == null) {if (other.fReqCount != null) return false;}
- else if (!fReqCount.equals(other.fReqCount)) return false;
- return true;
- }
-
- @Override
- public RequestCountOfLibraryQuerySpecification specification() {
- try {
- return RequestCountOfLibraryQuerySpecification.instance();
- } catch (ViatraQueryException ex) {
- // This cannot happen, as the match object can only be instantiated if the query specification exists
- throw new IllegalStateException (ex);
- }
- }
-
- /**
- * 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 RequestCountOfLibraryMatch newEmptyMatch() {
- return new Mutable(null, null);
- }
-
- /**
- * Returns a mutable (partial) match.
- * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
- *
- * @param pLibrary the fixed value of pattern parameter library, or null if not bound.
- * @param pReqCount the fixed value of pattern parameter reqCount, or null if not bound.
- * @return the new, mutable (partial) match object.
- *
- */
- public static RequestCountOfLibraryMatch newMutableMatch(final Library pLibrary, final Integer pReqCount) {
- return new Mutable(pLibrary, pReqCount);
- }
-
- /**
- * Returns a new (partial) match.
- * This can be used e.g. to call the matcher with a partial match.
- * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
- * @param pLibrary the fixed value of pattern parameter library, or null if not bound.
- * @param pReqCount the fixed value of pattern parameter reqCount, or null if not bound.
- * @return the (partial) match object.
- *
- */
- public static RequestCountOfLibraryMatch newMatch(final Library pLibrary, final Integer pReqCount) {
- return new Immutable(pLibrary, pReqCount);
- }
-
- private static final class Mutable extends RequestCountOfLibraryMatch {
- Mutable(final Library pLibrary, final Integer pReqCount) {
- super(pLibrary, pReqCount);
- }
-
- @Override
- public boolean isMutable() {
- return true;
- }
- }
-
- private static final class Immutable extends RequestCountOfLibraryMatch {
- Immutable(final Library pLibrary, final Integer pReqCount) {
- super(pLibrary, pReqCount);
- }
-
- @Override
- public boolean isMutable() {
- return false;
- }
- }
-}
diff --git a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/RequestCountOfLibraryMatcher.java b/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/RequestCountOfLibraryMatcher.java
deleted file mode 100644
index 974fe4a..0000000
--- a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/RequestCountOfLibraryMatcher.java
+++ /dev/null
@@ -1,280 +0,0 @@
-package org.eclipse.viatra.query.runtime.runonce.tests;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-import org.apache.log4j.Logger;
-import org.eclipse.viatra.examples.library.Library;
-import org.eclipse.viatra.query.runtime.api.IMatchProcessor;
-import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
-import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
-import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
-import org.eclipse.viatra.query.runtime.exception.ViatraQueryException;
-import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
-import org.eclipse.viatra.query.runtime.runonce.tests.RequestCountOfLibraryMatch;
-import org.eclipse.viatra.query.runtime.runonce.tests.util.RequestCountOfLibraryQuerySpecification;
-import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
-
-/**
- * Generated pattern matcher API of the org.eclipse.viatra.query.runtime.runonce.tests.requestCountOfLibrary pattern,
- * providing pattern-specific query methods.
- *
- * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
- * e.g. in conjunction with {@link ViatraQueryEngine#on(Notifier)}.
- *
- * <p>Matches of the pattern will be represented as {@link RequestCountOfLibraryMatch}.
- *
- * <p>Original source:
- * <code><pre>
- * pattern requestCountOfLibrary(library : Library, reqCount) {
- * Library.requestCount(library, reqCount);
- * }
- * </pre></code>
- *
- * @see RequestCountOfLibraryMatch
- * @see RequestCountOfLibraryProcessor
- * @see RequestCountOfLibraryQuerySpecification
- *
- */
-@SuppressWarnings("all")
-public class RequestCountOfLibraryMatcher extends BaseMatcher<RequestCountOfLibraryMatch> {
- /**
- * 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.
- * The match set will be incrementally refreshed upon updates.
- * @param engine the existing VIATRA Query engine in which this matcher will be created.
- * @throws ViatraQueryException if an error occurs during pattern matcher creation
- *
- */
- public static RequestCountOfLibraryMatcher on(final ViatraQueryEngine engine) throws ViatraQueryException {
- // check if matcher already exists
- RequestCountOfLibraryMatcher matcher = engine.getExistingMatcher(querySpecification());
- if (matcher == null) {
- matcher = new RequestCountOfLibraryMatcher(engine);
- // do not have to "put" it into engine.matchers, reportMatcherInitialized() will take care of it
- }
- return matcher;
- }
-
- private final static int POSITION_LIBRARY = 0;
-
- private final static int POSITION_REQCOUNT = 1;
-
- private final static Logger LOGGER = ViatraQueryLoggingUtil.getLogger(RequestCountOfLibraryMatcher.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.
- * The match set will be incrementally refreshed upon updates.
- * @param engine the existing VIATRA Query engine in which this matcher will be created.
- * @throws ViatraQueryException if an error occurs during pattern matcher creation
- *
- */
- private RequestCountOfLibraryMatcher(final ViatraQueryEngine engine) throws ViatraQueryException {
- super(engine, querySpecification());
- }
-
- /**
- * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
- * @param pLibrary the fixed value of pattern parameter library, or null if not bound.
- * @param pReqCount the fixed value of pattern parameter reqCount, or null if not bound.
- * @return matches represented as a RequestCountOfLibraryMatch object.
- *
- */
- public Collection<RequestCountOfLibraryMatch> getAllMatches(final Library pLibrary, final Integer pReqCount) {
- return rawGetAllMatches(new Object[]{pLibrary, pReqCount});
- }
-
- /**
- * 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 pLibrary the fixed value of pattern parameter library, or null if not bound.
- * @param pReqCount the fixed value of pattern parameter reqCount, or null if not bound.
- * @return a match represented as a RequestCountOfLibraryMatch object, or null if no match is found.
- *
- */
- public RequestCountOfLibraryMatch getOneArbitraryMatch(final Library pLibrary, final Integer pReqCount) {
- return rawGetOneArbitraryMatch(new Object[]{pLibrary, pReqCount});
- }
-
- /**
- * 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 pLibrary the fixed value of pattern parameter library, or null if not bound.
- * @param pReqCount the fixed value of pattern parameter reqCount, or null if not bound.
- * @return true if the input is a valid (partial) match of the pattern.
- *
- */
- public boolean hasMatch(final Library pLibrary, final Integer pReqCount) {
- return rawHasMatch(new Object[]{pLibrary, pReqCount});
- }
-
- /**
- * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
- * @param pLibrary the fixed value of pattern parameter library, or null if not bound.
- * @param pReqCount the fixed value of pattern parameter reqCount, or null if not bound.
- * @return the number of pattern matches found.
- *
- */
- public int countMatches(final Library pLibrary, final Integer pReqCount) {
- return rawCountMatches(new Object[]{pLibrary, pReqCount});
- }
-
- /**
- * Executes the given processor on each match of the pattern that conforms to the given fixed values of some parameters.
- * @param pLibrary the fixed value of pattern parameter library, or null if not bound.
- * @param pReqCount the fixed value of pattern parameter reqCount, or null if not bound.
- * @param processor the action that will process each pattern match.
- *
- */
- public void forEachMatch(final Library pLibrary, final Integer pReqCount, final IMatchProcessor<? super RequestCountOfLibraryMatch> processor) {
- rawForEachMatch(new Object[]{pLibrary, pReqCount}, processor);
- }
-
- /**
- * 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 pLibrary the fixed value of pattern parameter library, or null if not bound.
- * @param pReqCount the fixed value of pattern parameter reqCount, 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 Library pLibrary, final Integer pReqCount, final IMatchProcessor<? super RequestCountOfLibraryMatch> processor) {
- return rawForOneArbitraryMatch(new Object[]{pLibrary, pReqCount}, processor);
- }
-
- /**
- * Returns a new (partial) match.
- * This can be used e.g. to call the matcher with a partial match.
- * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
- * @param pLibrary the fixed value of pattern parameter library, or null if not bound.
- * @param pReqCount the fixed value of pattern parameter reqCount, or null if not bound.
- * @return the (partial) match object.
- *
- */
- public RequestCountOfLibraryMatch newMatch(final Library pLibrary, final Integer pReqCount) {
- return RequestCountOfLibraryMatch.newMatch(pLibrary, pReqCount);
- }
-
- /**
- * Retrieve the set of values that occur in matches for library.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- protected Set<Library> rawAccumulateAllValuesOflibrary(final Object[] parameters) {
- Set<Library> results = new HashSet<Library>();
- rawAccumulateAllValues(POSITION_LIBRARY, parameters, results);
- return results;
- }
-
- /**
- * Retrieve the set of values that occur in matches for library.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<Library> getAllValuesOflibrary() {
- return rawAccumulateAllValuesOflibrary(emptyArray());
- }
-
- /**
- * Retrieve the set of values that occur in matches for library.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<Library> getAllValuesOflibrary(final RequestCountOfLibraryMatch partialMatch) {
- return rawAccumulateAllValuesOflibrary(partialMatch.toArray());
- }
-
- /**
- * Retrieve the set of values that occur in matches for library.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<Library> getAllValuesOflibrary(final Integer pReqCount) {
- return rawAccumulateAllValuesOflibrary(new Object[]{
- null,
- pReqCount
- });
- }
-
- /**
- * Retrieve the set of values that occur in matches for reqCount.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- protected Set<Integer> rawAccumulateAllValuesOfreqCount(final Object[] parameters) {
- Set<Integer> results = new HashSet<Integer>();
- rawAccumulateAllValues(POSITION_REQCOUNT, parameters, results);
- return results;
- }
-
- /**
- * Retrieve the set of values that occur in matches for reqCount.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<Integer> getAllValuesOfreqCount() {
- return rawAccumulateAllValuesOfreqCount(emptyArray());
- }
-
- /**
- * Retrieve the set of values that occur in matches for reqCount.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<Integer> getAllValuesOfreqCount(final RequestCountOfLibraryMatch partialMatch) {
- return rawAccumulateAllValuesOfreqCount(partialMatch.toArray());
- }
-
- /**
- * Retrieve the set of values that occur in matches for reqCount.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<Integer> getAllValuesOfreqCount(final Library pLibrary) {
- return rawAccumulateAllValuesOfreqCount(new Object[]{
- pLibrary,
- null
- });
- }
-
- @Override
- protected RequestCountOfLibraryMatch tupleToMatch(final Tuple t) {
- try {
- return RequestCountOfLibraryMatch.newMatch((Library) t.get(POSITION_LIBRARY), (Integer) t.get(POSITION_REQCOUNT));
- } catch(ClassCastException e) {
- LOGGER.error("Element(s) in tuple not properly typed!",e);
- return null;
- }
- }
-
- @Override
- protected RequestCountOfLibraryMatch arrayToMatch(final Object[] match) {
- try {
- return RequestCountOfLibraryMatch.newMatch((Library) match[POSITION_LIBRARY], (Integer) match[POSITION_REQCOUNT]);
- } catch(ClassCastException e) {
- LOGGER.error("Element(s) in array not properly typed!",e);
- return null;
- }
- }
-
- @Override
- protected RequestCountOfLibraryMatch arrayToMatchMutable(final Object[] match) {
- try {
- return RequestCountOfLibraryMatch.newMutableMatch((Library) match[POSITION_LIBRARY], (Integer) match[POSITION_REQCOUNT]);
- } 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 ViatraQueryException if the pattern definition could not be loaded
- *
- */
- public static IQuerySpecification<RequestCountOfLibraryMatcher> querySpecification() throws ViatraQueryException {
- return RequestCountOfLibraryQuerySpecification.instance();
- }
-}
diff --git a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/SingleAuthoredFirstBooksMatch.java b/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/SingleAuthoredFirstBooksMatch.java
deleted file mode 100644
index a7a678b..0000000
--- a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/SingleAuthoredFirstBooksMatch.java
+++ /dev/null
@@ -1,208 +0,0 @@
-package org.eclipse.viatra.query.runtime.runonce.tests;
-
-import java.util.Arrays;
-import java.util.List;
-import org.eclipse.viatra.examples.library.Book;
-import org.eclipse.viatra.examples.library.Library;
-import org.eclipse.viatra.query.runtime.api.IPatternMatch;
-import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
-import org.eclipse.viatra.query.runtime.exception.ViatraQueryException;
-import org.eclipse.viatra.query.runtime.runonce.tests.util.SingleAuthoredFirstBooksQuerySpecification;
-
-/**
- * Pattern-specific match representation of the org.eclipse.viatra.query.runtime.runonce.tests.singleAuthoredFirstBooks pattern,
- * to be used in conjunction with {@link SingleAuthoredFirstBooksMatcher}.
- *
- * <p>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 SingleAuthoredFirstBooksMatcher
- * @see SingleAuthoredFirstBooksProcessor
- *
- */
-@SuppressWarnings("all")
-public abstract class SingleAuthoredFirstBooksMatch extends BasePatternMatch {
- private Library fLibrary;
-
- private Book fFirstBook;
-
- private static List<String> parameterNames = makeImmutableList("library", "firstBook");
-
- private SingleAuthoredFirstBooksMatch(final Library pLibrary, final Book pFirstBook) {
- this.fLibrary = pLibrary;
- this.fFirstBook = pFirstBook;
- }
-
- @Override
- public Object get(final String parameterName) {
- if ("library".equals(parameterName)) return this.fLibrary;
- if ("firstBook".equals(parameterName)) return this.fFirstBook;
- return null;
- }
-
- public Library getLibrary() {
- return this.fLibrary;
- }
-
- public Book getFirstBook() {
- return this.fFirstBook;
- }
-
- @Override
- public boolean set(final String parameterName, final Object newValue) {
- if (!isMutable()) throw new java.lang.UnsupportedOperationException();
- if ("library".equals(parameterName) ) {
- this.fLibrary = (Library) newValue;
- return true;
- }
- if ("firstBook".equals(parameterName) ) {
- this.fFirstBook = (Book) newValue;
- return true;
- }
- return false;
- }
-
- public void setLibrary(final Library pLibrary) {
- if (!isMutable()) throw new java.lang.UnsupportedOperationException();
- this.fLibrary = pLibrary;
- }
-
- public void setFirstBook(final Book pFirstBook) {
- if (!isMutable()) throw new java.lang.UnsupportedOperationException();
- this.fFirstBook = pFirstBook;
- }
-
- @Override
- public String patternName() {
- return "org.eclipse.viatra.query.runtime.runonce.tests.singleAuthoredFirstBooks";
- }
-
- @Override
- public List<String> parameterNames() {
- return SingleAuthoredFirstBooksMatch.parameterNames;
- }
-
- @Override
- public Object[] toArray() {
- return new Object[]{fLibrary, fFirstBook};
- }
-
- @Override
- public SingleAuthoredFirstBooksMatch toImmutable() {
- return isMutable() ? newMatch(fLibrary, fFirstBook) : this;
- }
-
- @Override
- public String prettyPrint() {
- StringBuilder result = new StringBuilder();
- result.append("\"library\"=" + prettyPrintValue(fLibrary) + ", ");
-
- result.append("\"firstBook\"=" + prettyPrintValue(fFirstBook)
- );
- return result.toString();
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((fLibrary == null) ? 0 : fLibrary.hashCode());
- result = prime * result + ((fFirstBook == null) ? 0 : fFirstBook.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(final Object obj) {
- if (this == obj)
- return true;
- if (!(obj instanceof SingleAuthoredFirstBooksMatch)) { // this should be infrequent
- if (obj == null) {
- return false;
- }
- if (!(obj instanceof IPatternMatch)) {
- return false;
- }
- IPatternMatch otherSig = (IPatternMatch) obj;
- if (!specification().equals(otherSig.specification()))
- return false;
- return Arrays.deepEquals(toArray(), otherSig.toArray());
- }
- SingleAuthoredFirstBooksMatch other = (SingleAuthoredFirstBooksMatch) obj;
- if (fLibrary == null) {if (other.fLibrary != null) return false;}
- else if (!fLibrary.equals(other.fLibrary)) return false;
- if (fFirstBook == null) {if (other.fFirstBook != null) return false;}
- else if (!fFirstBook.equals(other.fFirstBook)) return false;
- return true;
- }
-
- @Override
- public SingleAuthoredFirstBooksQuerySpecification specification() {
- try {
- return SingleAuthoredFirstBooksQuerySpecification.instance();
- } catch (ViatraQueryException ex) {
- // This cannot happen, as the match object can only be instantiated if the query specification exists
- throw new IllegalStateException (ex);
- }
- }
-
- /**
- * 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 SingleAuthoredFirstBooksMatch newEmptyMatch() {
- return new Mutable(null, null);
- }
-
- /**
- * Returns a mutable (partial) match.
- * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
- *
- * @param pLibrary the fixed value of pattern parameter library, or null if not bound.
- * @param pFirstBook the fixed value of pattern parameter firstBook, or null if not bound.
- * @return the new, mutable (partial) match object.
- *
- */
- public static SingleAuthoredFirstBooksMatch newMutableMatch(final Library pLibrary, final Book pFirstBook) {
- return new Mutable(pLibrary, pFirstBook);
- }
-
- /**
- * Returns a new (partial) match.
- * This can be used e.g. to call the matcher with a partial match.
- * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
- * @param pLibrary the fixed value of pattern parameter library, or null if not bound.
- * @param pFirstBook the fixed value of pattern parameter firstBook, or null if not bound.
- * @return the (partial) match object.
- *
- */
- public static SingleAuthoredFirstBooksMatch newMatch(final Library pLibrary, final Book pFirstBook) {
- return new Immutable(pLibrary, pFirstBook);
- }
-
- private static final class Mutable extends SingleAuthoredFirstBooksMatch {
- Mutable(final Library pLibrary, final Book pFirstBook) {
- super(pLibrary, pFirstBook);
- }
-
- @Override
- public boolean isMutable() {
- return true;
- }
- }
-
- private static final class Immutable extends SingleAuthoredFirstBooksMatch {
- Immutable(final Library pLibrary, final Book pFirstBook) {
- super(pLibrary, pFirstBook);
- }
-
- @Override
- public boolean isMutable() {
- return false;
- }
- }
-}
diff --git a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/SingleAuthoredFirstBooksMatcher.java b/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/SingleAuthoredFirstBooksMatcher.java
deleted file mode 100644
index d69cedd..0000000
--- a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/SingleAuthoredFirstBooksMatcher.java
+++ /dev/null
@@ -1,282 +0,0 @@
-package org.eclipse.viatra.query.runtime.runonce.tests;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-import org.apache.log4j.Logger;
-import org.eclipse.viatra.examples.library.Book;
-import org.eclipse.viatra.examples.library.Library;
-import org.eclipse.viatra.query.runtime.api.IMatchProcessor;
-import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
-import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
-import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
-import org.eclipse.viatra.query.runtime.exception.ViatraQueryException;
-import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
-import org.eclipse.viatra.query.runtime.runonce.tests.SingleAuthoredFirstBooksMatch;
-import org.eclipse.viatra.query.runtime.runonce.tests.util.SingleAuthoredFirstBooksQuerySpecification;
-import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
-
-/**
- * Generated pattern matcher API of the org.eclipse.viatra.query.runtime.runonce.tests.singleAuthoredFirstBooks pattern,
- * providing pattern-specific query methods.
- *
- * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
- * e.g. in conjunction with {@link ViatraQueryEngine#on(Notifier)}.
- *
- * <p>Matches of the pattern will be represented as {@link SingleAuthoredFirstBooksMatch}.
- *
- * <p>Original source:
- * <code><pre>
- * pattern singleAuthoredFirstBooks(library : Library, firstBook : Book) {
- * Library.writers.firstBook(library, firstBook);
- * 1 == count find bookAuthors(firstBook, _author);
- * }
- * </pre></code>
- *
- * @see SingleAuthoredFirstBooksMatch
- * @see SingleAuthoredFirstBooksProcessor
- * @see SingleAuthoredFirstBooksQuerySpecification
- *
- */
-@SuppressWarnings("all")
-public class SingleAuthoredFirstBooksMatcher extends BaseMatcher<SingleAuthoredFirstBooksMatch> {
- /**
- * 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.
- * The match set will be incrementally refreshed upon updates.
- * @param engine the existing VIATRA Query engine in which this matcher will be created.
- * @throws ViatraQueryException if an error occurs during pattern matcher creation
- *
- */
- public static SingleAuthoredFirstBooksMatcher on(final ViatraQueryEngine engine) throws ViatraQueryException {
- // check if matcher already exists
- SingleAuthoredFirstBooksMatcher matcher = engine.getExistingMatcher(querySpecification());
- if (matcher == null) {
- matcher = new SingleAuthoredFirstBooksMatcher(engine);
- // do not have to "put" it into engine.matchers, reportMatcherInitialized() will take care of it
- }
- return matcher;
- }
-
- private final static int POSITION_LIBRARY = 0;
-
- private final static int POSITION_FIRSTBOOK = 1;
-
- private final static Logger LOGGER = ViatraQueryLoggingUtil.getLogger(SingleAuthoredFirstBooksMatcher.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.
- * The match set will be incrementally refreshed upon updates.
- * @param engine the existing VIATRA Query engine in which this matcher will be created.
- * @throws ViatraQueryException if an error occurs during pattern matcher creation
- *
- */
- private SingleAuthoredFirstBooksMatcher(final ViatraQueryEngine engine) throws ViatraQueryException {
- super(engine, querySpecification());
- }
-
- /**
- * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
- * @param pLibrary the fixed value of pattern parameter library, or null if not bound.
- * @param pFirstBook the fixed value of pattern parameter firstBook, or null if not bound.
- * @return matches represented as a SingleAuthoredFirstBooksMatch object.
- *
- */
- public Collection<SingleAuthoredFirstBooksMatch> getAllMatches(final Library pLibrary, final Book pFirstBook) {
- return rawGetAllMatches(new Object[]{pLibrary, pFirstBook});
- }
-
- /**
- * 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 pLibrary the fixed value of pattern parameter library, or null if not bound.
- * @param pFirstBook the fixed value of pattern parameter firstBook, or null if not bound.
- * @return a match represented as a SingleAuthoredFirstBooksMatch object, or null if no match is found.
- *
- */
- public SingleAuthoredFirstBooksMatch getOneArbitraryMatch(final Library pLibrary, final Book pFirstBook) {
- return rawGetOneArbitraryMatch(new Object[]{pLibrary, pFirstBook});
- }
-
- /**
- * 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 pLibrary the fixed value of pattern parameter library, or null if not bound.
- * @param pFirstBook the fixed value of pattern parameter firstBook, or null if not bound.
- * @return true if the input is a valid (partial) match of the pattern.
- *
- */
- public boolean hasMatch(final Library pLibrary, final Book pFirstBook) {
- return rawHasMatch(new Object[]{pLibrary, pFirstBook});
- }
-
- /**
- * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
- * @param pLibrary the fixed value of pattern parameter library, or null if not bound.
- * @param pFirstBook the fixed value of pattern parameter firstBook, or null if not bound.
- * @return the number of pattern matches found.
- *
- */
- public int countMatches(final Library pLibrary, final Book pFirstBook) {
- return rawCountMatches(new Object[]{pLibrary, pFirstBook});
- }
-
- /**
- * Executes the given processor on each match of the pattern that conforms to the given fixed values of some parameters.
- * @param pLibrary the fixed value of pattern parameter library, or null if not bound.
- * @param pFirstBook the fixed value of pattern parameter firstBook, or null if not bound.
- * @param processor the action that will process each pattern match.
- *
- */
- public void forEachMatch(final Library pLibrary, final Book pFirstBook, final IMatchProcessor<? super SingleAuthoredFirstBooksMatch> processor) {
- rawForEachMatch(new Object[]{pLibrary, pFirstBook}, processor);
- }
-
- /**
- * 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 pLibrary the fixed value of pattern parameter library, or null if not bound.
- * @param pFirstBook the fixed value of pattern parameter firstBook, 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 Library pLibrary, final Book pFirstBook, final IMatchProcessor<? super SingleAuthoredFirstBooksMatch> processor) {
- return rawForOneArbitraryMatch(new Object[]{pLibrary, pFirstBook}, processor);
- }
-
- /**
- * Returns a new (partial) match.
- * This can be used e.g. to call the matcher with a partial match.
- * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
- * @param pLibrary the fixed value of pattern parameter library, or null if not bound.
- * @param pFirstBook the fixed value of pattern parameter firstBook, or null if not bound.
- * @return the (partial) match object.
- *
- */
- public SingleAuthoredFirstBooksMatch newMatch(final Library pLibrary, final Book pFirstBook) {
- return SingleAuthoredFirstBooksMatch.newMatch(pLibrary, pFirstBook);
- }
-
- /**
- * Retrieve the set of values that occur in matches for library.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- protected Set<Library> rawAccumulateAllValuesOflibrary(final Object[] parameters) {
- Set<Library> results = new HashSet<Library>();
- rawAccumulateAllValues(POSITION_LIBRARY, parameters, results);
- return results;
- }
-
- /**
- * Retrieve the set of values that occur in matches for library.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<Library> getAllValuesOflibrary() {
- return rawAccumulateAllValuesOflibrary(emptyArray());
- }
-
- /**
- * Retrieve the set of values that occur in matches for library.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<Library> getAllValuesOflibrary(final SingleAuthoredFirstBooksMatch partialMatch) {
- return rawAccumulateAllValuesOflibrary(partialMatch.toArray());
- }
-
- /**
- * Retrieve the set of values that occur in matches for library.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<Library> getAllValuesOflibrary(final Book pFirstBook) {
- return rawAccumulateAllValuesOflibrary(new Object[]{
- null,
- pFirstBook
- });
- }
-
- /**
- * Retrieve the set of values that occur in matches for firstBook.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- protected Set<Book> rawAccumulateAllValuesOffirstBook(final Object[] parameters) {
- Set<Book> results = new HashSet<Book>();
- rawAccumulateAllValues(POSITION_FIRSTBOOK, parameters, results);
- return results;
- }
-
- /**
- * Retrieve the set of values that occur in matches for firstBook.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<Book> getAllValuesOffirstBook() {
- return rawAccumulateAllValuesOffirstBook(emptyArray());
- }
-
- /**
- * Retrieve the set of values that occur in matches for firstBook.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<Book> getAllValuesOffirstBook(final SingleAuthoredFirstBooksMatch partialMatch) {
- return rawAccumulateAllValuesOffirstBook(partialMatch.toArray());
- }
-
- /**
- * Retrieve the set of values that occur in matches for firstBook.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<Book> getAllValuesOffirstBook(final Library pLibrary) {
- return rawAccumulateAllValuesOffirstBook(new Object[]{
- pLibrary,
- null
- });
- }
-
- @Override
- protected SingleAuthoredFirstBooksMatch tupleToMatch(final Tuple t) {
- try {
- return SingleAuthoredFirstBooksMatch.newMatch((Library) t.get(POSITION_LIBRARY), (Book) t.get(POSITION_FIRSTBOOK));
- } catch(ClassCastException e) {
- LOGGER.error("Element(s) in tuple not properly typed!",e);
- return null;
- }
- }
-
- @Override
- protected SingleAuthoredFirstBooksMatch arrayToMatch(final Object[] match) {
- try {
- return SingleAuthoredFirstBooksMatch.newMatch((Library) match[POSITION_LIBRARY], (Book) match[POSITION_FIRSTBOOK]);
- } catch(ClassCastException e) {
- LOGGER.error("Element(s) in array not properly typed!",e);
- return null;
- }
- }
-
- @Override
- protected SingleAuthoredFirstBooksMatch arrayToMatchMutable(final Object[] match) {
- try {
- return SingleAuthoredFirstBooksMatch.newMutableMatch((Library) match[POSITION_LIBRARY], (Book) match[POSITION_FIRSTBOOK]);
- } 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 ViatraQueryException if the pattern definition could not be loaded
- *
- */
- public static IQuerySpecification<SingleAuthoredFirstBooksMatcher> querySpecification() throws ViatraQueryException {
- return SingleAuthoredFirstBooksQuerySpecification.instance();
- }
-}
diff --git a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/SomeBooksWithTwoAuthorsMatch.java b/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/SomeBooksWithTwoAuthorsMatch.java
deleted file mode 100644
index 5534fd2..0000000
--- a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/SomeBooksWithTwoAuthorsMatch.java
+++ /dev/null
@@ -1,208 +0,0 @@
-package org.eclipse.viatra.query.runtime.runonce.tests;
-
-import java.util.Arrays;
-import java.util.List;
-import org.eclipse.viatra.examples.library.Book;
-import org.eclipse.viatra.examples.library.Library;
-import org.eclipse.viatra.query.runtime.api.IPatternMatch;
-import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
-import org.eclipse.viatra.query.runtime.exception.ViatraQueryException;
-import org.eclipse.viatra.query.runtime.runonce.tests.util.SomeBooksWithTwoAuthorsQuerySpecification;
-
-/**
- * Pattern-specific match representation of the org.eclipse.viatra.query.runtime.runonce.tests.someBooksWithTwoAuthors pattern,
- * to be used in conjunction with {@link SomeBooksWithTwoAuthorsMatcher}.
- *
- * <p>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 SomeBooksWithTwoAuthorsMatcher
- * @see SomeBooksWithTwoAuthorsProcessor
- *
- */
-@SuppressWarnings("all")
-public abstract class SomeBooksWithTwoAuthorsMatch extends BasePatternMatch {
- private Library fLibrary;
-
- private Book fBook;
-
- private static List<String> parameterNames = makeImmutableList("library", "book");
-
- private SomeBooksWithTwoAuthorsMatch(final Library pLibrary, final Book pBook) {
- this.fLibrary = pLibrary;
- this.fBook = pBook;
- }
-
- @Override
- public Object get(final String parameterName) {
- if ("library".equals(parameterName)) return this.fLibrary;
- if ("book".equals(parameterName)) return this.fBook;
- return null;
- }
-
- public Library getLibrary() {
- return this.fLibrary;
- }
-
- public Book getBook() {
- return this.fBook;
- }
-
- @Override
- public boolean set(final String parameterName, final Object newValue) {
- if (!isMutable()) throw new java.lang.UnsupportedOperationException();
- if ("library".equals(parameterName) ) {
- this.fLibrary = (Library) newValue;
- return true;
- }
- if ("book".equals(parameterName) ) {
- this.fBook = (Book) newValue;
- return true;
- }
- return false;
- }
-
- public void setLibrary(final Library pLibrary) {
- if (!isMutable()) throw new java.lang.UnsupportedOperationException();
- this.fLibrary = pLibrary;
- }
-
- public void setBook(final Book pBook) {
- if (!isMutable()) throw new java.lang.UnsupportedOperationException();
- this.fBook = pBook;
- }
-
- @Override
- public String patternName() {
- return "org.eclipse.viatra.query.runtime.runonce.tests.someBooksWithTwoAuthors";
- }
-
- @Override
- public List<String> parameterNames() {
- return SomeBooksWithTwoAuthorsMatch.parameterNames;
- }
-
- @Override
- public Object[] toArray() {
- return new Object[]{fLibrary, fBook};
- }
-
- @Override
- public SomeBooksWithTwoAuthorsMatch toImmutable() {
- return isMutable() ? newMatch(fLibrary, fBook) : this;
- }
-
- @Override
- public String prettyPrint() {
- StringBuilder result = new StringBuilder();
- result.append("\"library\"=" + prettyPrintValue(fLibrary) + ", ");
-
- result.append("\"book\"=" + prettyPrintValue(fBook)
- );
- return result.toString();
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((fLibrary == null) ? 0 : fLibrary.hashCode());
- result = prime * result + ((fBook == null) ? 0 : fBook.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(final Object obj) {
- if (this == obj)
- return true;
- if (!(obj instanceof SomeBooksWithTwoAuthorsMatch)) { // this should be infrequent
- if (obj == null) {
- return false;
- }
- if (!(obj instanceof IPatternMatch)) {
- return false;
- }
- IPatternMatch otherSig = (IPatternMatch) obj;
- if (!specification().equals(otherSig.specification()))
- return false;
- return Arrays.deepEquals(toArray(), otherSig.toArray());
- }
- SomeBooksWithTwoAuthorsMatch other = (SomeBooksWithTwoAuthorsMatch) obj;
- if (fLibrary == null) {if (other.fLibrary != null) return false;}
- else if (!fLibrary.equals(other.fLibrary)) return false;
- if (fBook == null) {if (other.fBook != null) return false;}
- else if (!fBook.equals(other.fBook)) return false;
- return true;
- }
-
- @Override
- public SomeBooksWithTwoAuthorsQuerySpecification specification() {
- try {
- return SomeBooksWithTwoAuthorsQuerySpecification.instance();
- } catch (ViatraQueryException ex) {
- // This cannot happen, as the match object can only be instantiated if the query specification exists
- throw new IllegalStateException (ex);
- }
- }
-
- /**
- * 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 SomeBooksWithTwoAuthorsMatch newEmptyMatch() {
- return new Mutable(null, null);
- }
-
- /**
- * Returns a mutable (partial) match.
- * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
- *
- * @param pLibrary the fixed value of pattern parameter library, or null if not bound.
- * @param pBook the fixed value of pattern parameter book, or null if not bound.
- * @return the new, mutable (partial) match object.
- *
- */
- public static SomeBooksWithTwoAuthorsMatch newMutableMatch(final Library pLibrary, final Book pBook) {
- return new Mutable(pLibrary, pBook);
- }
-
- /**
- * Returns a new (partial) match.
- * This can be used e.g. to call the matcher with a partial match.
- * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
- * @param pLibrary the fixed value of pattern parameter library, or null if not bound.
- * @param pBook the fixed value of pattern parameter book, or null if not bound.
- * @return the (partial) match object.
- *
- */
- public static SomeBooksWithTwoAuthorsMatch newMatch(final Library pLibrary, final Book pBook) {
- return new Immutable(pLibrary, pBook);
- }
-
- private static final class Mutable extends SomeBooksWithTwoAuthorsMatch {
- Mutable(final Library pLibrary, final Book pBook) {
- super(pLibrary, pBook);
- }
-
- @Override
- public boolean isMutable() {
- return true;
- }
- }
-
- private static final class Immutable extends SomeBooksWithTwoAuthorsMatch {
- Immutable(final Library pLibrary, final Book pBook) {
- super(pLibrary, pBook);
- }
-
- @Override
- public boolean isMutable() {
- return false;
- }
- }
-}
diff --git a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/SomeBooksWithTwoAuthorsMatcher.java b/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/SomeBooksWithTwoAuthorsMatcher.java
deleted file mode 100644
index 8e2f2e2..0000000
--- a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/SomeBooksWithTwoAuthorsMatcher.java
+++ /dev/null
@@ -1,283 +0,0 @@
-package org.eclipse.viatra.query.runtime.runonce.tests;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-import org.apache.log4j.Logger;
-import org.eclipse.viatra.examples.library.Book;
-import org.eclipse.viatra.examples.library.Library;
-import org.eclipse.viatra.query.runtime.api.IMatchProcessor;
-import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
-import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
-import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
-import org.eclipse.viatra.query.runtime.exception.ViatraQueryException;
-import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
-import org.eclipse.viatra.query.runtime.runonce.tests.SomeBooksWithTwoAuthorsMatch;
-import org.eclipse.viatra.query.runtime.runonce.tests.util.SomeBooksWithTwoAuthorsQuerySpecification;
-import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
-
-/**
- * Generated pattern matcher API of the org.eclipse.viatra.query.runtime.runonce.tests.someBooksWithTwoAuthors pattern,
- * providing pattern-specific query methods.
- *
- * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
- * e.g. in conjunction with {@link ViatraQueryEngine#on(Notifier)}.
- *
- * <p>Matches of the pattern will be represented as {@link SomeBooksWithTwoAuthorsMatch}.
- *
- * <p>Original source:
- * <code><pre>
- * pattern someBooksWithTwoAuthors(library : Library, book : Book) {
- * Library.requestCount(library, _c);
- * Library.someBooks(library, book);
- * 2 == count find bookAuthors(book, _author);
- * }
- * </pre></code>
- *
- * @see SomeBooksWithTwoAuthorsMatch
- * @see SomeBooksWithTwoAuthorsProcessor
- * @see SomeBooksWithTwoAuthorsQuerySpecification
- *
- */
-@SuppressWarnings("all")
-public class SomeBooksWithTwoAuthorsMatcher extends BaseMatcher<SomeBooksWithTwoAuthorsMatch> {
- /**
- * 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.
- * The match set will be incrementally refreshed upon updates.
- * @param engine the existing VIATRA Query engine in which this matcher will be created.
- * @throws ViatraQueryException if an error occurs during pattern matcher creation
- *
- */
- public static SomeBooksWithTwoAuthorsMatcher on(final ViatraQueryEngine engine) throws ViatraQueryException {
- // check if matcher already exists
- SomeBooksWithTwoAuthorsMatcher matcher = engine.getExistingMatcher(querySpecification());
- if (matcher == null) {
- matcher = new SomeBooksWithTwoAuthorsMatcher(engine);
- // do not have to "put" it into engine.matchers, reportMatcherInitialized() will take care of it
- }
- return matcher;
- }
-
- private final static int POSITION_LIBRARY = 0;
-
- private final static int POSITION_BOOK = 1;
-
- private final static Logger LOGGER = ViatraQueryLoggingUtil.getLogger(SomeBooksWithTwoAuthorsMatcher.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.
- * The match set will be incrementally refreshed upon updates.
- * @param engine the existing VIATRA Query engine in which this matcher will be created.
- * @throws ViatraQueryException if an error occurs during pattern matcher creation
- *
- */
- private SomeBooksWithTwoAuthorsMatcher(final ViatraQueryEngine engine) throws ViatraQueryException {
- super(engine, querySpecification());
- }
-
- /**
- * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
- * @param pLibrary the fixed value of pattern parameter library, or null if not bound.
- * @param pBook the fixed value of pattern parameter book, or null if not bound.
- * @return matches represented as a SomeBooksWithTwoAuthorsMatch object.
- *
- */
- public Collection<SomeBooksWithTwoAuthorsMatch> getAllMatches(final Library pLibrary, final Book pBook) {
- return rawGetAllMatches(new Object[]{pLibrary, pBook});
- }
-
- /**
- * 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 pLibrary the fixed value of pattern parameter library, or null if not bound.
- * @param pBook the fixed value of pattern parameter book, or null if not bound.
- * @return a match represented as a SomeBooksWithTwoAuthorsMatch object, or null if no match is found.
- *
- */
- public SomeBooksWithTwoAuthorsMatch getOneArbitraryMatch(final Library pLibrary, final Book pBook) {
- return rawGetOneArbitraryMatch(new Object[]{pLibrary, pBook});
- }
-
- /**
- * 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 pLibrary the fixed value of pattern parameter library, or null if not bound.
- * @param pBook the fixed value of pattern parameter book, or null if not bound.
- * @return true if the input is a valid (partial) match of the pattern.
- *
- */
- public boolean hasMatch(final Library pLibrary, final Book pBook) {
- return rawHasMatch(new Object[]{pLibrary, pBook});
- }
-
- /**
- * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
- * @param pLibrary the fixed value of pattern parameter library, or null if not bound.
- * @param pBook the fixed value of pattern parameter book, or null if not bound.
- * @return the number of pattern matches found.
- *
- */
- public int countMatches(final Library pLibrary, final Book pBook) {
- return rawCountMatches(new Object[]{pLibrary, pBook});
- }
-
- /**
- * Executes the given processor on each match of the pattern that conforms to the given fixed values of some parameters.
- * @param pLibrary the fixed value of pattern parameter library, or null if not bound.
- * @param pBook the fixed value of pattern parameter book, or null if not bound.
- * @param processor the action that will process each pattern match.
- *
- */
- public void forEachMatch(final Library pLibrary, final Book pBook, final IMatchProcessor<? super SomeBooksWithTwoAuthorsMatch> processor) {
- rawForEachMatch(new Object[]{pLibrary, pBook}, processor);
- }
-
- /**
- * 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 pLibrary the fixed value of pattern parameter library, or null if not bound.
- * @param pBook the fixed value of pattern parameter book, 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 Library pLibrary, final Book pBook, final IMatchProcessor<? super SomeBooksWithTwoAuthorsMatch> processor) {
- return rawForOneArbitraryMatch(new Object[]{pLibrary, pBook}, processor);
- }
-
- /**
- * Returns a new (partial) match.
- * This can be used e.g. to call the matcher with a partial match.
- * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
- * @param pLibrary the fixed value of pattern parameter library, or null if not bound.
- * @param pBook the fixed value of pattern parameter book, or null if not bound.
- * @return the (partial) match object.
- *
- */
- public SomeBooksWithTwoAuthorsMatch newMatch(final Library pLibrary, final Book pBook) {
- return SomeBooksWithTwoAuthorsMatch.newMatch(pLibrary, pBook);
- }
-
- /**
- * Retrieve the set of values that occur in matches for library.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- protected Set<Library> rawAccumulateAllValuesOflibrary(final Object[] parameters) {
- Set<Library> results = new HashSet<Library>();
- rawAccumulateAllValues(POSITION_LIBRARY, parameters, results);
- return results;
- }
-
- /**
- * Retrieve the set of values that occur in matches for library.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<Library> getAllValuesOflibrary() {
- return rawAccumulateAllValuesOflibrary(emptyArray());
- }
-
- /**
- * Retrieve the set of values that occur in matches for library.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<Library> getAllValuesOflibrary(final SomeBooksWithTwoAuthorsMatch partialMatch) {
- return rawAccumulateAllValuesOflibrary(partialMatch.toArray());
- }
-
- /**
- * Retrieve the set of values that occur in matches for library.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<Library> getAllValuesOflibrary(final Book pBook) {
- return rawAccumulateAllValuesOflibrary(new Object[]{
- null,
- pBook
- });
- }
-
- /**
- * Retrieve the set of values that occur in matches for book.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- protected Set<Book> rawAccumulateAllValuesOfbook(final Object[] parameters) {
- Set<Book> results = new HashSet<Book>();
- rawAccumulateAllValues(POSITION_BOOK, parameters, results);
- return results;
- }
-
- /**
- * Retrieve the set of values that occur in matches for book.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<Book> getAllValuesOfbook() {
- return rawAccumulateAllValuesOfbook(emptyArray());
- }
-
- /**
- * Retrieve the set of values that occur in matches for book.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<Book> getAllValuesOfbook(final SomeBooksWithTwoAuthorsMatch partialMatch) {
- return rawAccumulateAllValuesOfbook(partialMatch.toArray());
- }
-
- /**
- * Retrieve the set of values that occur in matches for book.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<Book> getAllValuesOfbook(final Library pLibrary) {
- return rawAccumulateAllValuesOfbook(new Object[]{
- pLibrary,
- null
- });
- }
-
- @Override
- protected SomeBooksWithTwoAuthorsMatch tupleToMatch(final Tuple t) {
- try {
- return SomeBooksWithTwoAuthorsMatch.newMatch((Library) t.get(POSITION_LIBRARY), (Book) t.get(POSITION_BOOK));
- } catch(ClassCastException e) {
- LOGGER.error("Element(s) in tuple not properly typed!",e);
- return null;
- }
- }
-
- @Override
- protected SomeBooksWithTwoAuthorsMatch arrayToMatch(final Object[] match) {
- try {
- return SomeBooksWithTwoAuthorsMatch.newMatch((Library) match[POSITION_LIBRARY], (Book) match[POSITION_BOOK]);
- } catch(ClassCastException e) {
- LOGGER.error("Element(s) in array not properly typed!",e);
- return null;
- }
- }
-
- @Override
- protected SomeBooksWithTwoAuthorsMatch arrayToMatchMutable(final Object[] match) {
- try {
- return SomeBooksWithTwoAuthorsMatch.newMutableMatch((Library) match[POSITION_LIBRARY], (Book) match[POSITION_BOOK]);
- } 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 ViatraQueryException if the pattern definition could not be loaded
- *
- */
- public static IQuerySpecification<SomeBooksWithTwoAuthorsMatcher> querySpecification() throws ViatraQueryException {
- return SomeBooksWithTwoAuthorsQuerySpecification.instance();
- }
-}
diff --git a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/SumOfPagesInLibraryMatch.java b/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/SumOfPagesInLibraryMatch.java
deleted file mode 100644
index 40dff38..0000000
--- a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/SumOfPagesInLibraryMatch.java
+++ /dev/null
@@ -1,207 +0,0 @@
-package org.eclipse.viatra.query.runtime.runonce.tests;
-
-import java.util.Arrays;
-import java.util.List;
-import org.eclipse.viatra.examples.library.Library;
-import org.eclipse.viatra.query.runtime.api.IPatternMatch;
-import org.eclipse.viatra.query.runtime.api.impl.BasePatternMatch;
-import org.eclipse.viatra.query.runtime.exception.ViatraQueryException;
-import org.eclipse.viatra.query.runtime.runonce.tests.util.SumOfPagesInLibraryQuerySpecification;
-
-/**
- * Pattern-specific match representation of the org.eclipse.viatra.query.runtime.runonce.tests.sumOfPagesInLibrary pattern,
- * to be used in conjunction with {@link SumOfPagesInLibraryMatcher}.
- *
- * <p>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 SumOfPagesInLibraryMatcher
- * @see SumOfPagesInLibraryProcessor
- *
- */
-@SuppressWarnings("all")
-public abstract class SumOfPagesInLibraryMatch extends BasePatternMatch {
- private Library fLibrary;
-
- private Integer fSumOfPages;
-
- private static List<String> parameterNames = makeImmutableList("library", "sumOfPages");
-
- private SumOfPagesInLibraryMatch(final Library pLibrary, final Integer pSumOfPages) {
- this.fLibrary = pLibrary;
- this.fSumOfPages = pSumOfPages;
- }
-
- @Override
- public Object get(final String parameterName) {
- if ("library".equals(parameterName)) return this.fLibrary;
- if ("sumOfPages".equals(parameterName)) return this.fSumOfPages;
- return null;
- }
-
- public Library getLibrary() {
- return this.fLibrary;
- }
-
- public Integer getSumOfPages() {
- return this.fSumOfPages;
- }
-
- @Override
- public boolean set(final String parameterName, final Object newValue) {
- if (!isMutable()) throw new java.lang.UnsupportedOperationException();
- if ("library".equals(parameterName) ) {
- this.fLibrary = (Library) newValue;
- return true;
- }
- if ("sumOfPages".equals(parameterName) ) {
- this.fSumOfPages = (Integer) newValue;
- return true;
- }
- return false;
- }
-
- public void setLibrary(final Library pLibrary) {
- if (!isMutable()) throw new java.lang.UnsupportedOperationException();
- this.fLibrary = pLibrary;
- }
-
- public void setSumOfPages(final Integer pSumOfPages) {
- if (!isMutable()) throw new java.lang.UnsupportedOperationException();
- this.fSumOfPages = pSumOfPages;
- }
-
- @Override
- public String patternName() {
- return "org.eclipse.viatra.query.runtime.runonce.tests.sumOfPagesInLibrary";
- }
-
- @Override
- public List<String> parameterNames() {
- return SumOfPagesInLibraryMatch.parameterNames;
- }
-
- @Override
- public Object[] toArray() {
- return new Object[]{fLibrary, fSumOfPages};
- }
-
- @Override
- public SumOfPagesInLibraryMatch toImmutable() {
- return isMutable() ? newMatch(fLibrary, fSumOfPages) : this;
- }
-
- @Override
- public String prettyPrint() {
- StringBuilder result = new StringBuilder();
- result.append("\"library\"=" + prettyPrintValue(fLibrary) + ", ");
-
- result.append("\"sumOfPages\"=" + prettyPrintValue(fSumOfPages)
- );
- return result.toString();
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((fLibrary == null) ? 0 : fLibrary.hashCode());
- result = prime * result + ((fSumOfPages == null) ? 0 : fSumOfPages.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(final Object obj) {
- if (this == obj)
- return true;
- if (!(obj instanceof SumOfPagesInLibraryMatch)) { // this should be infrequent
- if (obj == null) {
- return false;
- }
- if (!(obj instanceof IPatternMatch)) {
- return false;
- }
- IPatternMatch otherSig = (IPatternMatch) obj;
- if (!specification().equals(otherSig.specification()))
- return false;
- return Arrays.deepEquals(toArray(), otherSig.toArray());
- }
- SumOfPagesInLibraryMatch other = (SumOfPagesInLibraryMatch) obj;
- if (fLibrary == null) {if (other.fLibrary != null) return false;}
- else if (!fLibrary.equals(other.fLibrary)) return false;
- if (fSumOfPages == null) {if (other.fSumOfPages != null) return false;}
- else if (!fSumOfPages.equals(other.fSumOfPages)) return false;
- return true;
- }
-
- @Override
- public SumOfPagesInLibraryQuerySpecification specification() {
- try {
- return SumOfPagesInLibraryQuerySpecification.instance();
- } catch (ViatraQueryException ex) {
- // This cannot happen, as the match object can only be instantiated if the query specification exists
- throw new IllegalStateException (ex);
- }
- }
-
- /**
- * 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 SumOfPagesInLibraryMatch newEmptyMatch() {
- return new Mutable(null, null);
- }
-
- /**
- * Returns a mutable (partial) match.
- * Fields of the mutable match can be filled to create a partial match, usable as matcher input.
- *
- * @param pLibrary the fixed value of pattern parameter library, or null if not bound.
- * @param pSumOfPages the fixed value of pattern parameter sumOfPages, or null if not bound.
- * @return the new, mutable (partial) match object.
- *
- */
- public static SumOfPagesInLibraryMatch newMutableMatch(final Library pLibrary, final Integer pSumOfPages) {
- return new Mutable(pLibrary, pSumOfPages);
- }
-
- /**
- * Returns a new (partial) match.
- * This can be used e.g. to call the matcher with a partial match.
- * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
- * @param pLibrary the fixed value of pattern parameter library, or null if not bound.
- * @param pSumOfPages the fixed value of pattern parameter sumOfPages, or null if not bound.
- * @return the (partial) match object.
- *
- */
- public static SumOfPagesInLibraryMatch newMatch(final Library pLibrary, final Integer pSumOfPages) {
- return new Immutable(pLibrary, pSumOfPages);
- }
-
- private static final class Mutable extends SumOfPagesInLibraryMatch {
- Mutable(final Library pLibrary, final Integer pSumOfPages) {
- super(pLibrary, pSumOfPages);
- }
-
- @Override
- public boolean isMutable() {
- return true;
- }
- }
-
- private static final class Immutable extends SumOfPagesInLibraryMatch {
- Immutable(final Library pLibrary, final Integer pSumOfPages) {
- super(pLibrary, pSumOfPages);
- }
-
- @Override
- public boolean isMutable() {
- return false;
- }
- }
-}
diff --git a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/SumOfPagesInLibraryMatcher.java b/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/SumOfPagesInLibraryMatcher.java
deleted file mode 100644
index 331e16b..0000000
--- a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/SumOfPagesInLibraryMatcher.java
+++ /dev/null
@@ -1,280 +0,0 @@
-package org.eclipse.viatra.query.runtime.runonce.tests;
-
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-import org.apache.log4j.Logger;
-import org.eclipse.viatra.examples.library.Library;
-import org.eclipse.viatra.query.runtime.api.IMatchProcessor;
-import org.eclipse.viatra.query.runtime.api.IQuerySpecification;
-import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine;
-import org.eclipse.viatra.query.runtime.api.impl.BaseMatcher;
-import org.eclipse.viatra.query.runtime.exception.ViatraQueryException;
-import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple;
-import org.eclipse.viatra.query.runtime.runonce.tests.SumOfPagesInLibraryMatch;
-import org.eclipse.viatra.query.runtime.runonce.tests.util.SumOfPagesInLibraryQuerySpecification;
-import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil;
-
-/**
- * Generated pattern matcher API of the org.eclipse.viatra.query.runtime.runonce.tests.sumOfPagesInLibrary pattern,
- * providing pattern-specific query methods.
- *
- * <p>Use the pattern matcher on a given model via {@link #on(ViatraQueryEngine)},
- * e.g. in conjunction with {@link ViatraQueryEngine#on(Notifier)}.
- *
- * <p>Matches of the pattern will be represented as {@link SumOfPagesInLibraryMatch}.
- *
- * <p>Original source:
- * <code><pre>
- * pattern sumOfPagesInLibrary(library : Library, sumOfPages) {
- * Library.sumOfPages(library, sumOfPages);
- * }
- * </pre></code>
- *
- * @see SumOfPagesInLibraryMatch
- * @see SumOfPagesInLibraryProcessor
- * @see SumOfPagesInLibraryQuerySpecification
- *
- */
-@SuppressWarnings("all")
-public class SumOfPagesInLibraryMatcher extends BaseMatcher<SumOfPagesInLibraryMatch> {
- /**
- * 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.
- * The match set will be incrementally refreshed upon updates.
- * @param engine the existing VIATRA Query engine in which this matcher will be created.
- * @throws ViatraQueryException if an error occurs during pattern matcher creation
- *
- */
- public static SumOfPagesInLibraryMatcher on(final ViatraQueryEngine engine) throws ViatraQueryException {
- // check if matcher already exists
- SumOfPagesInLibraryMatcher matcher = engine.getExistingMatcher(querySpecification());
- if (matcher == null) {
- matcher = new SumOfPagesInLibraryMatcher(engine);
- // do not have to "put" it into engine.matchers, reportMatcherInitialized() will take care of it
- }
- return matcher;
- }
-
- private final static int POSITION_LIBRARY = 0;
-
- private final static int POSITION_SUMOFPAGES = 1;
-
- private final static Logger LOGGER = ViatraQueryLoggingUtil.getLogger(SumOfPagesInLibraryMatcher.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.
- * The match set will be incrementally refreshed upon updates.
- * @param engine the existing VIATRA Query engine in which this matcher will be created.
- * @throws ViatraQueryException if an error occurs during pattern matcher creation
- *
- */
- private SumOfPagesInLibraryMatcher(final ViatraQueryEngine engine) throws ViatraQueryException {
- super(engine, querySpecification());
- }
-
- /**
- * Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
- * @param pLibrary the fixed value of pattern parameter library, or null if not bound.
- * @param pSumOfPages the fixed value of pattern parameter sumOfPages, or null if not bound.
- * @return matches represented as a SumOfPagesInLibraryMatch object.
- *
- */
- public Collection<SumOfPagesInLibraryMatch> getAllMatches(final Library pLibrary, final Integer pSumOfPages) {
- return rawGetAllMatches(new Object[]{pLibrary, pSumOfPages});
- }
-
- /**
- * 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 pLibrary the fixed value of pattern parameter library, or null if not bound.
- * @param pSumOfPages the fixed value of pattern parameter sumOfPages, or null if not bound.
- * @return a match represented as a SumOfPagesInLibraryMatch object, or null if no match is found.
- *
- */
- public SumOfPagesInLibraryMatch getOneArbitraryMatch(final Library pLibrary, final Integer pSumOfPages) {
- return rawGetOneArbitraryMatch(new Object[]{pLibrary, pSumOfPages});
- }
-
- /**
- * 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 pLibrary the fixed value of pattern parameter library, or null if not bound.
- * @param pSumOfPages the fixed value of pattern parameter sumOfPages, or null if not bound.
- * @return true if the input is a valid (partial) match of the pattern.
- *
- */
- public boolean hasMatch(final Library pLibrary, final Integer pSumOfPages) {
- return rawHasMatch(new Object[]{pLibrary, pSumOfPages});
- }
-
- /**
- * Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
- * @param pLibrary the fixed value of pattern parameter library, or null if not bound.
- * @param pSumOfPages the fixed value of pattern parameter sumOfPages, or null if not bound.
- * @return the number of pattern matches found.
- *
- */
- public int countMatches(final Library pLibrary, final Integer pSumOfPages) {
- return rawCountMatches(new Object[]{pLibrary, pSumOfPages});
- }
-
- /**
- * Executes the given processor on each match of the pattern that conforms to the given fixed values of some parameters.
- * @param pLibrary the fixed value of pattern parameter library, or null if not bound.
- * @param pSumOfPages the fixed value of pattern parameter sumOfPages, or null if not bound.
- * @param processor the action that will process each pattern match.
- *
- */
- public void forEachMatch(final Library pLibrary, final Integer pSumOfPages, final IMatchProcessor<? super SumOfPagesInLibraryMatch> processor) {
- rawForEachMatch(new Object[]{pLibrary, pSumOfPages}, processor);
- }
-
- /**
- * 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 pLibrary the fixed value of pattern parameter library, or null if not bound.
- * @param pSumOfPages the fixed value of pattern parameter sumOfPages, 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 Library pLibrary, final Integer pSumOfPages, final IMatchProcessor<? super SumOfPagesInLibraryMatch> processor) {
- return rawForOneArbitraryMatch(new Object[]{pLibrary, pSumOfPages}, processor);
- }
-
- /**
- * Returns a new (partial) match.
- * This can be used e.g. to call the matcher with a partial match.
- * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match object.
- * @param pLibrary the fixed value of pattern parameter library, or null if not bound.
- * @param pSumOfPages the fixed value of pattern parameter sumOfPages, or null if not bound.
- * @return the (partial) match object.
- *
- */
- public SumOfPagesInLibraryMatch newMatch(final Library pLibrary, final Integer pSumOfPages) {
- return SumOfPagesInLibraryMatch.newMatch(pLibrary, pSumOfPages);
- }
-
- /**
- * Retrieve the set of values that occur in matches for library.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- protected Set<Library> rawAccumulateAllValuesOflibrary(final Object[] parameters) {
- Set<Library> results = new HashSet<Library>();
- rawAccumulateAllValues(POSITION_LIBRARY, parameters, results);
- return results;
- }
-
- /**
- * Retrieve the set of values that occur in matches for library.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<Library> getAllValuesOflibrary() {
- return rawAccumulateAllValuesOflibrary(emptyArray());
- }
-
- /**
- * Retrieve the set of values that occur in matches for library.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<Library> getAllValuesOflibrary(final SumOfPagesInLibraryMatch partialMatch) {
- return rawAccumulateAllValuesOflibrary(partialMatch.toArray());
- }
-
- /**
- * Retrieve the set of values that occur in matches for library.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<Library> getAllValuesOflibrary(final Integer pSumOfPages) {
- return rawAccumulateAllValuesOflibrary(new Object[]{
- null,
- pSumOfPages
- });
- }
-
- /**
- * Retrieve the set of values that occur in matches for sumOfPages.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- protected Set<Integer> rawAccumulateAllValuesOfsumOfPages(final Object[] parameters) {
- Set<Integer> results = new HashSet<Integer>();
- rawAccumulateAllValues(POSITION_SUMOFPAGES, parameters, results);
- return results;
- }
-
- /**
- * Retrieve the set of values that occur in matches for sumOfPages.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<Integer> getAllValuesOfsumOfPages() {
- return rawAccumulateAllValuesOfsumOfPages(emptyArray());
- }
-
- /**
- * Retrieve the set of values that occur in matches for sumOfPages.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<Integer> getAllValuesOfsumOfPages(final SumOfPagesInLibraryMatch partialMatch) {
- return rawAccumulateAllValuesOfsumOfPages(partialMatch.toArray());
- }
-
- /**
- * Retrieve the set of values that occur in matches for sumOfPages.
- * @return the Set of all values, null if no parameter with the given name exists, empty set if there are no matches
- *
- */
- public Set<Integer> getAllValuesOfsumOfPages(final Library pLibrary) {
- return rawAccumulateAllValuesOfsumOfPages(new Object[]{
- pLibrary,
- null
- });
- }
-
- @Override
- protected SumOfPagesInLibraryMatch tupleToMatch(final Tuple t) {
- try {
- return SumOfPagesInLibraryMatch.newMatch((Library) t.get(POSITION_LIBRARY), (Integer) t.get(POSITION_SUMOFPAGES));
- } catch(ClassCastException e) {
- LOGGER.error("Element(s) in tuple not properly typed!",e);
- return null;
- }
- }
-
- @Override
- protected SumOfPagesInLibraryMatch arrayToMatch(final Object[] match) {
- try {
- return SumOfPagesInLibraryMatch.newMatch((Library) match[POSITION_LIBRARY], (Integer) match[POSITION_SUMOFPAGES]);
- } catch(ClassCastException e) {
- LOGGER.error("Element(s) in array not properly typed!",e);
- return null;
- }
- }
-
- @Override
- protected SumOfPagesInLibraryMatch arrayToMatchMutable(final Object[] match) {
- try {
- return SumOfPagesInLibraryMatch.newMutableMatch((Library) match[POSITION_LIBRARY], (Integer) match[POSITION_SUMOFPAGES]);
- } 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 ViatraQueryException if the pattern definition could not be loaded
- *
- */
- public static IQuerySpecification<SumOfPagesInLibraryMatcher> querySpecification() throws ViatraQueryException {
- return SumOfPagesInLibraryQuerySpecification.instance();
- }
-}
diff --git a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/.gitignore b/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/.gitignore
deleted file mode 100644
index 75d24fa..0000000
--- a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/.gitignore
+++ /dev/null
@@ -1,14 +0,0 @@
-/.BookAuthorsProcessor.java._trace
-/.BookAuthorsQuerySpecification.java._trace
-/.BooksWithMultipleAuthorsProcessor.java._trace
-/.BooksWithMultipleAuthorsQuerySpecification.java._trace
-/.SingleAuthoredFirstBooksProcessor.java._trace
-/.SingleAuthoredFirstBooksQuerySpecification.java._trace
-/.SumOfPagesInLibraryProcessor.java._trace
-/.SumOfPagesInLibraryQuerySpecification.java._trace
-/.LongSciFiBooksOfAuthorProcessor.java._trace
-/.LongSciFiBooksOfAuthorQuerySpecification.java._trace
-/.RequestCountOfLibraryProcessor.java._trace
-/.RequestCountOfLibraryQuerySpecification.java._trace
-/.SomeBooksWithTwoAuthorsProcessor.java._trace
-/.SomeBooksWithTwoAuthorsQuerySpecification.java._trace
diff --git a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/BookAuthorsProcessor.java b/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/BookAuthorsProcessor.java
deleted file mode 100644
index 2b8bbc9..0000000
--- a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/BookAuthorsProcessor.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.eclipse.viatra.query.runtime.runonce.tests.util;
-
-import org.eclipse.viatra.examples.library.Book;
-import org.eclipse.viatra.examples.library.Writer;
-import org.eclipse.viatra.query.runtime.api.IMatchProcessor;
-import org.eclipse.viatra.query.runtime.runonce.tests.BookAuthorsMatch;
-
-/**
- * A match processor tailored for the org.eclipse.viatra.query.runtime.runonce.tests.bookAuthors pattern.
- *
- * Clients should derive an (anonymous) class that implements the abstract process().
- *
- */
-@SuppressWarnings("all")
-public abstract class BookAuthorsProcessor implements IMatchProcessor<BookAuthorsMatch> {
- /**
- * Defines the action that is to be executed on each match.
- * @param pBook the value of pattern parameter book in the currently processed match
- * @param pAuthor the value of pattern parameter author in the currently processed match
- *
- */
- public abstract void process(final Book pBook, final Writer pAuthor);
-
- @Override
- public void process(final BookAuthorsMatch match) {
- process(match.getBook(), match.getAuthor());
- }
-}
diff --git a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/BookAuthorsQuerySpecification.java b/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/BookAuthorsQuerySpecification.java
deleted file mode 100644
index a28540c..0000000
--- a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/BookAuthorsQuerySpecification.java
+++ /dev/null
@@ -1,142 +0,0 @@
-package org.eclipse.viatra.query.runtime.runonce.tests.util;
-
-import com.google.common.collect.Sets;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Set;
-import org.eclipse.emf.ecore.EClass;
-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.emf.types.EClassTransitiveInstancesKey;
-import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey;
-import org.eclipse.viatra.query.runtime.exception.ViatraQueryException;
-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.basicenumerables.TypeConstraint;
-import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
-import org.eclipse.viatra.query.runtime.matchers.psystem.queries.QueryInitializationException;
-import org.eclipse.viatra.query.runtime.matchers.tuple.FlatTuple;
-import org.eclipse.viatra.query.runtime.runonce.tests.BookAuthorsMatch;
-import org.eclipse.viatra.query.runtime.runonce.tests.BookAuthorsMatcher;
-
-/**
- * A pattern-specific query specification that can instantiate BookAuthorsMatcher in a type-safe way.
- *
- * @see BookAuthorsMatcher
- * @see BookAuthorsMatch
- *
- */
-@SuppressWarnings("all")
-public final class BookAuthorsQuerySpecification extends BaseGeneratedEMFQuerySpecification<BookAuthorsMatcher> {
- private BookAuthorsQuerySpecification() {
- super(GeneratedPQuery.INSTANCE);
- }
-
- /**
- * @return the singleton instance of the query specification
- * @throws ViatraQueryException if the pattern definition could not be loaded
- *
- */
- public static BookAuthorsQuerySpecification instance() throws ViatraQueryException {
- try{
- return LazyHolder.INSTANCE;
- } catch (ExceptionInInitializerError err) {
- throw processInitializerError(err);
- }
- }
-
- @Override
- protected BookAuthorsMatcher instantiate(final ViatraQueryEngine engine) throws ViatraQueryException {
- return BookAuthorsMatcher.on(engine);
- }
-
- @Override
- public BookAuthorsMatch newEmptyMatch() {
- return BookAuthorsMatch.newEmptyMatch();
- }
-
- @Override
- public BookAuthorsMatch newMatch(final Object... parameters) {
- return BookAuthorsMatch.newMatch((org.eclipse.viatra.examples.library.Book) parameters[0], (org.eclipse.viatra.examples.library.Writer) parameters[1]);
- }
-
- /**
- * Inner class allowing the singleton instance of {@link BookAuthorsQuerySpecification} to be created
- * <b>not</b> at the class load time of the outer class,
- * but rather at the first call to {@link BookAuthorsQuerySpecification#instance()}.
- *
- * <p> This workaround is required e.g. to support recursion.
- *
- */
- private static class LazyHolder {
- private final static BookAuthorsQuerySpecification INSTANCE = new BookAuthorsQuerySpecification();
-
- /**
- * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
- * This initialization order is required to support indirect recursion.
- *
- * <p> 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.ensureInitializedInternalSneaky();
- return null;
- }
- }
-
- private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
- private final static BookAuthorsQuerySpecification.GeneratedPQuery INSTANCE = new GeneratedPQuery();
-
- @Override
- public String getFullyQualifiedName() {
- return "org.eclipse.viatra.query.runtime.runonce.tests.bookAuthors";
- }
-
- @Override
- public List<String> getParameterNames() {
- return Arrays.asList("book","author");
- }
-
- @Override
- public List<PParameter> getParameters() {
- return Arrays.asList(
- new PParameter("book", "org.eclipse.viatra.examples.library.Book", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.eclipse.org/viatra/examples/library/1.0", "Book"))),
- new PParameter("author", "org.eclipse.viatra.examples.library.Writer", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.eclipse.org/viatra/examples/library/1.0", "Writer")))
- );
- }
-
- @Override
- public Set<PBody> doGetContainedBodies() throws QueryInitializationException {
- Set<PBody> bodies = Sets.newLinkedHashSet();
- try {
- {
- PBody body = new PBody(this);
- PVariable var_book = body.getOrCreateVariableByName("book");
- PVariable var_author = body.getOrCreateVariableByName("author");
- new TypeConstraint(body, new FlatTuple(var_book), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/viatra/examples/library/1.0", "Book")));
- new TypeConstraint(body, new FlatTuple(var_author), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/viatra/examples/library/1.0", "Writer")));
- body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
- new ExportedParameter(body, var_book, "book"),
- new ExportedParameter(body, var_author, "author")
- ));
- // Book.authors(book, author)
- new TypeConstraint(body, new FlatTuple(var_book), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/viatra/examples/library/1.0", "Book")));
- PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
- new TypeConstraint(body, new FlatTuple(var_book, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.eclipse.org/viatra/examples/library/1.0", "Book", "authors")));
- new Equality(body, var__virtual_0_, var_author);
- bodies.add(body);
- }
- // to silence compiler error
- if (false) throw new ViatraQueryException("Never", "happens");
- } catch (ViatraQueryException ex) {
- throw processDependencyException(ex);
- }
- return bodies;
- }
- }
-}
diff --git a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/BooksWithMultipleAuthorsProcessor.java b/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/BooksWithMultipleAuthorsProcessor.java
deleted file mode 100644
index 8c6acec..0000000
--- a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/BooksWithMultipleAuthorsProcessor.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.eclipse.viatra.query.runtime.runonce.tests.util;
-
-import org.eclipse.viatra.examples.library.Book;
-import org.eclipse.viatra.query.runtime.api.IMatchProcessor;
-import org.eclipse.viatra.query.runtime.runonce.tests.BooksWithMultipleAuthorsMatch;
-
-/**
- * A match processor tailored for the org.eclipse.viatra.query.runtime.runonce.tests.booksWithMultipleAuthors pattern.
- *
- * Clients should derive an (anonymous) class that implements the abstract process().
- *
- */
-@SuppressWarnings("all")
-public abstract class BooksWithMultipleAuthorsProcessor implements IMatchProcessor<BooksWithMultipleAuthorsMatch> {
- /**
- * Defines the action that is to be executed on each match.
- * @param pBook the value of pattern parameter book in the currently processed match
- *
- */
- public abstract void process(final Book pBook);
-
- @Override
- public void process(final BooksWithMultipleAuthorsMatch match) {
- process(match.getBook());
- }
-}
diff --git a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/BooksWithMultipleAuthorsQuerySpecification.java b/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/BooksWithMultipleAuthorsQuerySpecification.java
deleted file mode 100644
index 5195a52..0000000
--- a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/BooksWithMultipleAuthorsQuerySpecification.java
+++ /dev/null
@@ -1,169 +0,0 @@
-package org.eclipse.viatra.query.runtime.runonce.tests.util;
-
-import com.google.common.collect.Sets;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Set;
-import org.eclipse.emf.ecore.EClass;
-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.emf.types.EClassTransitiveInstancesKey;
-import org.eclipse.viatra.query.runtime.exception.ViatraQueryException;
-import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator;
-import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider;
-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.ExpressionEvaluation;
-import org.eclipse.viatra.query.runtime.matchers.psystem.basicdeferred.PatternMatchCounter;
-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.QueryInitializationException;
-import org.eclipse.viatra.query.runtime.matchers.tuple.FlatTuple;
-import org.eclipse.viatra.query.runtime.runonce.tests.BooksWithMultipleAuthorsMatch;
-import org.eclipse.viatra.query.runtime.runonce.tests.BooksWithMultipleAuthorsMatcher;
-import org.eclipse.viatra.query.runtime.runonce.tests.util.BookAuthorsQuerySpecification;
-
-/**
- * A pattern-specific query specification that can instantiate BooksWithMultipleAuthorsMatcher in a type-safe way.
- *
- * @see BooksWithMultipleAuthorsMatcher
- * @see BooksWithMultipleAuthorsMatch
- *
- */
-@SuppressWarnings("all")
-public final class BooksWithMultipleAuthorsQuerySpecification extends BaseGeneratedEMFQuerySpecification<BooksWithMultipleAuthorsMatcher> {
- private BooksWithMultipleAuthorsQuerySpecification() {
- super(GeneratedPQuery.INSTANCE);
- }
-
- /**
- * @return the singleton instance of the query specification
- * @throws ViatraQueryException if the pattern definition could not be loaded
- *
- */
- public static BooksWithMultipleAuthorsQuerySpecification instance() throws ViatraQueryException {
- try{
- return LazyHolder.INSTANCE;
- } catch (ExceptionInInitializerError err) {
- throw processInitializerError(err);
- }
- }
-
- @Override
- protected BooksWithMultipleAuthorsMatcher instantiate(final ViatraQueryEngine engine) throws ViatraQueryException {
- return BooksWithMultipleAuthorsMatcher.on(engine);
- }
-
- @Override
- public BooksWithMultipleAuthorsMatch newEmptyMatch() {
- return BooksWithMultipleAuthorsMatch.newEmptyMatch();
- }
-
- @Override
- public BooksWithMultipleAuthorsMatch newMatch(final Object... parameters) {
- return BooksWithMultipleAuthorsMatch.newMatch((org.eclipse.viatra.examples.library.Book) parameters[0]);
- }
-
- /**
- * Inner class allowing the singleton instance of {@link BooksWithMultipleAuthorsQuerySpecification} to be created
- * <b>not</b> at the class load time of the outer class,
- * but rather at the first call to {@link BooksWithMultipleAuthorsQuerySpecification#instance()}.
- *
- * <p> This workaround is required e.g. to support recursion.
- *
- */
- private static class LazyHolder {
- private final static BooksWithMultipleAuthorsQuerySpecification INSTANCE = new BooksWithMultipleAuthorsQuerySpecification();
-
- /**
- * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
- * This initialization order is required to support indirect recursion.
- *
- * <p> 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.ensureInitializedInternalSneaky();
- return null;
- }
- }
-
- private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
- private final static BooksWithMultipleAuthorsQuerySpecification.GeneratedPQuery INSTANCE = new GeneratedPQuery();
-
- @Override
- public String getFullyQualifiedName() {
- return "org.eclipse.viatra.query.runtime.runonce.tests.booksWithMultipleAuthors";
- }
-
- @Override
- public List<String> getParameterNames() {
- return Arrays.asList("book");
- }
-
- @Override
- public List<PParameter> getParameters() {
- return Arrays.asList(
- new PParameter("book", "org.eclipse.viatra.examples.library.Book", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.eclipse.org/viatra/examples/library/1.0", "Book")))
- );
- }
-
- @Override
- public Set<PBody> doGetContainedBodies() throws QueryInitializationException {
- Set<PBody> bodies = Sets.newLinkedHashSet();
- try {
- {
- PBody body = new PBody(this);
- PVariable var_book = body.getOrCreateVariableByName("book");
- PVariable var_numberOfBooks = body.getOrCreateVariableByName("numberOfBooks");
- PVariable var__author = body.getOrCreateVariableByName("_author");
- new TypeConstraint(body, new FlatTuple(var_book), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/viatra/examples/library/1.0", "Book")));
- body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
- new ExportedParameter(body, var_book, "book")
- ));
- // Book(book)
- new TypeConstraint(body, new FlatTuple(var_book), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/viatra/examples/library/1.0", "Book")));
- // numberOfBooks == count find bookAuthors(book, _author)
- PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
- new PatternMatchCounter(body, new FlatTuple(var_book, var__author), BookAuthorsQuerySpecification.instance().getInternalQueryRepresentation(), var__virtual_0_);
- new Equality(body, var_numberOfBooks, var__virtual_0_);
- // check(numberOfBooks > 1)
- new ExpressionEvaluation(body, new IExpressionEvaluator() {
-
- @Override
- public String getShortDescription() {
- return "Expression evaluation from pattern booksWithMultipleAuthors";
- }
-
- @Override
- public Iterable<String> getInputParameterNames() {
- return Arrays.asList("numberOfBooks");
- }
-
- @Override
- public Object evaluateExpression(IValueProvider provider) throws Exception {
- java.lang.Integer numberOfBooks = (java.lang.Integer) provider.getValue("numberOfBooks");
- return evaluateExpression_1_1(numberOfBooks);
- }
-
- }, null);
- bodies.add(body);
- }
- // to silence compiler error
- if (false) throw new ViatraQueryException("Never", "happens");
- } catch (ViatraQueryException ex) {
- throw processDependencyException(ex);
- }
- return bodies;
- }
- }
-
- private static boolean evaluateExpression_1_1(final Integer numberOfBooks) {
- return ((numberOfBooks).intValue() > 1);
- }
-}
diff --git a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/LongSciFiBooksOfAuthorProcessor.java b/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/LongSciFiBooksOfAuthorProcessor.java
deleted file mode 100644
index 1c3a97e..0000000
--- a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/LongSciFiBooksOfAuthorProcessor.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.eclipse.viatra.query.runtime.runonce.tests.util;
-
-import org.eclipse.viatra.examples.library.Book;
-import org.eclipse.viatra.examples.library.Writer;
-import org.eclipse.viatra.query.runtime.api.IMatchProcessor;
-import org.eclipse.viatra.query.runtime.runonce.tests.LongSciFiBooksOfAuthorMatch;
-
-/**
- * A match processor tailored for the org.eclipse.viatra.query.runtime.runonce.tests.longSciFiBooksOfAuthor pattern.
- *
- * Clients should derive an (anonymous) class that implements the abstract process().
- *
- */
-@SuppressWarnings("all")
-public abstract class LongSciFiBooksOfAuthorProcessor implements IMatchProcessor<LongSciFiBooksOfAuthorMatch> {
- /**
- * Defines the action that is to be executed on each match.
- * @param pAuthor the value of pattern parameter author in the currently processed match
- * @param pBook the value of pattern parameter book in the currently processed match
- *
- */
- public abstract void process(final Writer pAuthor, final Book pBook);
-
- @Override
- public void process(final LongSciFiBooksOfAuthorMatch match) {
- process(match.getAuthor(), match.getBook());
- }
-}
diff --git a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/LongSciFiBooksOfAuthorQuerySpecification.java b/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/LongSciFiBooksOfAuthorQuerySpecification.java
deleted file mode 100644
index 0b305e2..0000000
--- a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/LongSciFiBooksOfAuthorQuerySpecification.java
+++ /dev/null
@@ -1,175 +0,0 @@
-package org.eclipse.viatra.query.runtime.runonce.tests.util;
-
-import com.google.common.collect.Sets;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Set;
-import org.eclipse.emf.ecore.EClass;
-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.emf.types.EClassTransitiveInstancesKey;
-import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey;
-import org.eclipse.viatra.query.runtime.exception.ViatraQueryException;
-import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator;
-import org.eclipse.viatra.query.runtime.matchers.psystem.IValueProvider;
-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.ExpressionEvaluation;
-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.QueryInitializationException;
-import org.eclipse.viatra.query.runtime.matchers.tuple.FlatTuple;
-import org.eclipse.viatra.query.runtime.runonce.tests.LongSciFiBooksOfAuthorMatch;
-import org.eclipse.viatra.query.runtime.runonce.tests.LongSciFiBooksOfAuthorMatcher;
-
-/**
- * A pattern-specific query specification that can instantiate LongSciFiBooksOfAuthorMatcher in a type-safe way.
- *
- * @see LongSciFiBooksOfAuthorMatcher
- * @see LongSciFiBooksOfAuthorMatch
- *
- */
-@SuppressWarnings("all")
-public final class LongSciFiBooksOfAuthorQuerySpecification extends BaseGeneratedEMFQuerySpecification<LongSciFiBooksOfAuthorMatcher> {
- private LongSciFiBooksOfAuthorQuerySpecification() {
- super(GeneratedPQuery.INSTANCE);
- }
-
- /**
- * @return the singleton instance of the query specification
- * @throws ViatraQueryException if the pattern definition could not be loaded
- *
- */
- public static LongSciFiBooksOfAuthorQuerySpecification instance() throws ViatraQueryException {
- try{
- return LazyHolder.INSTANCE;
- } catch (ExceptionInInitializerError err) {
- throw processInitializerError(err);
- }
- }
-
- @Override
- protected LongSciFiBooksOfAuthorMatcher instantiate(final ViatraQueryEngine engine) throws ViatraQueryException {
- return LongSciFiBooksOfAuthorMatcher.on(engine);
- }
-
- @Override
- public LongSciFiBooksOfAuthorMatch newEmptyMatch() {
- return LongSciFiBooksOfAuthorMatch.newEmptyMatch();
- }
-
- @Override
- public LongSciFiBooksOfAuthorMatch newMatch(final Object... parameters) {
- return LongSciFiBooksOfAuthorMatch.newMatch((org.eclipse.viatra.examples.library.Writer) parameters[0], (org.eclipse.viatra.examples.library.Book) parameters[1]);
- }
-
- /**
- * Inner class allowing the singleton instance of {@link LongSciFiBooksOfAuthorQuerySpecification} to be created
- * <b>not</b> at the class load time of the outer class,
- * but rather at the first call to {@link LongSciFiBooksOfAuthorQuerySpecification#instance()}.
- *
- * <p> This workaround is required e.g. to support recursion.
- *
- */
- private static class LazyHolder {
- private final static LongSciFiBooksOfAuthorQuerySpecification INSTANCE = new LongSciFiBooksOfAuthorQuerySpecification();
-
- /**
- * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
- * This initialization order is required to support indirect recursion.
- *
- * <p> 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.ensureInitializedInternalSneaky();
- return null;
- }
- }
-
- private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
- private final static LongSciFiBooksOfAuthorQuerySpecification.GeneratedPQuery INSTANCE = new GeneratedPQuery();
-
- @Override
- public String getFullyQualifiedName() {
- return "org.eclipse.viatra.query.runtime.runonce.tests.longSciFiBooksOfAuthor";
- }
-
- @Override
- public List<String> getParameterNames() {
- return Arrays.asList("author","book");
- }
-
- @Override
- public List<PParameter> getParameters() {
- return Arrays.asList(
- new PParameter("author", "org.eclipse.viatra.examples.library.Writer", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.eclipse.org/viatra/examples/library/1.0", "Writer"))),
- new PParameter("book", "org.eclipse.viatra.examples.library.Book", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.eclipse.org/viatra/examples/library/1.0", "Book")))
- );
- }
-
- @Override
- public Set<PBody> doGetContainedBodies() throws QueryInitializationException {
- Set<PBody> bodies = Sets.newLinkedHashSet();
- try {
- {
- PBody body = new PBody(this);
- PVariable var_author = body.getOrCreateVariableByName("author");
- PVariable var_book = body.getOrCreateVariableByName("book");
- PVariable var_pages = body.getOrCreateVariableByName("pages");
- new TypeConstraint(body, new FlatTuple(var_author), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/viatra/examples/library/1.0", "Writer")));
- new TypeConstraint(body, new FlatTuple(var_book), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/viatra/examples/library/1.0", "Book")));
- body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
- new ExportedParameter(body, var_author, "author"),
- new ExportedParameter(body, var_book, "book")
- ));
- // Writer.scifiBooks(author, book)
- new TypeConstraint(body, new FlatTuple(var_author), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/viatra/examples/library/1.0", "Writer")));
- PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
- new TypeConstraint(body, new FlatTuple(var_author, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.eclipse.org/viatra/examples/library/1.0", "Writer", "scifiBooks")));
- new Equality(body, var__virtual_0_, var_book);
- // Book.pages(book, pages)
- new TypeConstraint(body, new FlatTuple(var_book), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/viatra/examples/library/1.0", "Book")));
- PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}");
- new TypeConstraint(body, new FlatTuple(var_book, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.eclipse.org/viatra/examples/library/1.0", "Book", "pages")));
- new Equality(body, var__virtual_1_, var_pages);
- // check(pages > 100)
- new ExpressionEvaluation(body, new IExpressionEvaluator() {
-
- @Override
- public String getShortDescription() {
- return "Expression evaluation from pattern longSciFiBooksOfAuthor";
- }
-
- @Override
- public Iterable<String> getInputParameterNames() {
- return Arrays.asList("pages");
- }
-
- @Override
- public Object evaluateExpression(IValueProvider provider) throws Exception {
- java.lang.Integer pages = (java.lang.Integer) provider.getValue("pages");
- return evaluateExpression_1_1(pages);
- }
-
- }, null);
- bodies.add(body);
- }
- // to silence compiler error
- if (false) throw new ViatraQueryException("Never", "happens");
- } catch (ViatraQueryException ex) {
- throw processDependencyException(ex);
- }
- return bodies;
- }
- }
-
- private static boolean evaluateExpression_1_1(final Integer pages) {
- return ((pages).intValue() > 100);
- }
-}
diff --git a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/RequestCountOfLibraryProcessor.java b/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/RequestCountOfLibraryProcessor.java
deleted file mode 100644
index 36da743..0000000
--- a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/RequestCountOfLibraryProcessor.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.eclipse.viatra.query.runtime.runonce.tests.util;
-
-import org.eclipse.viatra.examples.library.Library;
-import org.eclipse.viatra.query.runtime.api.IMatchProcessor;
-import org.eclipse.viatra.query.runtime.runonce.tests.RequestCountOfLibraryMatch;
-
-/**
- * A match processor tailored for the org.eclipse.viatra.query.runtime.runonce.tests.requestCountOfLibrary pattern.
- *
- * Clients should derive an (anonymous) class that implements the abstract process().
- *
- */
-@SuppressWarnings("all")
-public abstract class RequestCountOfLibraryProcessor implements IMatchProcessor<RequestCountOfLibraryMatch> {
- /**
- * Defines the action that is to be executed on each match.
- * @param pLibrary the value of pattern parameter library in the currently processed match
- * @param pReqCount the value of pattern parameter reqCount in the currently processed match
- *
- */
- public abstract void process(final Library pLibrary, final Integer pReqCount);
-
- @Override
- public void process(final RequestCountOfLibraryMatch match) {
- process(match.getLibrary(), match.getReqCount());
- }
-}
diff --git a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/RequestCountOfLibraryQuerySpecification.java b/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/RequestCountOfLibraryQuerySpecification.java
deleted file mode 100644
index b2d2122..0000000
--- a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/RequestCountOfLibraryQuerySpecification.java
+++ /dev/null
@@ -1,141 +0,0 @@
-package org.eclipse.viatra.query.runtime.runonce.tests.util;
-
-import com.google.common.collect.Sets;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Set;
-import org.eclipse.emf.ecore.EClass;
-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.emf.types.EClassTransitiveInstancesKey;
-import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey;
-import org.eclipse.viatra.query.runtime.exception.ViatraQueryException;
-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.basicenumerables.TypeConstraint;
-import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
-import org.eclipse.viatra.query.runtime.matchers.psystem.queries.QueryInitializationException;
-import org.eclipse.viatra.query.runtime.matchers.tuple.FlatTuple;
-import org.eclipse.viatra.query.runtime.runonce.tests.RequestCountOfLibraryMatch;
-import org.eclipse.viatra.query.runtime.runonce.tests.RequestCountOfLibraryMatcher;
-
-/**
- * A pattern-specific query specification that can instantiate RequestCountOfLibraryMatcher in a type-safe way.
- *
- * @see RequestCountOfLibraryMatcher
- * @see RequestCountOfLibraryMatch
- *
- */
-@SuppressWarnings("all")
-public final class RequestCountOfLibraryQuerySpecification extends BaseGeneratedEMFQuerySpecification<RequestCountOfLibraryMatcher> {
- private RequestCountOfLibraryQuerySpecification() {
- super(GeneratedPQuery.INSTANCE);
- }
-
- /**
- * @return the singleton instance of the query specification
- * @throws ViatraQueryException if the pattern definition could not be loaded
- *
- */
- public static RequestCountOfLibraryQuerySpecification instance() throws ViatraQueryException {
- try{
- return LazyHolder.INSTANCE;
- } catch (ExceptionInInitializerError err) {
- throw processInitializerError(err);
- }
- }
-
- @Override
- protected RequestCountOfLibraryMatcher instantiate(final ViatraQueryEngine engine) throws ViatraQueryException {
- return RequestCountOfLibraryMatcher.on(engine);
- }
-
- @Override
- public RequestCountOfLibraryMatch newEmptyMatch() {
- return RequestCountOfLibraryMatch.newEmptyMatch();
- }
-
- @Override
- public RequestCountOfLibraryMatch newMatch(final Object... parameters) {
- return RequestCountOfLibraryMatch.newMatch((org.eclipse.viatra.examples.library.Library) parameters[0], (java.lang.Integer) parameters[1]);
- }
-
- /**
- * Inner class allowing the singleton instance of {@link RequestCountOfLibraryQuerySpecification} to be created
- * <b>not</b> at the class load time of the outer class,
- * but rather at the first call to {@link RequestCountOfLibraryQuerySpecification#instance()}.
- *
- * <p> This workaround is required e.g. to support recursion.
- *
- */
- private static class LazyHolder {
- private final static RequestCountOfLibraryQuerySpecification INSTANCE = new RequestCountOfLibraryQuerySpecification();
-
- /**
- * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
- * This initialization order is required to support indirect recursion.
- *
- * <p> 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.ensureInitializedInternalSneaky();
- return null;
- }
- }
-
- private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
- private final static RequestCountOfLibraryQuerySpecification.GeneratedPQuery INSTANCE = new GeneratedPQuery();
-
- @Override
- public String getFullyQualifiedName() {
- return "org.eclipse.viatra.query.runtime.runonce.tests.requestCountOfLibrary";
- }
-
- @Override
- public List<String> getParameterNames() {
- return Arrays.asList("library","reqCount");
- }
-
- @Override
- public List<PParameter> getParameters() {
- return Arrays.asList(
- new PParameter("library", "org.eclipse.viatra.examples.library.Library", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.eclipse.org/viatra/examples/library/1.0", "Library"))),
- new PParameter("reqCount", "java.lang.Integer", null)
- );
- }
-
- @Override
- public Set<PBody> doGetContainedBodies() throws QueryInitializationException {
- Set<PBody> bodies = Sets.newLinkedHashSet();
- try {
- {
- PBody body = new PBody(this);
- PVariable var_library = body.getOrCreateVariableByName("library");
- PVariable var_reqCount = body.getOrCreateVariableByName("reqCount");
- new TypeConstraint(body, new FlatTuple(var_library), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/viatra/examples/library/1.0", "Library")));
- body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
- new ExportedParameter(body, var_library, "library"),
- new ExportedParameter(body, var_reqCount, "reqCount")
- ));
- // Library.requestCount(library, reqCount)
- new TypeConstraint(body, new FlatTuple(var_library), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/viatra/examples/library/1.0", "Library")));
- PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
- new TypeConstraint(body, new FlatTuple(var_library, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.eclipse.org/viatra/examples/library/1.0", "Library", "requestCount")));
- new Equality(body, var__virtual_0_, var_reqCount);
- bodies.add(body);
- }
- // to silence compiler error
- if (false) throw new ViatraQueryException("Never", "happens");
- } catch (ViatraQueryException ex) {
- throw processDependencyException(ex);
- }
- return bodies;
- }
- }
-}
diff --git a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/SingleAuthoredFirstBooksProcessor.java b/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/SingleAuthoredFirstBooksProcessor.java
deleted file mode 100644
index fd44b2c..0000000
--- a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/SingleAuthoredFirstBooksProcessor.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.eclipse.viatra.query.runtime.runonce.tests.util;
-
-import org.eclipse.viatra.examples.library.Book;
-import org.eclipse.viatra.examples.library.Library;
-import org.eclipse.viatra.query.runtime.api.IMatchProcessor;
-import org.eclipse.viatra.query.runtime.runonce.tests.SingleAuthoredFirstBooksMatch;
-
-/**
- * A match processor tailored for the org.eclipse.viatra.query.runtime.runonce.tests.singleAuthoredFirstBooks pattern.
- *
- * Clients should derive an (anonymous) class that implements the abstract process().
- *
- */
-@SuppressWarnings("all")
-public abstract class SingleAuthoredFirstBooksProcessor implements IMatchProcessor<SingleAuthoredFirstBooksMatch> {
- /**
- * Defines the action that is to be executed on each match.
- * @param pLibrary the value of pattern parameter library in the currently processed match
- * @param pFirstBook the value of pattern parameter firstBook in the currently processed match
- *
- */
- public abstract void process(final Library pLibrary, final Book pFirstBook);
-
- @Override
- public void process(final SingleAuthoredFirstBooksMatch match) {
- process(match.getLibrary(), match.getFirstBook());
- }
-}
diff --git a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/SingleAuthoredFirstBooksQuerySpecification.java b/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/SingleAuthoredFirstBooksQuerySpecification.java
deleted file mode 100644
index 8ea6414..0000000
--- a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/SingleAuthoredFirstBooksQuerySpecification.java
+++ /dev/null
@@ -1,154 +0,0 @@
-package org.eclipse.viatra.query.runtime.runonce.tests.util;
-
-import com.google.common.collect.Sets;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Set;
-import org.eclipse.emf.ecore.EClass;
-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.emf.types.EClassTransitiveInstancesKey;
-import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey;
-import org.eclipse.viatra.query.runtime.exception.ViatraQueryException;
-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.PatternMatchCounter;
-import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.ConstantValue;
-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.QueryInitializationException;
-import org.eclipse.viatra.query.runtime.matchers.tuple.FlatTuple;
-import org.eclipse.viatra.query.runtime.runonce.tests.SingleAuthoredFirstBooksMatch;
-import org.eclipse.viatra.query.runtime.runonce.tests.SingleAuthoredFirstBooksMatcher;
-import org.eclipse.viatra.query.runtime.runonce.tests.util.BookAuthorsQuerySpecification;
-
-/**
- * A pattern-specific query specification that can instantiate SingleAuthoredFirstBooksMatcher in a type-safe way.
- *
- * @see SingleAuthoredFirstBooksMatcher
- * @see SingleAuthoredFirstBooksMatch
- *
- */
-@SuppressWarnings("all")
-public final class SingleAuthoredFirstBooksQuerySpecification extends BaseGeneratedEMFQuerySpecification<SingleAuthoredFirstBooksMatcher> {
- private SingleAuthoredFirstBooksQuerySpecification() {
- super(GeneratedPQuery.INSTANCE);
- }
-
- /**
- * @return the singleton instance of the query specification
- * @throws ViatraQueryException if the pattern definition could not be loaded
- *
- */
- public static SingleAuthoredFirstBooksQuerySpecification instance() throws ViatraQueryException {
- try{
- return LazyHolder.INSTANCE;
- } catch (ExceptionInInitializerError err) {
- throw processInitializerError(err);
- }
- }
-
- @Override
- protected SingleAuthoredFirstBooksMatcher instantiate(final ViatraQueryEngine engine) throws ViatraQueryException {
- return SingleAuthoredFirstBooksMatcher.on(engine);
- }
-
- @Override
- public SingleAuthoredFirstBooksMatch newEmptyMatch() {
- return SingleAuthoredFirstBooksMatch.newEmptyMatch();
- }
-
- @Override
- public SingleAuthoredFirstBooksMatch newMatch(final Object... parameters) {
- return SingleAuthoredFirstBooksMatch.newMatch((org.eclipse.viatra.examples.library.Library) parameters[0], (org.eclipse.viatra.examples.library.Book) parameters[1]);
- }
-
- /**
- * Inner class allowing the singleton instance of {@link SingleAuthoredFirstBooksQuerySpecification} to be created
- * <b>not</b> at the class load time of the outer class,
- * but rather at the first call to {@link SingleAuthoredFirstBooksQuerySpecification#instance()}.
- *
- * <p> This workaround is required e.g. to support recursion.
- *
- */
- private static class LazyHolder {
- private final static SingleAuthoredFirstBooksQuerySpecification INSTANCE = new SingleAuthoredFirstBooksQuerySpecification();
-
- /**
- * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
- * This initialization order is required to support indirect recursion.
- *
- * <p> 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.ensureInitializedInternalSneaky();
- return null;
- }
- }
-
- private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
- private final static SingleAuthoredFirstBooksQuerySpecification.GeneratedPQuery INSTANCE = new GeneratedPQuery();
-
- @Override
- public String getFullyQualifiedName() {
- return "org.eclipse.viatra.query.runtime.runonce.tests.singleAuthoredFirstBooks";
- }
-
- @Override
- public List<String> getParameterNames() {
- return Arrays.asList("library","firstBook");
- }
-
- @Override
- public List<PParameter> getParameters() {
- return Arrays.asList(
- new PParameter("library", "org.eclipse.viatra.examples.library.Library", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.eclipse.org/viatra/examples/library/1.0", "Library"))),
- new PParameter("firstBook", "org.eclipse.viatra.examples.library.Book", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.eclipse.org/viatra/examples/library/1.0", "Book")))
- );
- }
-
- @Override
- public Set<PBody> doGetContainedBodies() throws QueryInitializationException {
- Set<PBody> bodies = Sets.newLinkedHashSet();
- try {
- {
- PBody body = new PBody(this);
- PVariable var_library = body.getOrCreateVariableByName("library");
- PVariable var_firstBook = body.getOrCreateVariableByName("firstBook");
- PVariable var__author = body.getOrCreateVariableByName("_author");
- new TypeConstraint(body, new FlatTuple(var_library), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/viatra/examples/library/1.0", "Library")));
- new TypeConstraint(body, new FlatTuple(var_firstBook), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/viatra/examples/library/1.0", "Book")));
- body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
- new ExportedParameter(body, var_library, "library"),
- new ExportedParameter(body, var_firstBook, "firstBook")
- ));
- // Library.writers.firstBook(library, firstBook)
- new TypeConstraint(body, new FlatTuple(var_library), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/viatra/examples/library/1.0", "Library")));
- PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
- new TypeConstraint(body, new FlatTuple(var_library, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.eclipse.org/viatra/examples/library/1.0", "Library", "writers")));
- PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}");
- new TypeConstraint(body, new FlatTuple(var__virtual_0_, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.eclipse.org/viatra/examples/library/1.0", "Writer", "firstBook")));
- new Equality(body, var__virtual_1_, var_firstBook);
- // 1 == count find bookAuthors(firstBook, _author)
- PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}");
- new ConstantValue(body, var__virtual_2_, 1);
- PVariable var__virtual_3_ = body.getOrCreateVariableByName(".virtual{3}");
- new PatternMatchCounter(body, new FlatTuple(var_firstBook, var__author), BookAuthorsQuerySpecification.instance().getInternalQueryRepresentation(), var__virtual_3_);
- new Equality(body, var__virtual_2_, var__virtual_3_);
- bodies.add(body);
- }
- // to silence compiler error
- if (false) throw new ViatraQueryException("Never", "happens");
- } catch (ViatraQueryException ex) {
- throw processDependencyException(ex);
- }
- return bodies;
- }
- }
-}
diff --git a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/SomeBooksWithTwoAuthorsProcessor.java b/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/SomeBooksWithTwoAuthorsProcessor.java
deleted file mode 100644
index bdd5e7b..0000000
--- a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/SomeBooksWithTwoAuthorsProcessor.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.eclipse.viatra.query.runtime.runonce.tests.util;
-
-import org.eclipse.viatra.examples.library.Book;
-import org.eclipse.viatra.examples.library.Library;
-import org.eclipse.viatra.query.runtime.api.IMatchProcessor;
-import org.eclipse.viatra.query.runtime.runonce.tests.SomeBooksWithTwoAuthorsMatch;
-
-/**
- * A match processor tailored for the org.eclipse.viatra.query.runtime.runonce.tests.someBooksWithTwoAuthors pattern.
- *
- * Clients should derive an (anonymous) class that implements the abstract process().
- *
- */
-@SuppressWarnings("all")
-public abstract class SomeBooksWithTwoAuthorsProcessor implements IMatchProcessor<SomeBooksWithTwoAuthorsMatch> {
- /**
- * Defines the action that is to be executed on each match.
- * @param pLibrary the value of pattern parameter library in the currently processed match
- * @param pBook the value of pattern parameter book in the currently processed match
- *
- */
- public abstract void process(final Library pLibrary, final Book pBook);
-
- @Override
- public void process(final SomeBooksWithTwoAuthorsMatch match) {
- process(match.getLibrary(), match.getBook());
- }
-}
diff --git a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/SomeBooksWithTwoAuthorsQuerySpecification.java b/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/SomeBooksWithTwoAuthorsQuerySpecification.java
deleted file mode 100644
index 7a03a63..0000000
--- a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/SomeBooksWithTwoAuthorsQuerySpecification.java
+++ /dev/null
@@ -1,158 +0,0 @@
-package org.eclipse.viatra.query.runtime.runonce.tests.util;
-
-import com.google.common.collect.Sets;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Set;
-import org.eclipse.emf.ecore.EClass;
-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.emf.types.EClassTransitiveInstancesKey;
-import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey;
-import org.eclipse.viatra.query.runtime.exception.ViatraQueryException;
-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.PatternMatchCounter;
-import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.ConstantValue;
-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.QueryInitializationException;
-import org.eclipse.viatra.query.runtime.matchers.tuple.FlatTuple;
-import org.eclipse.viatra.query.runtime.runonce.tests.SomeBooksWithTwoAuthorsMatch;
-import org.eclipse.viatra.query.runtime.runonce.tests.SomeBooksWithTwoAuthorsMatcher;
-import org.eclipse.viatra.query.runtime.runonce.tests.util.BookAuthorsQuerySpecification;
-
-/**
- * A pattern-specific query specification that can instantiate SomeBooksWithTwoAuthorsMatcher in a type-safe way.
- *
- * @see SomeBooksWithTwoAuthorsMatcher
- * @see SomeBooksWithTwoAuthorsMatch
- *
- */
-@SuppressWarnings("all")
-public final class SomeBooksWithTwoAuthorsQuerySpecification extends BaseGeneratedEMFQuerySpecification<SomeBooksWithTwoAuthorsMatcher> {
- private SomeBooksWithTwoAuthorsQuerySpecification() {
- super(GeneratedPQuery.INSTANCE);
- }
-
- /**
- * @return the singleton instance of the query specification
- * @throws ViatraQueryException if the pattern definition could not be loaded
- *
- */
- public static SomeBooksWithTwoAuthorsQuerySpecification instance() throws ViatraQueryException {
- try{
- return LazyHolder.INSTANCE;
- } catch (ExceptionInInitializerError err) {
- throw processInitializerError(err);
- }
- }
-
- @Override
- protected SomeBooksWithTwoAuthorsMatcher instantiate(final ViatraQueryEngine engine) throws ViatraQueryException {
- return SomeBooksWithTwoAuthorsMatcher.on(engine);
- }
-
- @Override
- public SomeBooksWithTwoAuthorsMatch newEmptyMatch() {
- return SomeBooksWithTwoAuthorsMatch.newEmptyMatch();
- }
-
- @Override
- public SomeBooksWithTwoAuthorsMatch newMatch(final Object... parameters) {
- return SomeBooksWithTwoAuthorsMatch.newMatch((org.eclipse.viatra.examples.library.Library) parameters[0], (org.eclipse.viatra.examples.library.Book) parameters[1]);
- }
-
- /**
- * Inner class allowing the singleton instance of {@link SomeBooksWithTwoAuthorsQuerySpecification} to be created
- * <b>not</b> at the class load time of the outer class,
- * but rather at the first call to {@link SomeBooksWithTwoAuthorsQuerySpecification#instance()}.
- *
- * <p> This workaround is required e.g. to support recursion.
- *
- */
- private static class LazyHolder {
- private final static SomeBooksWithTwoAuthorsQuerySpecification INSTANCE = new SomeBooksWithTwoAuthorsQuerySpecification();
-
- /**
- * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
- * This initialization order is required to support indirect recursion.
- *
- * <p> 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.ensureInitializedInternalSneaky();
- return null;
- }
- }
-
- private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
- private final static SomeBooksWithTwoAuthorsQuerySpecification.GeneratedPQuery INSTANCE = new GeneratedPQuery();
-
- @Override
- public String getFullyQualifiedName() {
- return "org.eclipse.viatra.query.runtime.runonce.tests.someBooksWithTwoAuthors";
- }
-
- @Override
- public List<String> getParameterNames() {
- return Arrays.asList("library","book");
- }
-
- @Override
- public List<PParameter> getParameters() {
- return Arrays.asList(
- new PParameter("library", "org.eclipse.viatra.examples.library.Library", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.eclipse.org/viatra/examples/library/1.0", "Library"))),
- new PParameter("book", "org.eclipse.viatra.examples.library.Book", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.eclipse.org/viatra/examples/library/1.0", "Book")))
- );
- }
-
- @Override
- public Set<PBody> doGetContainedBodies() throws QueryInitializationException {
- Set<PBody> bodies = Sets.newLinkedHashSet();
- try {
- {
- PBody body = new PBody(this);
- PVariable var_library = body.getOrCreateVariableByName("library");
- PVariable var_book = body.getOrCreateVariableByName("book");
- PVariable var__c = body.getOrCreateVariableByName("_c");
- PVariable var__author = body.getOrCreateVariableByName("_author");
- new TypeConstraint(body, new FlatTuple(var_library), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/viatra/examples/library/1.0", "Library")));
- new TypeConstraint(body, new FlatTuple(var_book), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/viatra/examples/library/1.0", "Book")));
- body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
- new ExportedParameter(body, var_library, "library"),
- new ExportedParameter(body, var_book, "book")
- ));
- // Library.requestCount(library, _c)
- new TypeConstraint(body, new FlatTuple(var_library), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/viatra/examples/library/1.0", "Library")));
- PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
- new TypeConstraint(body, new FlatTuple(var_library, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.eclipse.org/viatra/examples/library/1.0", "Library", "requestCount")));
- new Equality(body, var__virtual_0_, var__c);
- // Library.someBooks(library, book)
- new TypeConstraint(body, new FlatTuple(var_library), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/viatra/examples/library/1.0", "Library")));
- PVariable var__virtual_1_ = body.getOrCreateVariableByName(".virtual{1}");
- new TypeConstraint(body, new FlatTuple(var_library, var__virtual_1_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.eclipse.org/viatra/examples/library/1.0", "Library", "someBooks")));
- new Equality(body, var__virtual_1_, var_book);
- // 2 == count find bookAuthors(book, _author)
- PVariable var__virtual_2_ = body.getOrCreateVariableByName(".virtual{2}");
- new ConstantValue(body, var__virtual_2_, 2);
- PVariable var__virtual_3_ = body.getOrCreateVariableByName(".virtual{3}");
- new PatternMatchCounter(body, new FlatTuple(var_book, var__author), BookAuthorsQuerySpecification.instance().getInternalQueryRepresentation(), var__virtual_3_);
- new Equality(body, var__virtual_2_, var__virtual_3_);
- bodies.add(body);
- }
- // to silence compiler error
- if (false) throw new ViatraQueryException("Never", "happens");
- } catch (ViatraQueryException ex) {
- throw processDependencyException(ex);
- }
- return bodies;
- }
- }
-}
diff --git a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/SumOfPagesInLibraryProcessor.java b/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/SumOfPagesInLibraryProcessor.java
deleted file mode 100644
index 3c83cdb..0000000
--- a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/SumOfPagesInLibraryProcessor.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.eclipse.viatra.query.runtime.runonce.tests.util;
-
-import org.eclipse.viatra.examples.library.Library;
-import org.eclipse.viatra.query.runtime.api.IMatchProcessor;
-import org.eclipse.viatra.query.runtime.runonce.tests.SumOfPagesInLibraryMatch;
-
-/**
- * A match processor tailored for the org.eclipse.viatra.query.runtime.runonce.tests.sumOfPagesInLibrary pattern.
- *
- * Clients should derive an (anonymous) class that implements the abstract process().
- *
- */
-@SuppressWarnings("all")
-public abstract class SumOfPagesInLibraryProcessor implements IMatchProcessor<SumOfPagesInLibraryMatch> {
- /**
- * Defines the action that is to be executed on each match.
- * @param pLibrary the value of pattern parameter library in the currently processed match
- * @param pSumOfPages the value of pattern parameter sumOfPages in the currently processed match
- *
- */
- public abstract void process(final Library pLibrary, final Integer pSumOfPages);
-
- @Override
- public void process(final SumOfPagesInLibraryMatch match) {
- process(match.getLibrary(), match.getSumOfPages());
- }
-}
diff --git a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/SumOfPagesInLibraryQuerySpecification.java b/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/SumOfPagesInLibraryQuerySpecification.java
deleted file mode 100644
index d8b7c09..0000000
--- a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/SumOfPagesInLibraryQuerySpecification.java
+++ /dev/null
@@ -1,141 +0,0 @@
-package org.eclipse.viatra.query.runtime.runonce.tests.util;
-
-import com.google.common.collect.Sets;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Set;
-import org.eclipse.emf.ecore.EClass;
-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.emf.types.EClassTransitiveInstancesKey;
-import org.eclipse.viatra.query.runtime.emf.types.EStructuralFeatureInstancesKey;
-import org.eclipse.viatra.query.runtime.exception.ViatraQueryException;
-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.basicenumerables.TypeConstraint;
-import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter;
-import org.eclipse.viatra.query.runtime.matchers.psystem.queries.QueryInitializationException;
-import org.eclipse.viatra.query.runtime.matchers.tuple.FlatTuple;
-import org.eclipse.viatra.query.runtime.runonce.tests.SumOfPagesInLibraryMatch;
-import org.eclipse.viatra.query.runtime.runonce.tests.SumOfPagesInLibraryMatcher;
-
-/**
- * A pattern-specific query specification that can instantiate SumOfPagesInLibraryMatcher in a type-safe way.
- *
- * @see SumOfPagesInLibraryMatcher
- * @see SumOfPagesInLibraryMatch
- *
- */
-@SuppressWarnings("all")
-public final class SumOfPagesInLibraryQuerySpecification extends BaseGeneratedEMFQuerySpecification<SumOfPagesInLibraryMatcher> {
- private SumOfPagesInLibraryQuerySpecification() {
- super(GeneratedPQuery.INSTANCE);
- }
-
- /**
- * @return the singleton instance of the query specification
- * @throws ViatraQueryException if the pattern definition could not be loaded
- *
- */
- public static SumOfPagesInLibraryQuerySpecification instance() throws ViatraQueryException {
- try{
- return LazyHolder.INSTANCE;
- } catch (ExceptionInInitializerError err) {
- throw processInitializerError(err);
- }
- }
-
- @Override
- protected SumOfPagesInLibraryMatcher instantiate(final ViatraQueryEngine engine) throws ViatraQueryException {
- return SumOfPagesInLibraryMatcher.on(engine);
- }
-
- @Override
- public SumOfPagesInLibraryMatch newEmptyMatch() {
- return SumOfPagesInLibraryMatch.newEmptyMatch();
- }
-
- @Override
- public SumOfPagesInLibraryMatch newMatch(final Object... parameters) {
- return SumOfPagesInLibraryMatch.newMatch((org.eclipse.viatra.examples.library.Library) parameters[0], (java.lang.Integer) parameters[1]);
- }
-
- /**
- * Inner class allowing the singleton instance of {@link SumOfPagesInLibraryQuerySpecification} to be created
- * <b>not</b> at the class load time of the outer class,
- * but rather at the first call to {@link SumOfPagesInLibraryQuerySpecification#instance()}.
- *
- * <p> This workaround is required e.g. to support recursion.
- *
- */
- private static class LazyHolder {
- private final static SumOfPagesInLibraryQuerySpecification INSTANCE = new SumOfPagesInLibraryQuerySpecification();
-
- /**
- * Statically initializes the query specification <b>after</b> the field {@link #INSTANCE} is assigned.
- * This initialization order is required to support indirect recursion.
- *
- * <p> 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.ensureInitializedInternalSneaky();
- return null;
- }
- }
-
- private static class GeneratedPQuery extends BaseGeneratedEMFPQuery {
- private final static SumOfPagesInLibraryQuerySpecification.GeneratedPQuery INSTANCE = new GeneratedPQuery();
-
- @Override
- public String getFullyQualifiedName() {
- return "org.eclipse.viatra.query.runtime.runonce.tests.sumOfPagesInLibrary";
- }
-
- @Override
- public List<String> getParameterNames() {
- return Arrays.asList("library","sumOfPages");
- }
-
- @Override
- public List<PParameter> getParameters() {
- return Arrays.asList(
- new PParameter("library", "org.eclipse.viatra.examples.library.Library", new EClassTransitiveInstancesKey((EClass)getClassifierLiteralSafe("http://www.eclipse.org/viatra/examples/library/1.0", "Library"))),
- new PParameter("sumOfPages", "java.lang.Integer", null)
- );
- }
-
- @Override
- public Set<PBody> doGetContainedBodies() throws QueryInitializationException {
- Set<PBody> bodies = Sets.newLinkedHashSet();
- try {
- {
- PBody body = new PBody(this);
- PVariable var_library = body.getOrCreateVariableByName("library");
- PVariable var_sumOfPages = body.getOrCreateVariableByName("sumOfPages");
- new TypeConstraint(body, new FlatTuple(var_library), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/viatra/examples/library/1.0", "Library")));
- body.setSymbolicParameters(Arrays.<ExportedParameter>asList(
- new ExportedParameter(body, var_library, "library"),
- new ExportedParameter(body, var_sumOfPages, "sumOfPages")
- ));
- // Library.sumOfPages(library, sumOfPages)
- new TypeConstraint(body, new FlatTuple(var_library), new EClassTransitiveInstancesKey((EClass)getClassifierLiteral("http://www.eclipse.org/viatra/examples/library/1.0", "Library")));
- PVariable var__virtual_0_ = body.getOrCreateVariableByName(".virtual{0}");
- new TypeConstraint(body, new FlatTuple(var_library, var__virtual_0_), new EStructuralFeatureInstancesKey(getFeatureLiteral("http://www.eclipse.org/viatra/examples/library/1.0", "Library", "sumOfPages")));
- new Equality(body, var__virtual_0_, var_sumOfPages);
- bodies.add(body);
- }
- // to silence compiler error
- if (false) throw new ViatraQueryException("Never", "happens");
- } catch (ViatraQueryException ex) {
- throw processDependencyException(ex);
- }
- return bodies;
- }
- }
-}
diff --git a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src/org/eclipse/viatra/query/runtime/runonce/tests/RunOnceTest.java b/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src/org/eclipse/viatra/query/runtime/runonce/tests/RunOnceTest.java
index faac73b..33e4823 100644
--- a/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src/org/eclipse/viatra/query/runtime/runonce/tests/RunOnceTest.java
+++ b/query/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src/org/eclipse/viatra/query/runtime/runonce/tests/RunOnceTest.java
@@ -32,6 +32,7 @@
import org.eclipse.viatra.query.runtime.api.ViatraQueryEngineManager;
import org.eclipse.viatra.query.runtime.api.impl.RunOnceQueryEngine;
import org.eclipse.viatra.query.runtime.base.api.BaseIndexOptions;
+import org.eclipse.viatra.query.runtime.base.api.IndexingLevel;
import org.eclipse.viatra.query.runtime.base.comprehension.WellbehavingDerivedFeatureRegistry;
import org.eclipse.viatra.query.runtime.emf.EMFScope;
import org.eclipse.viatra.query.runtime.exception.ViatraQueryException;
@@ -70,8 +71,8 @@
try {
//RunOnceQueryEngine engine = new RunOnceQueryEngine(rs);
ViatraQueryEngine engine = ViatraQueryEngineManager.getInstance().getQueryEngine(new EMFScope(rs));
-// Collection<BooksWithMultipleAuthorsMatch> allMatches = engine.getAllMatches(BooksWithMultipleAuthorsMatcher.querySpecification());
- Collection<BooksWithMultipleAuthorsMatch> allMatches = engine.getMatcher(BooksWithMultipleAuthorsMatcher.querySpecification()).getAllMatches();
+// Collection<BooksWithMultipleAuthors.Match> all.Matches = engine.getAllMatches(BooksWithMultipleAuthorsMatcher.querySpecification());
+ Collection<BooksWithMultipleAuthors.Match> allMatches = engine.getMatcher(BooksWithMultipleAuthors.Matcher.querySpecification()).getAllMatches();
assertTrue(allMatches.size() == 2);
} catch (ViatraQueryException e) {
e.printStackTrace();
@@ -85,9 +86,9 @@
try {
RunOnceQueryEngine engine = new RunOnceQueryEngine(rs);
- Collection<SumOfPagesInLibraryMatch> allMatches = engine.getAllMatches(SumOfPagesInLibraryMatcher.querySpecification());
+ Collection<SumOfPagesInLibrary.Match> allMatches = engine.getAllMatches(SumOfPagesInLibrary.Matcher.querySpecification());
assertTrue(allMatches.size() == 1);
- SumOfPagesInLibraryMatch match = allMatches.iterator().next();
+ SumOfPagesInLibrary.Match match = allMatches.iterator().next();
assertTrue(match.getLibrary().equals(library));
assertTrue(match.getSumOfPages() == 222);
} catch (ViatraQueryException e) {
@@ -102,9 +103,9 @@
try {
RunOnceQueryEngine engine = new RunOnceQueryEngine(rs);
- Collection<SingleAuthoredFirstBooksMatch> allMatches = engine.getAllMatches(SingleAuthoredFirstBooksMatcher.querySpecification());
+ Collection<SingleAuthoredFirstBooks.Match> allMatches = engine.getAllMatches(SingleAuthoredFirstBooks.Matcher.querySpecification());
assertTrue(allMatches.size() == 1);
- SingleAuthoredFirstBooksMatch match = allMatches.iterator().next();
+ SingleAuthoredFirstBooks.Match match = allMatches.iterator().next();
assertTrue(match.getLibrary().equals(library));
assertTrue(match.getFirstBook().getTitle().equals("Other SciFi"));
} catch (ViatraQueryException e) {
@@ -119,9 +120,9 @@
try {
RunOnceQueryEngine engine = new RunOnceQueryEngine(rs);
- Collection<LongSciFiBooksOfAuthorMatch> allMatches = engine.getAllMatches(LongSciFiBooksOfAuthorMatcher.querySpecification());
+ Collection<LongSciFiBooksOfAuthor.Match> allMatches = engine.getAllMatches(LongSciFiBooksOfAuthor.Matcher.querySpecification());
assertTrue(allMatches.size() == 1);
- LongSciFiBooksOfAuthorMatch match = allMatches.iterator().next();
+ LongSciFiBooksOfAuthor.Match match = allMatches.iterator().next();
assertTrue(match.getAuthor().getName().equals("Third Author"));
assertTrue(match.getBook().getTitle().equals("Other SciFi"));
} catch (ViatraQueryException e) {
@@ -140,9 +141,9 @@
try {
RunOnceQueryEngine engine = new RunOnceQueryEngine(rs);
- Collection<RequestCountOfLibraryMatch> allMatches = engine.getAllMatches(RequestCountOfLibraryMatcher.querySpecification());
+ Collection<RequestCountOfLibrary.Match> allMatches = engine.getAllMatches(RequestCountOfLibrary.Matcher.querySpecification());
assertTrue(allMatches.size() == 1);
- RequestCountOfLibraryMatch match = allMatches.iterator().next();
+ RequestCountOfLibrary.Match match = allMatches.iterator().next();
assertTrue(match.getLibrary().equals(library));
assertTrue(match.getReqCount() == 2);
} catch (ViatraQueryException e) {
@@ -160,13 +161,13 @@
try {
RunOnceQueryEngine engine = new RunOnceQueryEngine(rs);
- Collection<SomeBooksWithTwoAuthorsMatch> allMatches = engine.getAllMatches(SomeBooksWithTwoAuthorsMatcher.querySpecification());
+ Collection<SomeBooksWithTwoAuthors.Match> allMatches = engine.getAllMatches(SomeBooksWithTwoAuthors.Matcher.querySpecification());
assertTrue(allMatches.size() == 1);
- SomeBooksWithTwoAuthorsMatch match = allMatches.iterator().next();
+ SomeBooksWithTwoAuthors.Match match = allMatches.iterator().next();
assertTrue(match.getLibrary().equals(library));
assertTrue(match.getBook().getTitle().equals("Twin life"));
- allMatches = engine.getAllMatches(SomeBooksWithTwoAuthorsMatcher.querySpecification());
+ allMatches = engine.getAllMatches(SomeBooksWithTwoAuthors.Matcher.querySpecification());
assertTrue(allMatches.isEmpty());
} catch (ViatraQueryException e) {
@@ -189,15 +190,15 @@
WellbehavingDerivedFeatureRegistry.registerWellbehavingDerivedPackage(LibraryPackage.eINSTANCE);
AdvancedViatraQueryEngine engine = AdvancedViatraQueryEngine.createUnmanagedEngine(new EMFScope(rs));
// this is to allow the normal engine to traverse feature
- LongSciFiBooksOfAuthorMatcher matcher = engine.getMatcher(LongSciFiBooksOfAuthorMatcher.querySpecification());
- Collection<LongSciFiBooksOfAuthorMatch> allMatches = matcher.getAllMatches();
+ LongSciFiBooksOfAuthor.Matcher matcher = engine.getMatcher(LongSciFiBooksOfAuthor.Matcher.querySpecification());
+ Collection<LongSciFiBooksOfAuthor.Match> allMatches = matcher.getAllMatches();
RunOnceQueryEngine roengine = new RunOnceQueryEngine(rs);
- Collection<LongSciFiBooksOfAuthorMatch> allROMatches = roengine.getAllMatches(LongSciFiBooksOfAuthorMatcher.querySpecification());
+ Collection<LongSciFiBooksOfAuthor.Match> allROMatches = roengine.getAllMatches(LongSciFiBooksOfAuthor.Matcher.querySpecification());
assertTrue(allMatches.size() == allROMatches.size());
- LongSciFiBooksOfAuthorMatch match = allMatches.iterator().next();
- LongSciFiBooksOfAuthorMatch romatch = allROMatches.iterator().next();
+ LongSciFiBooksOfAuthor.Match match = allMatches.iterator().next();
+ LongSciFiBooksOfAuthor.Match romatch = allROMatches.iterator().next();
assertTrue(match.getAuthor() == romatch.getAuthor());
Book longBook = romatch.getBook();
assertTrue(match.getBook() == longBook);
@@ -209,13 +210,13 @@
b.getAuthors().add(library.getWriters().get(0));
library.getBooks().add(b);
- allROMatches = roengine.getAllMatches(LongSciFiBooksOfAuthorMatcher.querySpecification());
+ allROMatches = roengine.getAllMatches(LongSciFiBooksOfAuthor.Matcher.querySpecification());
allMatches = matcher.getAllMatches();
assertTrue(allMatches.size() != allROMatches.size());
assertTrue(allROMatches.size() == 2);
Set<Book> longScifiBooks = new HashSet<Book>();
- for (LongSciFiBooksOfAuthorMatch m : allROMatches) {
+ for (LongSciFiBooksOfAuthor.Match m : allROMatches) {
longScifiBooks.add(m.getBook());
}
assertTrue(longScifiBooks.contains(b));
@@ -253,7 +254,7 @@
try {
RunOnceQueryEngine roengine = new RunOnceQueryEngine(rs);
BaseIndexOptions baseIndexOptions = roengine.getBaseIndexOptions();
- baseIndexOptions.withWildcardMode(true); // ensure all types are indexed
+ baseIndexOptions = baseIndexOptions.withWildcardLevel(IndexingLevel.FULL); // ensure all types are indexed
AdvancedViatraQueryEngine engine = AdvancedViatraQueryEngine.createUnmanagedEngine(new EMFScope(rs,baseIndexOptions));
runModelModification(library, roengine, engine);
@@ -265,14 +266,14 @@
private void runModelModification(Library library, RunOnceQueryEngine roengine, AdvancedViatraQueryEngine engine)
throws ViatraQueryException {
- LongSciFiBooksOfAuthorMatcher matcher = engine.getMatcher(LongSciFiBooksOfAuthorMatcher.querySpecification());
- Collection<LongSciFiBooksOfAuthorMatch> allMatches = matcher.getAllMatches();
+ LongSciFiBooksOfAuthor.Matcher matcher = engine.getMatcher(LongSciFiBooksOfAuthor.Matcher.querySpecification());
+ Collection<LongSciFiBooksOfAuthor.Match> allMatches = matcher.getAllMatches();
- Collection<LongSciFiBooksOfAuthorMatch> allROMatches = roengine.getAllMatches(LongSciFiBooksOfAuthorMatcher.querySpecification());
+ Collection<LongSciFiBooksOfAuthor.Match> allROMatches = roengine.getAllMatches(LongSciFiBooksOfAuthor.Matcher.querySpecification());
assertTrue(allMatches.size() == allROMatches.size());
- LongSciFiBooksOfAuthorMatch match = allMatches.iterator().next();
- LongSciFiBooksOfAuthorMatch romatch = allROMatches.iterator().next();
+ LongSciFiBooksOfAuthor.Match match = allMatches.iterator().next();
+ LongSciFiBooksOfAuthor.Match romatch = allROMatches.iterator().next();
assertTrue(match.getAuthor() == romatch.getAuthor());
Book longBook = romatch.getBook();
assertTrue(match.getBook() == longBook);
@@ -284,7 +285,7 @@
b.getAuthors().add(library.getWriters().get(0));
library.getBooks().add(b);
- allROMatches = roengine.getAllMatches(LongSciFiBooksOfAuthorMatcher.querySpecification());
+ allROMatches = roengine.getAllMatches(LongSciFiBooksOfAuthor.Matcher.querySpecification());
allMatches = matcher.getAllMatches();
assertTrue(allMatches.size() != allROMatches.size());
@@ -296,7 +297,7 @@
assertTrue(allROMatches.size() == 2);
Set<Book> longScifiBooks = new HashSet<Book>();
- for (LongSciFiBooksOfAuthorMatch m : allROMatches) {
+ for (LongSciFiBooksOfAuthor.Match m : allROMatches) {
longScifiBooks.add(m.getBook());
}
assertTrue(longScifiBooks.contains(b));
@@ -315,8 +316,8 @@
RunOnceQueryEngine roengine = new RunOnceQueryEngine(library);
AdvancedViatraQueryEngine engine = AdvancedViatraQueryEngine.createUnmanagedEngine(new EMFScope(library,roengine.getBaseIndexOptions()));
- LongSciFiBooksOfAuthorMatcher matcher = engine.getMatcher(LongSciFiBooksOfAuthorMatcher.querySpecification());
- Collection<LongSciFiBooksOfAuthorMatch> allMatches = matcher.getAllMatches();
+ LongSciFiBooksOfAuthor.Matcher matcher = engine.getMatcher(LongSciFiBooksOfAuthor.Matcher.querySpecification());
+ Collection<LongSciFiBooksOfAuthor.Match> allMatches = matcher.getAllMatches();
assertTrue(allMatches.isEmpty());
Writer writer = createWriter(library, "test");
@@ -326,7 +327,7 @@
allMatches = matcher.getAllMatches();
assertTrue(!allMatches.isEmpty());
- LongSciFiBooksOfAuthorMatch match = allMatches.iterator().next();
+ LongSciFiBooksOfAuthor.Match match = allMatches.iterator().next();
assertTrue(match.getAuthor().equals(writer));
assertTrue(match.getBook().equals(book));
@@ -348,22 +349,22 @@
try {
RunOnceQueryEngine roengine = new RunOnceQueryEngine(library);
roengine.setAutomaticResampling(true);
- Collection<LongSciFiBooksOfAuthorMatch> allMatches = roengine.getAllMatches(LongSciFiBooksOfAuthorMatcher.querySpecification());
+ Collection<LongSciFiBooksOfAuthor.Match> allMatches = roengine.getAllMatches(LongSciFiBooksOfAuthor.Matcher.querySpecification());
assertTrue(allMatches.isEmpty());
Writer writer = createWriter(library, "test");
book.getAuthors().add(writer);
- allMatches = roengine.getAllMatches(LongSciFiBooksOfAuthorMatcher.querySpecification());
+ allMatches = roengine.getAllMatches(LongSciFiBooksOfAuthor.Matcher.querySpecification());
assertTrue(!allMatches.isEmpty());
- LongSciFiBooksOfAuthorMatch match = allMatches.iterator().next();
+ LongSciFiBooksOfAuthor.Match match = allMatches.iterator().next();
assertTrue(match.getAuthor().equals(writer));
assertTrue(match.getBook().equals(book));
roengine.setAutomaticResampling(false);
Writer writer2 = createWriter(library, "test2");
- allMatches = roengine.getAllMatches(LongSciFiBooksOfAuthorMatcher.querySpecification());
+ allMatches = roengine.getAllMatches(LongSciFiBooksOfAuthor.Matcher.querySpecification());
assertTrue(!allMatches.isEmpty());
} catch (ViatraQueryException e) {
diff --git a/query/papyrus-uml/org.eclipse.viatra.examples.uml.queries/.classpath b/query/papyrus-uml/org.eclipse.viatra.examples.uml.queries/.classpath
index a376b7c..18d531d 100644
--- a/query/papyrus-uml/org.eclipse.viatra.examples.uml.queries/.classpath
+++ b/query/papyrus-uml/org.eclipse.viatra.examples.uml.queries/.classpath
@@ -3,6 +3,6 @@
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="src-gen"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/query/papyrus-uml/org.eclipse.viatra.examples.uml.queries/.settings/org.eclipse.jdt.core.prefs b/query/papyrus-uml/org.eclipse.viatra.examples.uml.queries/.settings/org.eclipse.jdt.core.prefs
index c537b63..0c68a61 100644
--- a/query/papyrus-uml/org.eclipse.viatra.examples.uml.queries/.settings/org.eclipse.jdt.core.prefs
+++ b/query/papyrus-uml/org.eclipse.viatra.examples.uml.queries/.settings/org.eclipse.jdt.core.prefs
@@ -1,7 +1,7 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/query/papyrus-uml/org.eclipse.viatra.examples.uml.queries/META-INF/MANIFEST.MF b/query/papyrus-uml/org.eclipse.viatra.examples.uml.queries/META-INF/MANIFEST.MF
index 2ed1530..2861509 100644
--- a/query/papyrus-uml/org.eclipse.viatra.examples.uml.queries/META-INF/MANIFEST.MF
+++ b/query/papyrus-uml/org.eclipse.viatra.examples.uml.queries/META-INF/MANIFEST.MF
@@ -3,12 +3,11 @@
Bundle-Name: org.eclipse.viatra.examples.uml.queries
Bundle-SymbolicName: org.eclipse.viatra.examples.uml.queries;singleton:=true
Bundle-Version: 0.0.1.qualifier
-Export-Package: org.eclipse.viatra.examples.uml.queries,
- org.eclipse.viatra.examples.uml.queries.util
+Export-Package: org.eclipse.viatra.examples.uml.queries
Require-Bundle: org.eclipse.emf.ecore,
- org.eclipse.emf.transaction,
- org.eclipse.xtext.xbase.lib,
- org.eclipse.uml2.uml,
- org.eclipse.viatra.query.runtime
+ org.eclipse.emf.transaction,
+ org.eclipse.xtext.xbase.lib,
+ org.eclipse.uml2.uml,
+ org.eclipse.viatra.query.runtime
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Import-Package: org.apache.log4j
diff --git a/query/papyrus-uml/org.eclipse.viatra.examples.uml.queries/plugin.xml b/query/papyrus-uml/org.eclipse.viatra.examples.uml.queries/plugin.xml
index 1340f25..d3ce2dc 100644
--- a/query/papyrus-uml/org.eclipse.viatra.examples.uml.queries/plugin.xml
+++ b/query/papyrus-uml/org.eclipse.viatra.examples.uml.queries/plugin.xml
@@ -1,5 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?><plugin>
- <extension id="org.eclipse.viatra.examples.uml.queries.EmptyClass" point="org.eclipse.viatra.query.runtime.queryspecification">
- <group group="org.eclipse.viatra.query.runtime.extensibility.SingletonExtensionFactory:org.eclipse.viatra.examples.uml.queries.EmptyClass" id="org.eclipse.viatra.examples.uml.queries.EmptyClass"/>
+ <extension id="org.eclipse.viatra.examples.uml.queries.EmptyClassQueries" point="org.eclipse.viatra.query.runtime.queryspecification">
+ <group group="org.eclipse.viatra.query.runtime.extensibility.SingletonExtensionFactory:org.eclipse.viatra.examples.uml.queries.EmptyClassQueries" id="org.eclipse.viatra.examples.uml.queries.EmptyClassQueries">
+ <query-specification fqn="org.eclipse.viatra.examples.uml.queries.superClass"/>
+ <query-specification fqn="org.eclipse.viatra.examples.uml.queries.transitiveSuperClass"/>
+ <query-specification fqn="org.eclipse.viatra.examples.uml.queries.superOrEqualClass"/>
+ <query-specification fqn="org.eclipse.viatra.examples.uml.queries.ownsOperation"/>
+ <query-specification fqn="org.eclipse.viatra.examples.uml.queries.ownsProperty"/>
+ <query-specification fqn="org.eclipse.viatra.examples.uml.queries.hasOperation"/>
+ <query-specification fqn="org.eclipse.viatra.examples.uml.queries.hasProperty"/>
+ <query-specification fqn="org.eclipse.viatra.examples.uml.queries.emptyClass"/>
+ <query-specification fqn="org.eclipse.viatra.examples.uml.queries.nonEmptyClass"/>
+ <query-specification fqn="org.eclipse.viatra.examples.uml.queries.hasPropertyOrOperation"/>
+ </group>
</extension>
</plugin>
diff --git a/query/papyrus-uml/org.eclipse.viatra.examples.uml.queries/src/org/eclipse/viatra/examples/uml/queries/EmptyClass.vql b/query/papyrus-uml/org.eclipse.viatra.examples.uml.queries/src/org/eclipse/viatra/examples/uml/queries/EmptyClassQueries.vql
similarity index 100%
rename from query/papyrus-uml/org.eclipse.viatra.examples.uml.queries/src/org/eclipse/viatra/examples/uml/queries/EmptyClass.vql
rename to query/papyrus-uml/org.eclipse.viatra.examples.uml.queries/src/org/eclipse/viatra/examples/uml/queries/EmptyClassQueries.vql