From 36ca60e5b6bd047a4f444d96241bd60a01bbab17 Mon Sep 17 00:00:00 2001 From: ArenBabikian Date: Mon, 27 Apr 2020 10:45:28 -0400 Subject: rename Pledge Case Studies and add familyTree case study --- .../src-gen/queries/X_inv11_incNotOver100.java | 80 +++++++++++++++++++++- 1 file changed, 77 insertions(+), 3 deletions(-) (limited to 'Tests/MODELS2020-CaseStudies/case.study.pledge.queries/src-gen/queries/X_inv11_incNotOver100.java') diff --git a/Tests/MODELS2020-CaseStudies/case.study.pledge.queries/src-gen/queries/X_inv11_incNotOver100.java b/Tests/MODELS2020-CaseStudies/case.study.pledge.queries/src-gen/queries/X_inv11_incNotOver100.java index 35b30b0f..995946eb 100644 --- a/Tests/MODELS2020-CaseStudies/case.study.pledge.queries/src-gen/queries/X_inv11_incNotOver100.java +++ b/Tests/MODELS2020-CaseStudies/case.study.pledge.queries/src-gen/queries/X_inv11_incNotOver100.java @@ -1,5 +1,5 @@ /** - * Generated from platform:/resource/case.study.a.queries/src/queries/case_study_A.vql + * Generated from platform:/resource/case.study.pledge.run/src/queries/case_study_A.vql */ package queries; @@ -11,11 +11,14 @@ import java.util.List; import java.util.Objects; import java.util.Optional; import java.util.Set; +import java.util.function.Consumer; +import java.util.stream.Collectors; import java.util.stream.Stream; import org.apache.log4j.Logger; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EDataType; import org.eclipse.viatra.query.runtime.api.IPatternMatch; +import org.eclipse.viatra.query.runtime.api.IQuerySpecification; import org.eclipse.viatra.query.runtime.api.ViatraQueryEngine; import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFPQuery; import org.eclipse.viatra.query.runtime.api.impl.BaseGeneratedEMFQuerySpecification; @@ -36,6 +39,7 @@ import org.eclipse.viatra.query.runtime.matchers.psystem.basicenumerables.TypeCo import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameterDirection; import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PVisibility; +import org.eclipse.viatra.query.runtime.matchers.tuple.Tuple; import org.eclipse.viatra.query.runtime.matchers.tuple.Tuples; import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; @@ -312,7 +316,9 @@ public final class X_inv11_incNotOver100 extends BaseGeneratedEMFQuerySpecificat * @return matches represented as a Match object. * */ - public Collection getAllMatches(); + public Collection getAllMatches(final Expense pExp) { + return rawStreamAllMatches(new Object[]{pExp}).collect(Collectors.toSet()); + } /** * Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. @@ -368,7 +374,9 @@ public final class X_inv11_incNotOver100 extends BaseGeneratedEMFQuerySpecificat * @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(); + public boolean forOneArbitraryMatch(final Expense pExp, final Consumer processor) { + return rawForOneArbitraryMatch(new Object[]{pExp}, processor); + } /** * Returns a new (partial) match. @@ -381,6 +389,72 @@ public final class X_inv11_incNotOver100 extends BaseGeneratedEMFQuerySpecificat public X_inv11_incNotOver100.Match newMatch(final Expense pExp) { return X_inv11_incNotOver100.Match.newMatch(pExp); } + + /** + * Retrieve the set of values that occur in matches for exp. + * @return the Set of all values or empty set if there are no matches + * + */ + protected Stream rawStreamAllValuesOfexp(final Object[] parameters) { + return rawStreamAllValues(POSITION_EXP, parameters).map(Expense.class::cast); + } + + /** + * Retrieve the set of values that occur in matches for exp. + * @return the Set of all values or empty set if there are no matches + * + */ + public Set getAllValuesOfexp() { + return rawStreamAllValuesOfexp(emptyArray()).collect(Collectors.toSet()); + } + + /** + * Retrieve the set of values that occur in matches for exp. + * @return the Set of all values or empty set if there are no matches + * + */ + public Stream streamAllValuesOfexp() { + return rawStreamAllValuesOfexp(emptyArray()); + } + + @Override + protected X_inv11_incNotOver100.Match tupleToMatch(final Tuple t) { + try { + return X_inv11_incNotOver100.Match.newMatch((Expense) t.get(POSITION_EXP)); + } catch(ClassCastException e) { + LOGGER.error("Element(s) in tuple not properly typed!",e); + return null; + } + } + + @Override + protected X_inv11_incNotOver100.Match arrayToMatch(final Object[] match) { + try { + return X_inv11_incNotOver100.Match.newMatch((Expense) match[POSITION_EXP]); + } catch(ClassCastException e) { + LOGGER.error("Element(s) in array not properly typed!",e); + return null; + } + } + + @Override + protected X_inv11_incNotOver100.Match arrayToMatchMutable(final Object[] match) { + try { + return X_inv11_incNotOver100.Match.newMutableMatch((Expense) match[POSITION_EXP]); + } 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 ViatraQueryRuntimeException if the pattern definition could not be loaded + * + */ + public static IQuerySpecification querySpecification() { + return X_inv11_incNotOver100.instance(); + } } private X_inv11_incNotOver100() { -- cgit v1.2.3-70-g09d2