Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query')
-rw-r--r--examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/.gitignore15
-rw-r--r--examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/BookAuthorsMatch.java208
-rw-r--r--examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/BookAuthorsMatcher.java281
-rw-r--r--examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/BooksWithMultipleAuthorsMatch.java183
-rw-r--r--examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/BooksWithMultipleAuthorsMatcher.java211
-rw-r--r--examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/Eiqlibrary.java124
-rw-r--r--examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/LongSciFiBooksOfAuthorMatch.java208
-rw-r--r--examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/LongSciFiBooksOfAuthorMatcher.java283
-rw-r--r--examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/RequestCountOfLibraryMatch.java207
-rw-r--r--examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/RequestCountOfLibraryMatcher.java280
-rw-r--r--examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/SingleAuthoredFirstBooksMatch.java208
-rw-r--r--examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/SingleAuthoredFirstBooksMatcher.java282
-rw-r--r--examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/SomeBooksWithTwoAuthorsMatch.java208
-rw-r--r--examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/SomeBooksWithTwoAuthorsMatcher.java283
-rw-r--r--examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/SumOfPagesInLibraryMatch.java207
-rw-r--r--examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/SumOfPagesInLibraryMatcher.java280
-rw-r--r--examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/.gitignore14
-rw-r--r--examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/BookAuthorsProcessor.java28
-rw-r--r--examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/BookAuthorsQuerySpecification.java142
-rw-r--r--examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/BooksWithMultipleAuthorsProcessor.java26
-rw-r--r--examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/BooksWithMultipleAuthorsQuerySpecification.java169
-rw-r--r--examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/LongSciFiBooksOfAuthorProcessor.java28
-rw-r--r--examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/LongSciFiBooksOfAuthorQuerySpecification.java175
-rw-r--r--examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/RequestCountOfLibraryProcessor.java27
-rw-r--r--examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/RequestCountOfLibraryQuerySpecification.java141
-rw-r--r--examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/SingleAuthoredFirstBooksProcessor.java28
-rw-r--r--examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/SingleAuthoredFirstBooksQuerySpecification.java154
-rw-r--r--examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/SomeBooksWithTwoAuthorsProcessor.java28
-rw-r--r--examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/SomeBooksWithTwoAuthorsQuerySpecification.java158
-rw-r--r--examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/SumOfPagesInLibraryProcessor.java27
-rw-r--r--examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/SumOfPagesInLibraryQuerySpecification.java141
31 files changed, 0 insertions, 4754 deletions
diff --git a/examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/.gitignore b/examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/.gitignore
deleted file mode 100644
index ef5710f77..000000000
--- a/examples/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/examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/BookAuthorsMatch.java b/examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/BookAuthorsMatch.java
deleted file mode 100644
index 2e2277a8a..000000000
--- a/examples/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/examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/BookAuthorsMatcher.java b/examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/BookAuthorsMatcher.java
deleted file mode 100644
index 2be74ad3d..000000000
--- a/examples/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/examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/BooksWithMultipleAuthorsMatch.java b/examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/BooksWithMultipleAuthorsMatch.java
deleted file mode 100644
index ec26c2dd1..000000000
--- a/examples/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/examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/BooksWithMultipleAuthorsMatcher.java b/examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/BooksWithMultipleAuthorsMatcher.java
deleted file mode 100644
index 3bb7904de..000000000
--- a/examples/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/examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/Eiqlibrary.java b/examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/Eiqlibrary.java
deleted file mode 100644
index d77871f13..000000000
--- a/examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/Eiqlibrary.java
+++ /dev/null
@@ -1,124 +0,0 @@
-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;
-
-/**
- * A pattern group formed of all patterns defined in eiqlibrary.vql.
- *
- * <p>Use the static instance as any {@link org.eclipse.viatra.query.runtime.api.IPatternGroup}, 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.
- *
- * <p> From package org.eclipse.viatra.query.runtime.runonce.tests, the group contains the definition of the following patterns: <ul>
- * <li>bookAuthors</li>
- * <li>booksWithMultipleAuthors</li>
- * <li>sumOfPagesInLibrary</li>
- * <li>singleAuthoredFirstBooks</li>
- * <li>longSciFiBooksOfAuthor</li>
- * <li>requestCountOfLibrary</li>
- * <li>someBooksWithTwoAuthors</li>
- * </ul>
- *
- * @see IPatternGroup
- *
- */
-@SuppressWarnings("all")
-public final class Eiqlibrary extends BaseGeneratedPatternGroup {
- /**
- * 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
- *
- */
- public static Eiqlibrary instance() throws ViatraQueryException {
- if (INSTANCE == null) {
- 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());
- }
-
- public BookAuthorsQuerySpecification getBookAuthors() throws ViatraQueryException {
- return BookAuthorsQuerySpecification.instance();
- }
-
- public BookAuthorsMatcher getBookAuthors(final ViatraQueryEngine engine) throws ViatraQueryException {
- return BookAuthorsMatcher.on(engine);
- }
-
- public BooksWithMultipleAuthorsQuerySpecification getBooksWithMultipleAuthors() throws ViatraQueryException {
- return BooksWithMultipleAuthorsQuerySpecification.instance();
- }
-
- public BooksWithMultipleAuthorsMatcher getBooksWithMultipleAuthors(final ViatraQueryEngine engine) throws ViatraQueryException {
- return BooksWithMultipleAuthorsMatcher.on(engine);
- }
-
- public SumOfPagesInLibraryQuerySpecification getSumOfPagesInLibrary() throws ViatraQueryException {
- return SumOfPagesInLibraryQuerySpecification.instance();
- }
-
- public SumOfPagesInLibraryMatcher getSumOfPagesInLibrary(final ViatraQueryEngine engine) throws ViatraQueryException {
- return SumOfPagesInLibraryMatcher.on(engine);
- }
-
- public SingleAuthoredFirstBooksQuerySpecification getSingleAuthoredFirstBooks() throws ViatraQueryException {
- return SingleAuthoredFirstBooksQuerySpecification.instance();
- }
-
- public SingleAuthoredFirstBooksMatcher getSingleAuthoredFirstBooks(final ViatraQueryEngine engine) throws ViatraQueryException {
- return SingleAuthoredFirstBooksMatcher.on(engine);
- }
-
- public LongSciFiBooksOfAuthorQuerySpecification getLongSciFiBooksOfAuthor() throws ViatraQueryException {
- return LongSciFiBooksOfAuthorQuerySpecification.instance();
- }
-
- public LongSciFiBooksOfAuthorMatcher getLongSciFiBooksOfAuthor(final ViatraQueryEngine engine) throws ViatraQueryException {
- return LongSciFiBooksOfAuthorMatcher.on(engine);
- }
-
- public RequestCountOfLibraryQuerySpecification getRequestCountOfLibrary() throws ViatraQueryException {
- return RequestCountOfLibraryQuerySpecification.instance();
- }
-
- public RequestCountOfLibraryMatcher getRequestCountOfLibrary(final ViatraQueryEngine engine) throws ViatraQueryException {
- return RequestCountOfLibraryMatcher.on(engine);
- }
-
- public SomeBooksWithTwoAuthorsQuerySpecification getSomeBooksWithTwoAuthors() throws ViatraQueryException {
- return SomeBooksWithTwoAuthorsQuerySpecification.instance();
- }
-
- public SomeBooksWithTwoAuthorsMatcher getSomeBooksWithTwoAuthors(final ViatraQueryEngine engine) throws ViatraQueryException {
- return SomeBooksWithTwoAuthorsMatcher.on(engine);
- }
-}
diff --git a/examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/LongSciFiBooksOfAuthorMatch.java b/examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/LongSciFiBooksOfAuthorMatch.java
deleted file mode 100644
index 2c5274189..000000000
--- a/examples/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/examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/LongSciFiBooksOfAuthorMatcher.java b/examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/LongSciFiBooksOfAuthorMatcher.java
deleted file mode 100644
index fdc7880c8..000000000
--- a/examples/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/examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/RequestCountOfLibraryMatch.java b/examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/RequestCountOfLibraryMatch.java
deleted file mode 100644
index a468cb529..000000000
--- a/examples/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/examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/RequestCountOfLibraryMatcher.java b/examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/RequestCountOfLibraryMatcher.java
deleted file mode 100644
index 974fe4a6b..000000000
--- a/examples/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/examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/SingleAuthoredFirstBooksMatch.java b/examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/SingleAuthoredFirstBooksMatch.java
deleted file mode 100644
index a7a678b14..000000000
--- a/examples/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/examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/SingleAuthoredFirstBooksMatcher.java b/examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/SingleAuthoredFirstBooksMatcher.java
deleted file mode 100644
index d69cedd5a..000000000
--- a/examples/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/examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/SomeBooksWithTwoAuthorsMatch.java b/examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/SomeBooksWithTwoAuthorsMatch.java
deleted file mode 100644
index 5534fd2f0..000000000
--- a/examples/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/examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/SomeBooksWithTwoAuthorsMatcher.java b/examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/SomeBooksWithTwoAuthorsMatcher.java
deleted file mode 100644
index 8e2f2e29e..000000000
--- a/examples/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/examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/SumOfPagesInLibraryMatch.java b/examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/SumOfPagesInLibraryMatch.java
deleted file mode 100644
index 40dff3846..000000000
--- a/examples/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/examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/SumOfPagesInLibraryMatcher.java b/examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/SumOfPagesInLibraryMatcher.java
deleted file mode 100644
index 331e16b06..000000000
--- a/examples/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/examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/.gitignore b/examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/.gitignore
deleted file mode 100644
index 75d24fa4e..000000000
--- a/examples/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/examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/BookAuthorsProcessor.java b/examples/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 2b8bbc978..000000000
--- a/examples/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/examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/BookAuthorsQuerySpecification.java b/examples/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 a28540cc0..000000000
--- a/examples/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/examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/BooksWithMultipleAuthorsProcessor.java b/examples/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 8c6acec4c..000000000
--- a/examples/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/examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/BooksWithMultipleAuthorsQuerySpecification.java b/examples/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 5195a5290..000000000
--- a/examples/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/examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/LongSciFiBooksOfAuthorProcessor.java b/examples/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 1c3a97ea9..000000000
--- a/examples/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/examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/LongSciFiBooksOfAuthorQuerySpecification.java b/examples/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 0b305e21f..000000000
--- a/examples/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/examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/RequestCountOfLibraryProcessor.java b/examples/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 36da74346..000000000
--- a/examples/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/examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/RequestCountOfLibraryQuerySpecification.java b/examples/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 b2d212213..000000000
--- a/examples/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/examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/SingleAuthoredFirstBooksProcessor.java b/examples/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 fd44b2cfc..000000000
--- a/examples/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/examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/SingleAuthoredFirstBooksQuerySpecification.java b/examples/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 8ea641488..000000000
--- a/examples/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/examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/SomeBooksWithTwoAuthorsProcessor.java b/examples/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 bdd5e7b23..000000000
--- a/examples/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/examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/SomeBooksWithTwoAuthorsQuerySpecification.java b/examples/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 7a03a6304..000000000
--- a/examples/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/examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/SumOfPagesInLibraryProcessor.java b/examples/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 3c83cdbc3..000000000
--- a/examples/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/examples/minilibrary/org.eclipse.viatra.query.runtime.runonce.tests/src-gen/org/eclipse/viatra/query/runtime/runonce/tests/util/SumOfPagesInLibraryQuerySpecification.java b/examples/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 d8b7c09b6..000000000
--- a/examples/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;
- }
- }
-}

Back to the top